Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Starred by 3 users
Status: Fixed
Owner:
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature

Blocking:
issue 563816



Sign in to add a comment
OffscreenCanvas resizing
Project Member Reported by xlai@chromium.org, Nov 4 2016 Back to list
canvas style resizing happens whenever the resolution changes or users change window size. Based on the latest spec of OffscreenCanvas, resizing on an html canvas that has been transferred to Offscreen should
be allowed.
 
Comment 1 by junov@chromium.org, Nov 16 2016
@xlai: I would like do just a starter CL that takes care of the script-observable aspects of resizing.  Leaving the compositor update parts to you since you already have a design in progress.  Okay?
Comment 2 by xlai@chromium.org, Nov 16 2016
@junov: sure go ahead! 
Project Member Comment 3 by bugdroid1@chromium.org, Nov 17 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7

commit 09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7
Author: junov <junov@chromium.org>
Date: Thu Nov 17 15:34:29 2016

Make OffscreenCanvas resizeable

This change implements all the script observable aspects of changing
the size of an OffscreenCanvas object.  What is missing after this
change is to correctly handle the compositing layer updates for the
commit() flow.

BUG= 662498 

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

[add] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-resize.html
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.idl
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.h
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.h
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.cpp
[modify] https://crrev.com/09cffb4f307ead2a20776a6e6b0d9cc1ca3e5ff7/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h

Comment 4 by junov@chromium.org, Nov 17 2016
Issue not completely fixed with previous patch: still need to take care of compositor update.
Project Member Comment 5 by bugdroid1@chromium.org, Nov 17 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/92e403ca88572c004290ab15450ce3f6b030cbbd

commit 92e403ca88572c004290ab15450ce3f6b030cbbd
Author: xlai <xlai@chromium.org>
Date: Thu Nov 17 19:25:05 2016

Create manager to track OffscreenCanvasSurfaceImpl instances

OffscreenCanvasSurfaceManager is a singleton in browser UI thread to keep track
of OffscreenCanvasSurfaceImpl instances (which connects to renderer/main thread).
Each instance corresponds to one single pair of html canvas
and its transferred OffscreenCanvas in renderer process and is therefore
identified by a unique FrameSinkId.

The manager is lazily created. It is useful in two cases:
(1) managing the situation of multiple html canvases that have transferred
to offscreen.
(2) allowing the OffscreenCanvasCompositorFrameSink instance (which connects to
 OffscreenCanvas on renderer/worker) to connect to its counterpart
OffscreenCanvasSurfaceImpl; this is to facilitate OffscreenCanvas resizing workflow
 implementation in next CLs.

BUG= 661605 , 662498 

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

[modify] https://crrev.com/92e403ca88572c004290ab15450ce3f6b030cbbd/content/browser/BUILD.gn
[modify] https://crrev.com/92e403ca88572c004290ab15450ce3f6b030cbbd/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
[modify] https://crrev.com/92e403ca88572c004290ab15450ce3f6b030cbbd/content/browser/renderer_host/offscreen_canvas_surface_impl.h
[add] https://crrev.com/92e403ca88572c004290ab15450ce3f6b030cbbd/content/browser/renderer_host/offscreen_canvas_surface_manager.cc
[add] https://crrev.com/92e403ca88572c004290ab15450ce3f6b030cbbd/content/browser/renderer_host/offscreen_canvas_surface_manager.h
[add] https://crrev.com/92e403ca88572c004290ab15450ce3f6b030cbbd/content/browser/renderer_host/offscreen_canvas_surface_manager_unittest.cc
[modify] https://crrev.com/92e403ca88572c004290ab15450ce3f6b030cbbd/content/test/BUILD.gn

Project Member Comment 6 by bugdroid1@chromium.org, Nov 18 2016
Project Member Comment 8 by bugdroid1@chromium.org, Dec 17 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/05aa05390801f402c336ce2156014d7ef055e9ef

commit 05aa05390801f402c336ce2156014d7ef055e9ef
Author: xlai <xlai@chromium.org>
Date: Sat Dec 17 22:56:36 2016

Revamp OffscreenCanvas commit flow

This patch aims to simplify the existing work flow of OffscreenCanvas commit()
and help OffscreenCanvas transition to the new Display Compositor architecture.
This facilitates the next step of adding resizing functionality of
OffscreenCanvas.

Major changes:
1. OffscreenCanvas now use SurfaceIdAllocator in the renderer/worker, instead
of being in the browser. This is consistent with the new display compositor
architecture.
2. SurfaceLayer for HTMLCanvasElement is only created when Surface is created
in the browser; before that, a dummy SolidColorLayer is put as a placeholder.
3. CanvasSurfaceLayerBridge becomes the client of OffscreenCanvasSurfaceImpl,
so that it can receive IPC messages from browser.
4. FrameSinkId is now generated in renderer/main by CanvasSurfaceLayerBridge,
which remains unchanged throughout the lifecycle of canvas; LocalFrameId is
generated in renderer/worker by OffscreenCanvasFrameDispatcher. At this time it
is only generated once, but will be generated repeatedly when resizing
functionality is added in the future patches.

What is being simplified:
1. Sync IPC GetSurfaceId is removed, reducing overhead in HTMLCanvasElement.
transferControlToOffscreen() API call.
2. When OffscreenCanvas is transferred from main thread to worker thread, there
are now only 2 integers that need to be copied, which constitute the
FrameSinkId. Before this, there were 5 integers that need to be copied. As a
result, there are a lot less attributes that need to be kept by OffscreenCanvas
and CanvasSurfaceLayerBridge.

TBR=avi@chromium.org
BUG= 664547 ,  619138 ,  662498 
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

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

[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/BUILD.gn
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.h
[add] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.cc
[add] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.h
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_surface_impl.h
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_surface_manager.cc
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_surface_manager.h
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/offscreen_canvas_surface_manager_unittest.cc
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/browser/renderer_host/render_process_host_impl.cc
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/content/public/app/mojo/content_browser_manifest.json
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/platform/BUILD.gn
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h
[delete] https://crrev.com/facf9c3631846243635ca6c98805bb443ad982ca/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridgeTest.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/public/blink_typemaps.gni
[modify] https://crrev.com/05aa05390801f402c336ce2156014d7ef055e9ef/third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom

Comment 9 by xlai@chromium.org, Dec 19 2016
Status: Started
Started coding the compositing layer update on resizing.
Project Member Comment 10 by bugdroid1@chromium.org, Dec 21 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/cfc7fa46621dc8a79511c60cb8cb5bfb3e412031

commit cfc7fa46621dc8a79511c60cb8cb5bfb3e412031
Author: xlai <xlai@chromium.org>
Date: Wed Dec 21 18:08:35 2016

Make OffscreenCanvas resizable

When OffscreenCanvas's width or height is changed, we reshape the
OffscreenCanvasFrameDispatcher's size and mark
m_changeSizeForNextCommit as true. In the next incoming commit(),
OffscreenCanvasFrameDispatcher picks up the new size and generate
new LocalFrameId. On browser side, Surface will be re-created once
a different LocalFrameId is received (all is handled in
CompositorFrameSinkSupport), prompting OffscreenCanvasSurfaceImpl
to send OnSurfaceCreated message back to CanvasSurfaceLayerBridge,
which will then change the SurfaceInfo in the existing SurfaceLayer.

BUG= 662498 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel

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

[add] https://crrev.com/cfc7fa46621dc8a79511c60cb8cb5bfb3e412031/content/test/data/gpu/pixel_offscreenCanvas_2d_resize_on_worker.html
[add] https://crrev.com/cfc7fa46621dc8a79511c60cb8cb5bfb3e412031/content/test/data/gpu/pixel_offscreenCanvas_webgl_resize_on_worker.html
[modify] https://crrev.com/cfc7fa46621dc8a79511c60cb8cb5bfb3e412031/content/test/gpu/gpu_tests/pixel_expectations.py
[modify] https://crrev.com/cfc7fa46621dc8a79511c60cb8cb5bfb3e412031/content/test/gpu/gpu_tests/pixel_test_pages.py
[modify] https://crrev.com/cfc7fa46621dc8a79511c60cb8cb5bfb3e412031/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
[modify] https://crrev.com/cfc7fa46621dc8a79511c60cb8cb5bfb3e412031/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
[modify] https://crrev.com/cfc7fa46621dc8a79511c60cb8cb5bfb3e412031/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h

Project Member Comment 11 by bugdroid1@chromium.org, Dec 22 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ee65abacb0a72861fe7ffb710cb492d43e603c4c

commit ee65abacb0a72861fe7ffb710cb492d43e603c4c
Author: xlai <xlai@chromium.org>
Date: Thu Dec 22 19:06:43 2016

Remove failed entries in GPU pixel tests

TBR=kbr@chromium.org
BUG= 662498 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel

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

[modify] https://crrev.com/ee65abacb0a72861fe7ffb710cb492d43e603c4c/content/test/gpu/gpu_tests/pixel_expectations.py

Comment 12 by xlai@chromium.org, Jan 1 2017
Status: Fixed
Sign in to add a comment