New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 798557 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Enable lazy mojo serialization for MessagePort messages

Project Member Reported by mek@chromium.org, Jan 2 2018

Issue description

In-process messages should skip serialization, to enable passing SharedArrayBuffers over message ports.

(split of from 750468)
 
I assume you mean that they shouldn't be serialized to the Mojo pipe, correct? The V8 serialization step is still required.

Comment 2 by mek@chromium.org, Jan 2 2018

Yes. They'll still be serialized to SerializedScriptValue, but that SSV is then passed directly to the receiving MessagePort, skipping any further mojo specific serialization.

Comment 3 by mek@chromium.org, Jan 2 2018

Summary: Enable lazy mojo serialization for MessagePort messages (was: Enable lazy serialization for MessagePort messages)

Comment 4 by mek@chromium.org, Jan 2 2018

Actually doing the lazy mojo serialization is pretty straight forward, but that's not enough to be fully spec compliant, because if a message is sent from one agent cluster to another agent in a different agent cluster we do still need to make sure to not share SAB and WASM modules, even if they happen to be in the same renderer process (the easiest way would of course be to explicitly serialize in those cases). But not sure if blink already has some way of checking if two ExecutionContexts are in the same agent cluster.

Comment 5 by mek@chromium.org, Jan 2 2018

And the same-agent-cluster check should probably be in SerializedScriptValue (de)serialization, so I'll for now work around it in MessagePort by mojo-serializing a little more than necessarily until SSV is updated to have the proper same-agent-cluster checks (and I'll file a separate bug for that).

Comment 6 by mek@chromium.org, Jan 2 2018

Filed issue 798572 for the SSV agent cluster check.
Project Member

Comment 7 by bugdroid1@chromium.org, Jan 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9022043fbc593f52e0694f08de0a53368d994064

commit 9022043fbc593f52e0694f08de0a53368d994064
Author: Marijn Kruisselbrink <mek@chromium.org>
Date: Wed Jan 03 22:00:15 2018

Skip mojo serialization for MessagePort messages that stay in process.

This will help enable SharedArrayBuffer to be posted to other agents
in the same agent cluster.

Bug:  798557 
Change-Id: I2fe3baa11e7aa910ecff75fb11bb5f521810c84f
Reviewed-on: https://chromium-review.googlesource.com/840606
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526832}
[modify] https://crrev.com/9022043fbc593f52e0694f08de0a53368d994064/mojo/public/tools/bindings/BUILD.gn
[modify] https://crrev.com/9022043fbc593f52e0694f08de0a53368d994064/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
[add] https://crrev.com/9022043fbc593f52e0694f08de0a53368d994064/mojo/public/tools/bindings/generators/cpp_templates/struct_unserialized_message_context.tmpl
[modify] https://crrev.com/9022043fbc593f52e0694f08de0a53368d994064/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
[modify] https://crrev.com/9022043fbc593f52e0694f08de0a53368d994064/third_party/WebKit/LayoutTests/TestExpectations
[modify] https://crrev.com/9022043fbc593f52e0694f08de0a53368d994064/third_party/WebKit/Source/core/messaging/MessagePort.cpp

Comment 8 by mek@chromium.org, Jan 3 2018

Status: Fixed (was: Started)

Sign in to add a comment