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

Issue 602391 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature

Blocking:
issue 593514



Sign in to add a comment

Implement OffscreenCanvas.getContext('webgl')

Project Member Reported by xidac...@chromium.org, Apr 11 2016

Issue description

'2d' is already supported, 'webgl' isn't yet.

We should make it work on window first, and then on worker.
 
Making this work on a worker thread is a little bit trick, see discussion here:
https://bugs.chromium.org/p/chromium/issues/detail?id=566273
Project Member

Comment 2 by bugdroid1@chromium.org, Apr 28 2016

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

commit a7270ac8f1b15170a6b28b5ebf02c65beaa6374e
Author: xidachen <xidachen@chromium.org>
Date: Thu Apr 28 14:05:56 2016

Implement OffscreenCanvas.getContext('webgl')

At this moment, getting webgl renderingcontext for offscreenCanvas
is not yet implemented and this CL implements that.

BUG= 602391 
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel

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

[rename] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-expected.txt
[rename] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker-expected.txt
[rename] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.html
[rename] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext.html
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContextFactory.h
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/ModulesInitializer.cpp
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvasModules.cpp
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvasModules.h
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvasModules.idl
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
[modify] https://crrev.com/a7270ac8f1b15170a6b28b5ebf02c65beaa6374e/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h

Project Member

Comment 3 by bugdroid1@chromium.org, May 9 2016

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

commit 2ec178e3f4f22a0806b5a13aff43a8d570e6c44c
Author: xidachen <xidachen@chromium.org>
Date: Mon May 09 21:18:17 2016

Implement offscreenCanvas.getContext('webgl') on a worker thread

Right now, offscreenCanvas.getContext('webgl') works on the main thread
only because it requires GpuChannelHost. In order to make it work on a
worker thread, we let the worker thread issue a waitable event, and
postTask() to main thread, ask main thread to create the contextProvider,
and signal back to the worker thread.

In this CL, we also Make BindToCurrentThread() optional in
createOffscreenGraphicsContext3DProvider.
Obtain a contextProvider on a worker thread involves these steps:
1. postTask to the main thread.
2. main thread calls createOffscreenGraphicsContext3DProvider, which
   implicitly calls BindToCurrentThread().
3. main thread signal that contextProvider is ready.
4. worker thread calls contextProvider->DetachFromThread(), and then
   contextProvider->BindToCurrentThread().

We can see that BindToCurrentThread() gets called twice. If we make
the BindToCurrentThread() call optional in createOffscreenGraphicsContext3DProvider,
then the worker thread will be the first one calling BindToCurrentThread(),
and there will be no need to call DetachFromThread().

Besides that, we made the the PersistentHeapHashSet and PersistentHeapHashMap
in the WebGLRenderingContextBase to be per-thread. The reason is
that we do not want the contexts created on the main thread and on
worker threads to share the same hashset or hashmap.

BUG= 602391 
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel

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

[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/components/test_runner/test_plugin.cc
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/content/renderer/renderer_blink_platform_impl.cc
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/content/renderer/renderer_blink_platform_impl.h
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/content/renderer/webgraphicscontext3d_provider_impl.cc
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/content/renderer/webgraphicscontext3d_provider_impl.h
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker-expected.txt
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.html
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.idl
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/public/platform/Platform.h
[modify] https://crrev.com/2ec178e3f4f22a0806b5a13aff43a8d570e6c44c/third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h

Status: Fixed (was: Started)

Sign in to add a comment