Implement OffscreenCanvasRenderingContext2D.commit()
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9d411770ed1fe13a31f038859cba062e5d7bf952 commit 9d411770ed1fe13a31f038859cba062e5d7bf952 Author: xlai <xlai@chromium.org> Date: Tue May 24 23:54:36 2016 Add CanvasSurfaceLayerBridge This is a preparatory patch for later works on adding a surface layer to canvas when it is transferred control to an OffscreenCanvas. The SolidColorLayer is just a stud here and will be replaced by SurfaceLayer later. BUG= 611796 Review-Url: https://codereview.chromium.org/1999143002 Cr-Commit-Position: refs/heads/master@{#395741} [modify] https://crrev.com/9d411770ed1fe13a31f038859cba062e5d7bf952/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp [modify] https://crrev.com/9d411770ed1fe13a31f038859cba062e5d7bf952/third_party/WebKit/Source/core/html/HTMLCanvasElement.h [modify] https://crrev.com/9d411770ed1fe13a31f038859cba062e5d7bf952/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp [modify] https://crrev.com/9d411770ed1fe13a31f038859cba062e5d7bf952/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp [modify] https://crrev.com/9d411770ed1fe13a31f038859cba062e5d7bf952/third_party/WebKit/Source/platform/blink_platform.gypi [add] https://crrev.com/9d411770ed1fe13a31f038859cba062e5d7bf952/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp [add] https://crrev.com/9d411770ed1fe13a31f038859cba062e5d7bf952/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e93a0d29e98d8770319072162eb420fd81758f6d commit e93a0d29e98d8770319072162eb420fd81758f6d Author: xlai <xlai@chromium.org> Date: Mon Jun 20 23:44:48 2016 Establish mojo service between Canvas (blink) and SurfaceManager (browser) This patch adds a new mojo message pipe between Canvas in blink and the Surface management on browser, to facilitate the out-of-process commit flow from OffscreenCanvas to browser. This patch only implements the first two IPC to ensure SurfaceLayer on renderer, SurfaceId/Surface on browser are created. The implementation can be seen in three parts: client, browser host, and mojo service interface. Some codes are added to an existing layout test to test if the whole workflow works. Client: CanvasSurfaceLayerBridge is HTMLCanvasElement's communicator with SurfaceLayer. It is created only when HTMLCanvasElement.transferControlToOffscreen() is invoked. It has an instance of CanvasSurfaceLayerBridgeClient, which is a virtual interface containing all mojo calls. To create a SurfaceLayer, it sends a sync msg "GetSurfaceId" to browser to retrieve a unique SurfaceId. Immediately after that, it sends an async msg "RequestSurfaceCreation" to request Surface getting created for this particular Id. After that, it creates a SurfaceLayer (with SatisfyCallback and RequireCallback) for HTMLCanvasElement and set the SurfaceId for the layer and registers it to the graphics layer. A unit test is added; it fakes the browser side and mocks the BridgeClient. Browser: OffscreenCanvasSurfaceServiceImpl sits on the other end of the mojo message pipe. It is created when all the mojo connections are registered in render_process_host. It responds to requests from CanvasSurfaceLayerBridge and do SurfaceId generation, SurfaceFactory and Surface creation accordingly. It is a client of SurfaceFactory. Mojo service interface: It is defined in offscreen_canvas_surface_service.mojom. It defines two structs: SurfaceId and SurfaceSequence, that correspondds to that in cc. I use typemaps to convert cc::SurfaceId and cc::SurfaceSequence to the corresponding mojo intermediate structs. BUG= 611796 , 563852 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review-Url: https://codereview.chromium.org/2036663003 Cr-Commit-Position: refs/heads/master@{#400838} [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/cc/ipc/BUILD.gn [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/cc/ipc/surface_id_struct_traits.h [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/cc/ipc/surface_sequence_struct_traits.h [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/content/browser/DEPS [add] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/content/browser/renderer_host/offscreen_canvas_surface_impl.cc [add] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/content/browser/renderer_host/offscreen_canvas_surface_impl.h [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/content/browser/renderer_host/render_process_host_impl.cc [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/content/content_browser.gypi [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen-expected.txt [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/core/html/HTMLCanvasElement.h [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.h [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/BUILD.gn [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/blink_platform.gyp [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/blink_platform.gypi [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h [add] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridgeClient.h [add] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridgeClientImpl.cpp [add] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridgeClientImpl.h [add] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridgeTest.cpp [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/public/BUILD.gn [modify] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/public/blink.gyp [add] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/public/platform/modules/offscreencanvas/OWNERS [add] https://crrev.com/e93a0d29e98d8770319072162eb420fd81758f6d/third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1193f1696086ae64d6226225d12e77c3c78a84a6 commit 1193f1696086ae64d6226225d12e77c3c78a84a6 Author: xlai <xlai@chromium.org> Date: Fri Jul 15 02:04:24 2016 Transfer components of SurfaceId in OffscreenCanvas OffscreenCanvas should keep the SurfaceId from its associated HTMLCanvasElement so that when it is transferred to worker thread, it can directly submit CompositorFrame to browser without going through main thread. This is a preparation step before submiting CompositorFrame to Surface from either main or worker thread. BUG= 611796 Review-Url: https://codereview.chromium.org/2143033005 Cr-Commit-Position: refs/heads/master@{#405673} [modify] https://crrev.com/1193f1696086ae64d6226225d12e77c3c78a84a6/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp [modify] https://crrev.com/1193f1696086ae64d6226225d12e77c3c78a84a6/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h [modify] https://crrev.com/1193f1696086ae64d6226225d12e77c3c78a84a6/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h [modify] https://crrev.com/1193f1696086ae64d6226225d12e77c3c78a84a6/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
It's actually the same issue.
Comment 1 by bugdroid1@chromium.org
, May 24 2016