|
|
Created:
4 years, 2 months ago by nhiroki Modified:
4 years, 1 month ago 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. |
DescriptionWebMessaging: 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 #Messages
Total messages: 85 (69 generated)
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #8 (id:130001) has been deleted
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #1 (id:1) has been deleted
Patchset #1 (id:20001) has been deleted
Patchset #1 (id:40001) has been deleted
Patchset #1 (id:50001) has been deleted
Patchset #1 (id:70001) has been deleted
Patchset #1 (id:90001) has been deleted
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Description was changed from ========== (WIP) WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy BUG= ========== to ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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 and instead shows a warning message. (see https://codereview.chromium.org/1301953002) // This sends |arrayBuffer| with copy semantics. port.postMessage(arrayBuffer); // This doesn't send |arrayBuffer| and shows a warning message instead. port.postMessage(arrayBuffer, [arrayBuffer]); After this CL, MessagePort emulates a move semantics by sending an ArrayBuffer with copy-and-neuter semantics that copys a src ArrayBuffer to a target and neuters the src. <Context of this change> On the current implementation, a target port can be in a different process from a sender port. This makes it difficult to support move semantics for transferable ArrayBuffer because the semantics requires both ports are on the same process memory space. Using shared memory is a possible solution for the problem, but that seems to need architectual changes and introduce complexity. Therefore, as a first step, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ==========
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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 and instead shows a warning message. (see https://codereview.chromium.org/1301953002) // This sends |arrayBuffer| with copy semantics. port.postMessage(arrayBuffer); // This doesn't send |arrayBuffer| and shows a warning message instead. port.postMessage(arrayBuffer, [arrayBuffer]); After this CL, MessagePort emulates a move semantics by sending an ArrayBuffer with copy-and-neuter semantics that copys a src ArrayBuffer to a target and neuters the src. <Context of this change> On the current implementation, a target port can be in a different process from a sender port. This makes it difficult to support move semantics for transferable ArrayBuffer because the semantics requires both ports are on the same process memory space. Using shared memory is a possible solution for the problem, but that seems to need architectual changes and introduce complexity. Therefore, as a first step, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ========== to ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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 and instead shows a warning message. (see https://codereview.chromium.org/1301953002) // This sends |arrayBuffer| with copy semantics. port.postMessage(arrayBuffer); // This doesn't send |arrayBuffer| and shows a warning message instead. port.postMessage(arrayBuffer, [arrayBuffer]); After this CL, MessagePort emulates a move semantics by sending an ArrayBuffer with copy-and-neuter semantics that copys a src ArrayBuffer to a target and neuters the src. <Context of this change> On the current implementation, a target port can be in a different process from a sender port. This makes it difficult to support move semantics for transferable ArrayBuffer because the semantics requires both ports are on the same process memory space. Using shared memory is a possible solution for the problem, but that seems to need architectual changes and introduce complexity. Therefore, as a first step, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ==========
Patchset #1 (id:110001) has been deleted
Patchset #1 (id:150001) has been deleted
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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 and instead shows a warning message. (see https://codereview.chromium.org/1301953002) // This sends |arrayBuffer| with copy semantics. port.postMessage(arrayBuffer); // This doesn't send |arrayBuffer| and shows a warning message instead. port.postMessage(arrayBuffer, [arrayBuffer]); After this CL, MessagePort emulates a move semantics by sending an ArrayBuffer with copy-and-neuter semantics that copys a src ArrayBuffer to a target and neuters the src. <Context of this change> On the current implementation, a target port can be in a different process from a sender port. This makes it difficult to support move semantics for transferable ArrayBuffer because the semantics requires both ports are on the same process memory space. Using shared memory is a possible solution for the problem, but that seems to need architectual changes and introduce complexity. Therefore, as a first step, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ========== to ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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 and instead shows a warning message. (see https://codereview.chromium.org/1301953002) // Copy semantics. port.postMessage(arrayBuffer); // Move semantics. Currently, this doesn't work and shows a warning message // instead. port.postMessage(arrayBuffer, [arrayBuffer]); After this CL, MessagePort emulates move semantics by copy-and-neuter semantics that copys an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> On the current implementation, a target port can be in a different process from a sender port. This makes it difficult to support move semantics for transferable ArrayBuffer because the semantics requires both ports are on the same process memory space. Using shared memory is a possible solution for the problem, but that seems to need architectual changes and introduce complexity. Therefore, as a first step, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ==========
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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 and instead shows a warning message. (see https://codereview.chromium.org/1301953002) // Copy semantics. port.postMessage(arrayBuffer); // Move semantics. Currently, this doesn't work and shows a warning message // instead. port.postMessage(arrayBuffer, [arrayBuffer]); After this CL, MessagePort emulates move semantics by copy-and-neuter semantics that copys an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> On the current implementation, a target port can be in a different process from a sender port. This makes it difficult to support move semantics for transferable ArrayBuffer because the semantics requires both ports are on the same process memory space. Using shared memory is a possible solution for the problem, but that seems to need architectual changes and introduce complexity. Therefore, as a first step, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ========== to ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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, MessagePort emulates move semantics by copy-and-neuter semantics that copies an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> On the current implementation, a target port can be in a different process from a sender port. This makes it difficult to support move semantics for transferable ArrayBuffer because the semantics requires both ports are on the same process memory space. Using shared memory is a possible solution for the problem, but that seems to need architectual changes and introduce complexity. Therefore, as a first step, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ==========
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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, MessagePort emulates move semantics by copy-and-neuter semantics that copies an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> On the current implementation, a target port can be in a different process from a sender port. This makes it difficult to support move semantics for transferable ArrayBuffer because the semantics requires both ports are on the same process memory space. Using shared memory is a possible solution for the problem, but that seems to need architectual changes and introduce complexity. Therefore, as a first step, we support sending a transferable ArrayBuffer with copy-and-neuter semantics. See this document for more details: https://docs.google.com/document/d/17o_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ========== to ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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, MessagePort emulates move semantics by copy-and-neuter semantics that copies an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> Because of Chromium's multi-process architecture, a target port can be in a different process from a sender port. 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ==========
nhiroki@chromium.org changed reviewers: + haraken@chromium.org
haraken@, can you review this or forward this to an appropriate reviewer? Thanks.
Would it be possible to reduce the amount of custom bindings by using [Custom=CallPrologue]? However, I'm wondering if we can completely remove the custom bindings. - Do you know why MessagePort::postMessage doesn't have [PostMessage]. postMessage() methods in other IDL files have [PostMessage]. - Maybe a right fix is 1) to add [PostMessage] to MessagePort::postMessage and implement the logic in this CL to the generated code for [PostMessage]?
Thank you for your comments. On 2016/10/18 01:43:53, haraken wrote: > Would it be possible to reduce the amount of custom bindings by using > [Custom=CallPrologue]? > > However, I'm wondering if we can completely remove the custom bindings. > > - Do you know why MessagePort::postMessage doesn't have [PostMessage]. > postMessage() methods in other IDL files have [PostMessage]. It looks to me like MessagePort::postMessage already has [PostMessage]...? My patch replaces it with [Custom] though. > - Maybe a right fix is 1) to add [PostMessage] to MessagePort::postMessage and > implement the logic in this CL to the generated code for [PostMessage]? Pushing the custom code into a template sounds reasonable. This also enables to reuse the same logic for ServiceWorker/Client.postMessage etc (see https://crbug.com/511119). One thing that I'm concerned is that [PostMessage] template is also used for in-process workers (e.g., DedicatedWorker and CompositorWorker) already supporting move semantics. Probably we need to separate the template for in-process workers and others (e.g., MessagePort, ServiceWorker). Anyway, I'll try it :)
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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, MessagePort emulates move semantics by copy-and-neuter semantics that copies an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> Because of Chromium's multi-process architecture, a target port can be in a different process from a sender port. 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ========== to ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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, MessagePort emulates move semantics by copy-and-neuter semantics that copies an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> Because of Chromium's multi-process architecture, a target port can be in a different process from a sender port. 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ==========
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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, MessagePort emulates move semantics by copy-and-neuter semantics that copies an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> Because of Chromium's multi-process architecture, a target port can be in a different process from a sender port. 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408 ========== to ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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, MessagePort emulates move semantics by copy-and-neuter semantics that copies an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> Because of Chromium's multi-process architecture, a target port can be in a different process from a sender port. 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ==========
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer over MessagePort by copy-and-neuter semantics Before this CL, MessagePort 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, MessagePort emulates move semantics by copy-and-neuter semantics that copies an ArrayBuffer like copy semantics and neuters the ArrayBuffer in the sender-side. <Context of this change> Because of Chromium's multi-process architecture, a target port can be in a different process from a sender port. 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ========== to ========== WebMessaging: Send a transferable ArrayBuffer 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ==========
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ========== to ========== WebMessaging: Send a transferable ArrayBuffer 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ==========
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Description was changed from ========== WebMessaging: Send a transferable ArrayBuffer 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ========== to ========== 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ==========
Updated. Can you take another look? I'll add layout tests for ServiceWorker/Client later in this CL because they depend on this refactoring: https://codereview.chromium.org/2426723004/
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:357: for (size_t i = 0; i < arrayBuffers.size(); ++i) { Can we use an iterator? An index-based access is slow because we have an out-of-range check. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:370: for (size_t i = 0; i < arrayBuffers.size(); ++i) { Ditto. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:390: for (size_t j = 0; j < bufferHandles.size(); ++j) Ditto. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:408: for (size_t j = 0; j < bufferHandles.size(); ++j) Ditto. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... File third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp:11562: // buffers by copy semantics and then neuters the original array Just to confirm: Your intention is to NOT copy the array buffers (=ignore the array buffers), right?
Thank you for reviewing. Comment reply only. I'll update the CL tomorrow. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... File third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp:11562: // buffers by copy semantics and then neuters the original array On 2016/10/19 09:49:28, haraken wrote: > > Just to confirm: Your intention is to NOT copy the array buffers (=ignore the > array buffers), right? No. My intention is to copy-transfer the array buffers instead of move-transfer. Conversely, before this CL, we ignored the array buffers marked with transferable.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... File third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp:11562: // buffers by copy semantics and then neuters the original array On 2016/10/19 12:51:53, nhiroki (slow) wrote: > On 2016/10/19 09:49:28, haraken wrote: > > > > Just to confirm: Your intention is to NOT copy the array buffers (=ignore the > > array buffers), right? > > No. My intention is to copy-transfer the array buffers instead of move-transfer. > Conversely, before this CL, we ignored the array buffers marked with > transferable. I'm a bit confused. You're ignoring the return value of SerializedScriptValue::transferArrayBufferContents. Doesn't it mean that you're only neutering the array buffer without copying to the message?
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #3 (id:210001) has been deleted
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #3 (id:230001) has been deleted
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Updated. PTAL, thanks! https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... File third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:357: for (size_t i = 0; i < arrayBuffers.size(); ++i) { On 2016/10/19 09:49:28, haraken wrote: > > Can we use an iterator? An index-based access is slow because we have an > out-of-range check. Done. (Just to confirm: The out-of-range check indicates RELEASE_ASSERT in WTF::Vector::at(), right?) https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:370: for (size_t i = 0; i < arrayBuffers.size(); ++i) { On 2016/10/19 09:49:28, haraken wrote: > > Ditto. Done. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:390: for (size_t j = 0; j < bufferHandles.size(); ++j) On 2016/10/19 09:49:28, haraken wrote: > > Ditto. Done. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp:408: for (size_t j = 0; j < bufferHandles.size(); ++j) On 2016/10/19 09:49:28, haraken wrote: > > Ditto. Done. https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... File third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp (right): https://codereview.chromium.org/2414333003/diff/190001/third_party/WebKit/Sou... third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp:11562: // buffers by copy semantics and then neuters the original array On 2016/10/19 15:40:46, haraken wrote: > On 2016/10/19 12:51:53, nhiroki (slow) wrote: > > On 2016/10/19 09:49:28, haraken wrote: > > > > > > Just to confirm: Your intention is to NOT copy the array buffers (=ignore > the > > > array buffers), right? > > > > No. My intention is to copy-transfer the array buffers instead of > move-transfer. > > Conversely, before this CL, we ignored the array buffers marked with > > transferable. > > I'm a bit confused. > > You're ignoring the return value of > SerializedScriptValue::transferArrayBufferContents. Doesn't it mean that you're > only neutering the array buffer without copying to the message? SerializedScriptValue::serialize() copies the array buffer into the message before SerializedScriptValue::transferArrayBufferContents() neuters them. I guess |transferables.arrayBuffers.clear()| at line 11568 could be confusing. That doesn't mean serialize() ignores ArrayBuffers in info[0], but means serialize() handles them as regular objects (non-transferable objects) and copies them into the message instead. I slightly revised the impl comment.
Great, thanks for the clarification. LGTM.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Patchset #4 (id:270001) has been deleted
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #5 (id:310001) has been deleted
nhiroki@chromium.org changed reviewers: + horo@chromium.org
+horo, can you review http/tests/serviceworker/postmessage.html? Thanks!
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...)
On 2016/10/21 02:04:22, nhiroki (slow) wrote: > +horo, can you review http/tests/serviceworker/postmessage.html? Thanks! As I talked offline, we should have tests for passing a transferable ArrayBuffer over a MessageChannel to workers.
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2016/10/21 07:26:03, horo wrote: > On 2016/10/21 02:04:22, nhiroki (slow) wrote: > > +horo, can you review http/tests/serviceworker/postmessage.html? Thanks! > > As I talked offline, we should have tests for passing a transferable ArrayBuffer > over a MessageChannel to workers. Added more tests. Can you take another look?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by nhiroki@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm
The CQ bit was checked by nhiroki@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from haraken@chromium.org Link to the patchset: https://codereview.chromium.org/2414333003/#ps370001 (title: "fix tests")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ========== to ========== 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ==========
Message was sent while issue was closed.
Committed patchset #7 (id:370001)
Message was sent while issue was closed.
Description was changed from ========== 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 ========== to ========== 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_cjtc3Gk5cDZhoUc37EyhhvBb4wMlCROJvoC2Ao... BUG=334408, 511119 Committed: https://crrev.com/99a2756462a76ca70613375784a1a4fa8f3576bb Cr-Commit-Position: refs/heads/master@{#427015} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/99a2756462a76ca70613375784a1a4fa8f3576bb Cr-Commit-Position: refs/heads/master@{#427015} |