New issue
Advanced search Search tips
Starred by 4 users
Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature


Sign in to add a comment
Make OffscreenCanvas Transferable
Project Member Reported by junov@chromium.org, Dec 1 2015 Back to list
Make OffscreenCanvas transferable.
Attempting to transfer after calling getContext should throw an exception.
Doing anything on a neutered OffscreenCanvas should throw an exception
Calling getContext after transfer should work.
 
Comment 1 by junov@chromium.org, Dec 1 2015
Blocking: chromium:563816
Comment 2 by junov@chromium.org, Dec 1 2015
Blocking: chromium:563856
Comment 3 by junov@chromium.org, Dec 1 2015
Blocking: chromium:563858
Cc: junov@chromium.org
At this moment, we might have a limitation here that we may not support postMessage(OffScreenCanvas) via structure clone.
Comment 5 by junov@chromium.org, Jan 21 2016
The issue in #4 is that a transferred offscreen canvas is expected to to link back to the compositor when commit is called. This may not work when the OffscreenCanvas is posted cross-process or over the network through post message (structured clone).  Given this internal linkage, which cannot survive serialization, a structured clone of an OffscreenCanvas should either throw an exception or break the link.  This need to be discussed with Mozillans who are ahead in their implementation of this.
Comment 6 by junov@chromium.org, Jan 21 2016
The spec for structured clone can be left as is (we don't add anything about OffscreenCanvas to it). The spec already has generic provisions for unclonable objects:

==== SNIP ====

If input is another native object type (e.g. Error, Function)
If input is a host object (e.g. a DOM node)
--> Throw a DataCloneError exception and abort the overall structured clone algorithm.

==== SNIP ====
Blockedon: chromium:580649
Blockedon: 598753
Project Member Comment 9 by bugdroid1@chromium.org, Apr 21 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/47d06d097019e79f4f9a56068e086033ac72dba0

commit 47d06d097019e79f4f9a56068e086033ac72dba0
Author: xidachen <xidachen@chromium.org>
Date: Thu Apr 21 16:02:35 2016

Make OffscreenCanvas Transferable

At this moment, an offscreenCanvas could have an associated HTMLCanvasElement,
and we maintain a WeakPtr to that. Per discussion with esprehn@,
we change the strategy such that an offscreenCanvas holds a int which
is the DOMNodeId for its associated HTMLCanvasElement.

This change makes offscreenCanvas transferable much easier. In particular,
we just need to pass three int to deserializer, which are width, height
and DOMNodeId of for an offscreenCanvas.

A kayout test is included to test its correctness. The layout test
includes several things:
1). Transfer an offscreenCanvas to worker and transfer it back to main,
the width and height attributes should not change.
2). After transfer, the width/height should be 0.
3). Transfer a neutered offscreenCanvas should throw an exception.
4). After getting the offscreenCanvas back from the worker, call getContext('2d')
should work just fine.
5). Transfer an offscreenCanvas after calling getContext('2d')
should throw an exception.

BUG= 563845 

Review URL: https://codereview.chromium.org/1862033002

Cr-Commit-Position: refs/heads/master@{#388780}

[add] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions-expected.txt
[add] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html
[add] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-expected.txt
[add] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable.html
[add] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/LayoutTests/fast/canvas/resources/OffscreenCanvas-transferable.js
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/SerializationTag.h
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.h
[add] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/Transferables.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/Transferables.h
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/core/v8/v8.gypi
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.h
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.h
[add] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/modules/v8/TransferablesForModules.h
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/modules/v8/v8.gypi
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/templates/methods.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.cpp
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.h
[modify] https://crrev.com/47d06d097019e79f4f9a56068e086033ac72dba0/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.idl

Status: Fixed
Project Member Comment 11 by bugdroid1@chromium.org, Apr 21 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bd6b09d886a2a9dcfe4f032df890a4916e35f77e

commit bd6b09d886a2a9dcfe4f032df890a4916e35f77e
Author: xidachen <xidachen@chromium.org>
Date: Thu Apr 21 16:47:27 2016

Revert of Make OffscreenCanvas Transferable (patchset #20 id:380001 of https://codereview.chromium.org/1862033002/ )

Reason for revert:
Could be causing a failure to some unit_tests here:
https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Win%20x64%20Builder%20%28dbg%29/builds/80633

Original issue's description:
> Make OffscreenCanvas Transferable
>
> At this moment, an offscreenCanvas could have an associated HTMLCanvasElement,
> and we maintain a WeakPtr to that. Per discussion with esprehn@,
> we change the strategy such that an offscreenCanvas holds a int which
> is the DOMNodeId for its associated HTMLCanvasElement.
>
> This change makes offscreenCanvas transferable much easier. In particular,
> we just need to pass three int to deserializer, which are width, height
> and DOMNodeId of for an offscreenCanvas.
>
> A kayout test is included to test its correctness. The layout test
> includes several things:
> 1). Transfer an offscreenCanvas to worker and transfer it back to main,
> the width and height attributes should not change.
> 2). After transfer, the width/height should be 0.
> 3). Transfer a neutered offscreenCanvas should throw an exception.
> 4). After getting the offscreenCanvas back from the worker, call getContext('2d')
> should work just fine.
> 5). Transfer an offscreenCanvas after calling getContext('2d')
> should throw an exception.
>
> BUG= 563845 

TBR=junov@chromium.org,haraken@chromium.org,xlai@chromium.org,ajuma@chromium.org,sigbjornf@opera.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 563845 

Review URL: https://codereview.chromium.org/1904973003

Cr-Commit-Position: refs/heads/master@{#388790}

[delete] https://crrev.com/fd7327ae9bfb6aa4c4dc7b43cf58701648542a26/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions-expected.txt
[delete] https://crrev.com/fd7327ae9bfb6aa4c4dc7b43cf58701648542a26/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html
[delete] https://crrev.com/fd7327ae9bfb6aa4c4dc7b43cf58701648542a26/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-expected.txt
[delete] https://crrev.com/fd7327ae9bfb6aa4c4dc7b43cf58701648542a26/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable.html
[delete] https://crrev.com/fd7327ae9bfb6aa4c4dc7b43cf58701648542a26/third_party/WebKit/LayoutTests/fast/canvas/resources/OffscreenCanvas-transferable.js
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/SerializationTag.h
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.h
[delete] https://crrev.com/fd7327ae9bfb6aa4c4dc7b43cf58701648542a26/third_party/WebKit/Source/bindings/core/v8/Transferables.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/Transferables.h
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/core/v8/v8.gypi
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.h
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.h
[delete] https://crrev.com/fd7327ae9bfb6aa4c4dc7b43cf58701648542a26/third_party/WebKit/Source/bindings/modules/v8/TransferablesForModules.h
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/modules/v8/v8.gypi
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/templates/methods.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.cpp
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.h
[modify] https://crrev.com/bd6b09d886a2a9dcfe4f032df890a4916e35f77e/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.idl

Comment 12 by kbr@chromium.org, Apr 21 2016
Blockedon: 605642
Project Member Comment 13 by bugdroid1@chromium.org, Apr 27 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/df4f2a03dc45a80e08d31bf51dab796ed16f7c41

commit df4f2a03dc45a80e08d31bf51dab796ed16f7c41
Author: xidachen <xidachen@chromium.org>
Date: Wed Apr 27 20:41:28 2016

Reland of: Make OffscreenCanvas Transferable

The previous CL is here:
https://codereview.chromium.org/1862033002/

Difference:
The OffscreenCanvas class is moved from modules/ to core/, which makes
this CL much simplier than the previous one.

BUG= 563845 

Review-Url: https://codereview.chromium.org/1917733004
Cr-Commit-Position: refs/heads/master@{#390171}

[add] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions-expected.txt
[add] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html
[add] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-expected.txt
[add] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable.html
[add] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/LayoutTests/fast/canvas/resources/OffscreenCanvas-transferable.js
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/bindings/core/v8/SerializationTag.h
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/bindings/core/v8/Transferables.h
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvasModules.cpp
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvasModules.h
[modify] https://crrev.com/df4f2a03dc45a80e08d31bf51dab796ed16f7c41/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvasModules.idl

Sign in to add a comment