Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Issue 2644653003: Make OffscreenCanvas animation in sync with its placeholder canvas's parent frame rate (Closed)

Created:
3 years, 11 months ago by xlai (Olivia)
Modified:
3 years, 10 months ago
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, blink-reviews-platform-graphics_chromium.org, dshwang, yzshen+watch_chromium.org, kinuko+watch, rwlbuis, darin (slow to review), krit, drott+blinkwatch_chromium.org, blink-reviews-html_chromium.org, jam, abarth-chromium, dglazkov+blink, Rik, darin-cc_chromium.org, blink-reviews, ajuma+watch_chromium.org, blink-reviews-api_chromium.org, blink-worker-reviews_chromium.org, mlamouri+watch-content_chromium.org, jbroman, pdr+graphicswatchlist_chromium.org, piman+watch_chromium.org, Stephen Chennney, ajuma+watch-canvas_chromium.org, Aaron Boodman, f(malita), danakj+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make OffscreenCanvas animation in sync with its placeholder canvas's parent frame rate This CL makes OffscreenCanvasFrameDispatcherImpl::OnBeginFrame get fired when the OffscreenCanvas's corresponding placeholder canvas's parent frame is starting a new frame. In this way, we make sure that OffscreenCanvas animation matches the frame rate of display, which is part of the spec requirement in OffscreenCanvas (https://wiki.whatwg.org/wiki/OffscreenCanvas.requestAnimationFrame). Implementation in this CL can be broadly seen as two parts: 1. Registration of OffscreenCanvas's frame sink id to the FrameSinkHierarchy of its parent frame's frame sink id. The parent frame sink id is obtained by plumbing into WebLayerTreeView from HTMLCanvasElement; it is then sent to OffscreenCanvasSurfaceImpl and cached there. When OffscreenCanvasCompositorFrameSink is created (together with the support_), we then register this parent-child hierarchy to SurfaceManager. 2. OffscreenCanvas signals that it needs BeginFrame when users invoke commit(). This allows OffscreenCanvas.beginFrame() to be triggered to either resolve an existing promise and doCommit on the last overdraw compositorFrame sent by the user in the same frame window. When a promise is resolved, OffscreenCanvas signals that it no longer needs BeginFrame, so as to avoid overhead from its parent frame. BUG=674744 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/2644653003 Cr-Commit-Position: refs/heads/master@{#446898} Committed: https://chromium.googlesource.com/chromium/src/+/d0df339711fb34c94decb02ac90e0d9fddc1e8d1

Patch Set 1 #

Patch Set 2 : safeguard #

Total comments: 33

Patch Set 3 : fix based on fsamuel's feedback #

Total comments: 17

Patch Set 4 : fix based on both reviewers #

Total comments: 8

Patch Set 5 : edit based on feedback #

Patch Set 6 : new test #

Total comments: 4

Patch Set 7 : No Mojo for frameless canvas #

Total comments: 1

Patch Set 8 : no new pixel test #

Patch Set 9 : rebase #

Total comments: 7

Patch Set 10 : fix unit test compilation error #

Patch Set 11 : change based on decheng feedback #

Patch Set 12 : remove nullity check #

Patch Set 13 : rebase #

Patch Set 14 : rebase again #

Unified diffs Side-by-side diffs Delta from patch set Stats (+310 lines, -108 lines) Patch
M content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +3 lines, -1 line 0 comments Download
M content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc View 1 2 3 3 chunks +12 lines, -0 lines 0 comments Download
M content/browser/renderer_host/offscreen_canvas_surface_factory_impl.h View 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/renderer_host/offscreen_canvas_surface_factory_impl.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M content/browser/renderer_host/offscreen_canvas_surface_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +10 lines, -2 lines 0 comments Download
M content/browser/renderer_host/offscreen_canvas_surface_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +7 lines, -3 lines 0 comments Download
M content/browser/renderer_host/offscreen_canvas_surface_manager.h View 1 2 3 1 chunk +13 lines, -4 lines 0 comments Download
M content/browser/renderer_host/offscreen_canvas_surface_manager.cc View 1 2 3 chunks +27 lines, -3 lines 0 comments Download
M content/browser/renderer_host/offscreen_canvas_surface_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +7 lines, -6 lines 0 comments Download
M content/renderer/gpu/render_widget_compositor.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/gpu/render_widget_compositor.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -0 lines 0 comments Download
M content/test/data/gpu/pixel_offscreenCanvas_2d_commit_main.html View 1 chunk +16 lines, -4 lines 0 comments Download
M content/test/data/gpu/pixel_offscreenCanvas_2d_commit_worker.html View 1 chunk +16 lines, -4 lines 0 comments Download
M content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html View 2 chunks +17 lines, -5 lines 0 comments Download
M content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html View 2 chunks +17 lines, -5 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-commit-frameless-doc.html View 1 2 3 4 5 6 1 chunk +53 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +14 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp View 1 2 3 2 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/page/ChromeClient.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h View 1 2 3 chunks +5 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +9 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcher.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 6 chunks +46 lines, -57 lines 0 comments Download
M third_party/WebKit/Source/web/ChromeClientImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/ChromeClientImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/public/platform/WebLayerTreeView.h View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 58 (34 generated)
xlai (Olivia)
Sending to fsamuel@ and junov@ first before reaching to other reviewers. fsamuel@: Could you take ...
3 years, 11 months ago (2017-01-18 20:15:47 UTC) #2
Fady Samuel
https://codereview.chromium.org/2644653003/diff/20001/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc File content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc (right): https://codereview.chromium.org/2644653003/diff/20001/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc#newcode33 content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc:33: OffscreenCanvasSurfaceManager::GetInstance()->RegisterFrameSinkToItsParent( Maybe move this to OffscreenCanvasCompositorFrameSinkProviderImpl::CreateCompositorFrameSink? The reason being ...
3 years, 11 months ago (2017-01-19 04:05:43 UTC) #3
xlai (Olivia)
All comments addressed. https://codereview.chromium.org/2644653003/diff/20001/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc File content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc (right): https://codereview.chromium.org/2644653003/diff/20001/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc#newcode33 content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc:33: OffscreenCanvasSurfaceManager::GetInstance()->RegisterFrameSinkToItsParent( On 2017/01/19 04:05:43, Fady Samuel ...
3 years, 11 months ago (2017-01-19 16:43:57 UTC) #5
Fady Samuel
lgtm + nits https://codereview.chromium.org/2644653003/diff/60001/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc File content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc (right): https://codereview.chromium.org/2644653003/diff/60001/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc#newcode52 content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc:52: frame_sink_id); I don't think this is ...
3 years, 11 months ago (2017-01-19 17:10:54 UTC) #6
Justin Novosad
lgtm for third_party/WebKit/Source/core/ and third_party/WebKit/Source/platform/ +nits https://codereview.chromium.org/2644653003/diff/60001/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp File third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp (right): https://codereview.chromium.org/2644653003/diff/60001/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp#newcode270 third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp:270: getOrCreateFrameDispatcher()->setNeedsBeginFrame(false); Kudos for ...
3 years, 11 months ago (2017-01-19 18:06:49 UTC) #7
xlai (Olivia)
https://codereview.chromium.org/2644653003/diff/60001/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc File content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc (right): https://codereview.chromium.org/2644653003/diff/60001/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc#newcode52 content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc:52: frame_sink_id); On 2017/01/19 17:10:53, Fady Samuel wrote: > I ...
3 years, 11 months ago (2017-01-19 19:14:35 UTC) #8
xlai (Olivia)
Sending to more reviewers. kbr@: Could you please review content/renderer/gpu and third_party/WebKit/Source/web? Basically, all these ...
3 years, 11 months ago (2017-01-19 19:43:49 UTC) #10
Ken Russell (switch to Gerrit)
lgtm for the parts I own. Nice work.
3 years, 11 months ago (2017-01-20 03:52:47 UTC) #11
dcheng
https://codereview.chromium.org/2644653003/diff/20001/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp File third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp (right): https://codereview.chromium.org/2644653003/diff/20001/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp#newcode72 third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp:72: if (layerTreeView) { On 2017/01/19 16:43:56, xlai (Olivia) wrote: ...
3 years, 11 months ago (2017-01-20 08:44:12 UTC) #12
xlai (Olivia)
https://codereview.chromium.org/2644653003/diff/20001/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp File third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp (right): https://codereview.chromium.org/2644653003/diff/20001/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp#newcode72 third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp:72: if (layerTreeView) { On 2017/01/20 08:44:12, dcheng wrote: > ...
3 years, 11 months ago (2017-01-20 16:36:22 UTC) #13
Justin Novosad
On 2017/01/20 16:36:22, xlai (Olivia) wrote: > https://codereview.chromium.org/2644653003/diff/20001/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp > File third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp > (right): > > ...
3 years, 11 months ago (2017-01-20 18:08:21 UTC) #14
xlai (Olivia)
new pixel test for frameless canvas is now added.
3 years, 11 months ago (2017-01-20 19:40:09 UTC) #16
Justin Novosad
On 2017/01/20 19:40:09, xlai (Olivia) wrote: > new pixel test for frameless canvas is now ...
3 years, 11 months ago (2017-01-20 21:07:53 UTC) #17
xlai (Olivia)
Gentle ping to dcheng@..
3 years, 11 months ago (2017-01-23 18:45:33 UTC) #18
dcheng
https://codereview.chromium.org/2644653003/diff/120001/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp File third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp (right): https://codereview.chromium.org/2644653003/diff/120001/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp#newcode1434 third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp:1434: layerTreeView = frame->host()->chromeClient().getWebLayerTreeView(); Sorry, one more dumb question: why ...
3 years, 11 months ago (2017-01-23 21:53:32 UTC) #19
xlai (Olivia)
https://codereview.chromium.org/2644653003/diff/120001/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp File third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp (right): https://codereview.chromium.org/2644653003/diff/120001/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp#newcode1434 third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp:1434: layerTreeView = frame->host()->chromeClient().getWebLayerTreeView(); On 2017/01/23 21:53:32, dcheng wrote: > ...
3 years, 11 months ago (2017-01-24 20:54:12 UTC) #21
dcheng
https://codereview.chromium.org/2644653003/diff/200001/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp File third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp (right): https://codereview.chromium.org/2644653003/diff/200001/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp#newcode1434 third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp:1434: layerTreeView = frame->host()->chromeClient().getWebLayerTreeView(); For OOPIF, I think we would ...
3 years, 11 months ago (2017-01-24 22:31:37 UTC) #28
xlai (Olivia)
https://codereview.chromium.org/2644653003/diff/200001/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp File third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp (right): https://codereview.chromium.org/2644653003/diff/200001/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp#newcode1434 third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp:1434: layerTreeView = frame->host()->chromeClient().getWebLayerTreeView(); On 2017/01/24 22:31:37, dcheng wrote: > ...
3 years, 11 months ago (2017-01-24 22:57:13 UTC) #29
xlai (Olivia)
https://codereview.chromium.org/2644653003/diff/200001/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp File third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp (right): https://codereview.chromium.org/2644653003/diff/200001/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp#newcode65 third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp:65: m_parentFrameSinkId(layerTreeView ? layerTreeView->getFrameSinkId() On 2017/01/24 22:57:12, xlai (Olivia) wrote: ...
3 years, 11 months ago (2017-01-24 23:15:40 UTC) #30
dcheng
LGTM (we discussed the null checks offline, and we believe it's probably not needed)
3 years, 11 months ago (2017-01-24 23:16:37 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2644653003/280001
3 years, 10 months ago (2017-01-27 22:25:07 UTC) #46
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/352546)
3 years, 10 months ago (2017-01-27 22:33:38 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2644653003/300001
3 years, 10 months ago (2017-01-28 03:20:11 UTC) #55
commit-bot: I haz the power
3 years, 10 months ago (2017-01-28 03:25:30 UTC) #58
Message was sent while issue was closed.
Committed patchset #14 (id:300001) as
https://chromium.googlesource.com/chromium/src/+/d0df339711fb34c94decb02ac90e...

Powered by Google App Engine
This is Rietveld 408576698