Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Issue 2414333003: WebMessaging: Send transferable ArrayBuffers by copy-and-neuter semantics (Closed)

Created:
4 years, 2 months ago by nhiroki
Modified:
4 years, 1 month ago
Reviewers:
haraken, horo
CC:
chromium-reviews, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews-bindings_chromium.org, blink-reviews, rwlbuis, falken, shimazu
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

WebMessaging: Send transferable ArrayBuffers by copy-and-neuter semantics Before this CL, MessagePort/ServiceWorker/Client can send an ArrayBuffer with copy semantics, but it cannot send an ArrayBuffer with move semantics even if it's specified as a transferable object. // Copy semantics. port.postMessage(arrayBuffer); // Move semantics. Currently, this doesn't work and shows a warning message // instead. See https://codereview.chromium.org/1301953002 port.postMessage(arrayBuffer, [arrayBuffer]); After this CL, they emulate move semantics by copy-and-neuter semantics that sends an ArrayBuffer by copy semantics and neuters the original ArrayBuffer. <Context of this change> Because of Chromium's multi-process architecture, a target object can be in a different process from a sender object. This makes it difficult to support zero-copy transfer (move semantics) because it needs to stride over process memory boundaries. Using shared memory is a possible solution, but that seems to need architectual changes and introduce complexity. Therefore, as a stopgap, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Aokg/edit# BUG=334408, 511119 Committed: https://crrev.com/99a2756462a76ca70613375784a1a4fa8f3576bb Cr-Commit-Position: refs/heads/master@{#427015}

Patch Set 1 #

Patch Set 2 : remake #

Total comments: 12

Patch Set 3 : iterator #

Patch Set 4 : add layout tests for ServiceWorker/Client #

Patch Set 5 : tweak layout tests #

Patch Set 6 : add more tests #

Patch Set 7 : fix tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+433 lines, -95 lines) Patch
M third_party/WebKit/LayoutTests/fast/events/message-port-clone-expected.txt View 1 chunk +0 lines, -2 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/events/message-port-transferables.html View 1 2 3 4 5 6 1 chunk +176 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/serviceworker/postmessage.html View 1 2 3 4 5 1 chunk +86 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-transferables-worker.js View 1 2 3 4 5 1 chunk +24 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h View 1 2 chunks +8 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp View 1 2 4 chunks +71 lines, -63 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_methods.py View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl View 1 2 2 chunks +29 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 1 2 3 chunks +30 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/dom/MessagePort.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/MessagePort.cpp View 2 chunks +0 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h View 1 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/workers/InProcessWorkerBase.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp View 1 2 chunks +0 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h View 1 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp View 1 2 chunks +0 lines, -7 lines 0 comments Download

Messages

Total messages: 85 (69 generated)
nhiroki
haraken@, can you review this or forward this to an appropriate reviewer? Thanks.
4 years, 2 months ago (2016-10-18 01:33:25 UTC) #26
haraken
Would it be possible to reduce the amount of custom bindings by using [Custom=CallPrologue]? However, ...
4 years, 2 months ago (2016-10-18 01:43:53 UTC) #27
nhiroki
Thank you for your comments. On 2016/10/18 01:43:53, haraken wrote: > Would it be possible ...
4 years, 2 months ago (2016-10-18 04:10:10 UTC) #28
nhiroki
Updated. Can you take another look? I'll add layout tests for ServiceWorker/Client later in this ...
4 years, 2 months ago (2016-10-19 07:14:48 UTC) #35
haraken
https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp#newcode357 third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:357: for (size_t i = 0; i < arrayBuffers.size(); ++i) ...
4 years, 2 months ago (2016-10-19 09:49:28 UTC) #37
nhiroki
Thank you for reviewing. Comment reply only. I'll update the CL tomorrow. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp File third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp ...
4 years, 2 months ago (2016-10-19 12:51:53 UTC) #38
haraken
https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp File third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp#newcode11562 third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp:11562: // buffers by copy semantics and then neuters the ...
4 years, 2 months ago (2016-10-19 15:40:46 UTC) #41
nhiroki
Updated. PTAL, thanks! https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp#newcode357 third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:357: for (size_t i = 0; i ...
4 years, 2 months ago (2016-10-20 07:44:03 UTC) #50
haraken
Great, thanks for the clarification. LGTM.
4 years, 2 months ago (2016-10-20 09:02:23 UTC) #51
nhiroki
+horo, can you review http/tests/serviceworker/postmessage.html? Thanks!
4 years, 2 months ago (2016-10-21 02:04:22 UTC) #65
horo
On 2016/10/21 02:04:22, nhiroki (slow) wrote: > +horo, can you review http/tests/serviceworker/postmessage.html? Thanks! As I ...
4 years, 2 months ago (2016-10-21 07:26:03 UTC) #68
nhiroki
On 2016/10/21 07:26:03, horo wrote: > On 2016/10/21 02:04:22, nhiroki (slow) wrote: > > +horo, ...
4 years, 2 months ago (2016-10-21 10:27:46 UTC) #71
horo
lgtm
4 years, 2 months ago (2016-10-24 03:25:18 UTC) #78
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2414333003/370001
4 years, 2 months ago (2016-10-24 03:28:33 UTC) #81
commit-bot: I haz the power
Committed patchset #7 (id:370001)
4 years, 1 month ago (2016-10-24 04:56:14 UTC) #83
commit-bot: I haz the power
4 years, 1 month ago (2016-10-24 04:58:50 UTC) #85
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/99a2756462a76ca70613375784a1a4fa8f3576bb
Cr-Commit-Position: refs/heads/master@{#427015}

Powered by Google App Engine
This is Rietveld 408576698