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

Issue 16032003: Fixing Canvas2DLayerBridge to handle lost graphics contexts (Closed)

Created:
7 years, 7 months ago by Justin Novosad
Modified:
7 years, 4 months ago
CC:
blink-reviews, eae+blinkwatch, danakj, Rik, Stephen Chennney, jeez, pdr.
Visibility:
Public.

Description

Fixing Canvas2DLayerBridge to handle lost graphics contexts This patch detects lost contexts and attempts to restore canvas layers to a usable state, whenever possible. If the layer can not be recovered All operation that draw to and read from the canvas are skipped. BUG=240881, 226928, 237799 R=senorblanco@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=154134

Patch Set 1 #

Total comments: 8

Patch Set 2 : Response to senorblanco feedback #

Total comments: 4

Patch Set 3 : Response to further feedback #

Patch Set 4 : Fixed linux compile error #

Patch Set 5 : Fixed unit tests #

Total comments: 3

Patch Set 6 : Added unit test #

Patch Set 7 : Added assertions on m_layer to verify that init was called #

Total comments: 5

Patch Set 8 : removed init, re-arranged constructor #

Total comments: 2

Patch Set 9 : Added Layout test and necessary content_shell API to test context loss #

Total comments: 1

Patch Set 10 : Changed Canvas2DLAyerBridge to never have a NULL context, resolved merge conflicts #

Patch Set 11 : minor edits #

Patch Set 12 : Fixing gpu_test Canvas2DAllowed #

Total comments: 2

Patch Set 13 : removed stale comment #

Patch Set 14 : resolved merge conflicts #

Patch Set 15 : Resolved merge #

Patch Set 16 : Resolve additional merge conflicts #

Patch Set 17 : Corrected merge resolution #

Patch Set 18 : assertion fix #

Patch Set 19 : Resolved merge with rate limiter CL #

Unified diffs Side-by-side diffs Delta from patch set Stats (+230 lines, -45 lines) Patch
A + LayoutTests/fast/canvas/canvas-lost-gpu-context.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -2 lines 0 comments Download
A + LayoutTests/fast/canvas/canvas-lost-gpu-context-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +6 lines, -3 lines 0 comments Download
A LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +62 lines, -0 lines 0 comments Download
A + LayoutTests/virtual/gpu/fast/canvas/canvas-lost-gpu-context-expected.txt View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -5 lines 0 comments Download
M Source/core/platform/graphics/Extensions3D.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +4 lines, -1 line 0 comments Download
M Source/core/platform/graphics/Extensions3D.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +5 lines, -0 lines 0 comments Download
M Source/core/platform/graphics/ImageBuffer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/platform/graphics/ImageBuffer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 9 chunks +29 lines, -19 lines 0 comments Download
M Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +5 lines, -4 lines 0 comments Download
M Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 8 chunks +81 lines, -10 lines 0 comments Download
M Source/core/platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +13 lines, -1 line 0 comments Download
M Source/core/testing/Internals.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +14 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.idl View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 51 (0 generated)
Justin Novosad
PTAL
7 years, 7 months ago (2013-05-24 17:36:15 UTC) #1
Justin Novosad
On 2013/05/24 17:36:15, junov wrote: > PTAL Cannot submit until skia r9276 rolls-in https://code.google.com/p/skia/source/detail?r=9276
7 years, 7 months ago (2013-05-24 17:37:53 UTC) #2
danakj
https://codereview.chromium.org/16032003/diff/1/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp File Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp (right): https://codereview.chromium.org/16032003/diff/1/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp#newcode186 Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp:186: if (!sharedContext || sharedContext->webContext()->isContextLost()) { Do you actually see ...
7 years, 7 months ago (2013-05-24 17:42:36 UTC) #3
Justin Novosad
On 2013/05/24 17:42:36, danakj wrote: > Do you actually see a way to have isContextLost() ...
7 years, 7 months ago (2013-05-24 17:49:39 UTC) #4
Stephen White
https://codereview.chromium.org/16032003/diff/1/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp File Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp (right): https://codereview.chromium.org/16032003/diff/1/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp#newcode195 Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp:195: // Old context was lost and sharedContext has recoverred. ...
7 years, 7 months ago (2013-05-24 17:51:01 UTC) #5
danakj
On Fri, May 24, 2013 at 1:49 PM, <junov@chromium.org> wrote: > On 2013/05/24 17:42:36, danakj ...
7 years, 7 months ago (2013-05-24 18:02:46 UTC) #6
Justin Novosad
Oops, I forgot to mention: New Patch.
7 years, 6 months ago (2013-05-27 23:41:10 UTC) #7
Stephen White
https://codereview.chromium.org/16032003/diff/7002/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp File Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp (right): https://codereview.chromium.org/16032003/diff/7002/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp#newcode74 Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp:74: // Factory overload used for unit testing Nit: this ...
7 years, 6 months ago (2013-05-28 14:23:10 UTC) #8
Stephen White
LGTM as-is, or you can fix the nits (your call).
7 years, 6 months ago (2013-05-28 14:23:41 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/junov@chromium.org/16032003/7002
7 years, 6 months ago (2013-05-28 14:55:07 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/junov@chromium.org/16032003/18001
7 years, 6 months ago (2013-05-28 15:02:11 UTC) #11
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 6 months ago (2013-05-28 15:17:35 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/junov@chromium.org/16032003/28001
7 years, 6 months ago (2013-05-28 15:24:40 UTC) #13
commit-bot: I haz the power
Retried try job too often on linux_layout_rel for step(s) webkit_tests, webkit_unit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_layout_rel&number=10508
7 years, 6 months ago (2013-05-28 15:43:58 UTC) #14
Justin Novosad
On 2013/05/28 15:43:58, I haz the power (commit-bot) wrote: Requesting new review. Patch Set 5 ...
7 years, 6 months ago (2013-05-28 17:37:21 UTC) #15
Stephen White
https://codereview.chromium.org/16032003/diff/38001/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp File Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp (right): https://codereview.chromium.org/16032003/diff/38001/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp#newcode68 Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp:68: virtual bool isValid() OVERRIDE Now that we have a ...
7 years, 6 months ago (2013-05-28 18:05:43 UTC) #16
Justin Novosad
> https://codereview.chromium.org/16032003/diff/38001/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp#newcode70 > Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp:70: > layerBridge->init(opacityMode, threading); > You're gonna hate me, but I liked ...
7 years, 6 months ago (2013-05-29 20:55:18 UTC) #17
Justin Novosad
Patch. Added unit test. sprinkled ASSERT(m_layer) in a few places to verify that Canvas2DLayerBridge::init was ...
7 years, 6 months ago (2013-05-29 21:11:21 UTC) #18
Justin Novosad
Review ping.
7 years, 6 months ago (2013-05-31 14:43:58 UTC) #19
Stephen White
https://codereview.chromium.org/16032003/diff/47001/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp File Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp (right): https://codereview.chromium.org/16032003/diff/47001/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp#newcode121 Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp:121: void contextLostTest() Thanks for the new test! https://codereview.chromium.org/16032003/diff/47001/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp#newcode124 Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp:124: ...
7 years, 6 months ago (2013-05-31 15:06:18 UTC) #20
Justin Novosad
All done. New patch.
7 years, 6 months ago (2013-05-31 16:17:46 UTC) #21
Stephen White
LGTM https://codereview.chromium.org/16032003/diff/57001/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp File Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp (right): https://codereview.chromium.org/16032003/diff/57001/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp#newcode123 Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp:123: // This simulates what happens when the shared ...
7 years, 6 months ago (2013-05-31 17:13:33 UTC) #22
Justin Novosad
Thx. Looks like I am missing an OWNER for the unit tests. +jamesr
7 years, 6 months ago (2013-05-31 18:07:56 UTC) #23
jamesr
On 2013/05/31 18:07:56, junov wrote: > Thx. > > Looks like I am missing an ...
7 years, 6 months ago (2013-05-31 18:13:44 UTC) #24
jamesr
Are there any tests (unit or otherwise) that exercise the codepath when a recovery at ...
7 years, 6 months ago (2013-05-31 18:15:45 UTC) #25
Justin Novosad
On 2013/05/31 18:15:45, jamesr wrote: > Are there any tests (unit or otherwise) that exercise ...
7 years, 6 months ago (2013-05-31 18:45:52 UTC) #26
jamesr
On 2013/05/31 18:45:52, junov wrote: > On 2013/05/31 18:15:45, jamesr wrote: > > Are there ...
7 years, 6 months ago (2013-05-31 19:28:48 UTC) #27
Justin Novosad
Patch! Added layout test with internal API method to trigger a context loss from JS
7 years, 6 months ago (2013-06-18 17:24:17 UTC) #28
Stephen White
LGTM, but leaving for James. https://codereview.chromium.org/16032003/diff/66001/LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js File LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js (right): https://codereview.chromium.org/16032003/diff/66001/LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js#newcode10 LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js:10: window.internals.loseSharedGraphicsContext3D(); I wonder if ...
7 years, 6 months ago (2013-06-18 18:06:57 UTC) #29
jamesr
On 2013/06/18 18:06:57, Stephen White wrote: > LGTM, but leaving for James. > What in ...
7 years, 6 months ago (2013-06-19 18:06:24 UTC) #30
Stephen White
On 2013/06/19 18:06:24, jamesr wrote: > On 2013/06/18 18:06:57, Stephen White wrote: > > LGTM, ...
7 years, 6 months ago (2013-06-19 18:16:45 UTC) #31
jamesr
Ah, got it. I don't see any tests covering what happens when the canvas is ...
7 years, 6 months ago (2013-06-19 18:22:47 UTC) #32
Justin Novosad
On 2013/06/19 18:22:47, jamesr wrote: > Ah, got it. I don't see any tests covering ...
7 years, 6 months ago (2013-06-19 18:32:14 UTC) #33
jamesr
On 2013/06/19 18:32:14, junov wrote: > On 2013/06/19 18:22:47, jamesr wrote: > > Ah, got ...
7 years, 6 months ago (2013-06-19 18:34:01 UTC) #34
Justin Novosad
On 2013/06/19 18:34:01, jamesr wrote: > On 2013/06/19 18:32:14, junov wrote: > > On 2013/06/19 ...
7 years, 6 months ago (2013-06-19 20:27:08 UTC) #35
Justin Novosad
New Patch. Got the test working properly. Will launch try jobs after this lands: https://codereview.chromium.org/17176027/
7 years, 5 months ago (2013-06-26 21:51:42 UTC) #36
Justin Novosad
New Patch: Test fix: restored name of Canvas2DLayerBridgeCreation trace event, which was tracked by gpu_test ...
7 years, 5 months ago (2013-06-27 13:58:52 UTC) #37
Justin Novosad
On 2013/06/27 13:58:52, junov wrote: Review Ping.
7 years, 5 months ago (2013-06-28 14:44:57 UTC) #38
Justin Novosad
On 2013/06/28 14:44:57, junov wrote: > On 2013/06/27 13:58:52, junov wrote: > Review Ping. re-ping
7 years, 5 months ago (2013-07-04 15:19:02 UTC) #39
Stephen White
https://codereview.chromium.org/16032003/diff/96001/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h File Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h (right): https://codereview.chromium.org/16032003/diff/96001/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h#newcode91 Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h:91: // Special constructor only used for unit testing Nit: ...
7 years, 5 months ago (2013-07-04 16:11:55 UTC) #40
Justin Novosad
https://codereview.chromium.org/16032003/diff/96001/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h File Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h (right): https://codereview.chromium.org/16032003/diff/96001/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h#newcode91 Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h:91: // Special constructor only used for unit testing On ...
7 years, 5 months ago (2013-07-04 17:34:03 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/junov@chromium.org/16032003/5629499534213120
7 years, 5 months ago (2013-07-11 20:01:58 UTC) #42
commit-bot: I haz the power
Failed to apply patch for Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
7 years, 5 months ago (2013-07-11 20:02:05 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/junov@chromium.org/16032003/125001
7 years, 5 months ago (2013-07-12 17:00:24 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/junov@chromium.org/16032003/125002
7 years, 5 months ago (2013-07-12 17:21:50 UTC) #45
commit-bot: I haz the power
Retried try job too often on linux_layout_rel for step(s) webkit_python_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_layout_rel&number=16555
7 years, 5 months ago (2013-07-12 18:03:06 UTC) #46
Justin Novosad
Committed patchset #17 manually as r154134 (presubmit successful).
7 years, 5 months ago (2013-07-12 18:27:00 UTC) #47
eseidel
I think this caused 12 canvas tests to crash. http://test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=virtual%2Fgpu%2Ffast%2Fcanvas%2Fsvg-taint.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Fresize-while-save-active.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Fcanvas-lineDash-invalid.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Fcanvas-lost-gpu-context.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Fcanvas-transform-nan.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Fshadow-offset-2.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2FdrawImageFromRect_withToDataURLAsSource.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Finvalid-set-font-crash.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Fcanvas-scale-fillRect-shadow.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Fcanvas-copyPixels.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2FgetPutImageDataPairTest.html%2Cvirtual%2Fgpu%2Ffast%2Fcanvas%2Fcanvas-webkitLineDash.html
7 years, 5 months ago (2013-07-12 21:53:21 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/junov@chromium.org/16032003/151001
7 years, 4 months ago (2013-07-26 13:56:19 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/junov@chromium.org/16032003/151001
7 years, 4 months ago (2013-07-26 15:49:10 UTC) #50
commit-bot: I haz the power
7 years, 4 months ago (2013-07-26 15:49:14 UTC) #51
Failed to apply patch for LayoutTests/fast/canvas/canvas-lost-gpu-context.html:
File exist but was about to be overwriten
Patch:   NR 
LayoutTests/fast/backgrounds/script-tests/TEMPLATE.html->LayoutTests/fast/canvas/canvas-lost-gpu-context.html
Index: LayoutTests/fast/canvas/canvas-lost-gpu-context.html
diff --git a/LayoutTests/fast/backgrounds/script-tests/TEMPLATE.html
b/LayoutTests/fast/canvas/canvas-lost-gpu-context.html
similarity index 70%
copy from LayoutTests/fast/backgrounds/script-tests/TEMPLATE.html
copy to LayoutTests/fast/canvas/canvas-lost-gpu-context.html
index
fd31b933c78f47a87c0cbfcca4eeb09ac9c5dfd1..81d007a7c6aff07470ff34713e328e74b43759b8
100644
--- a/LayoutTests/fast/backgrounds/script-tests/TEMPLATE.html
+++ b/LayoutTests/fast/canvas/canvas-lost-gpu-context.html
@@ -1,10 +1,9 @@
-<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 </head>
 <body>
-<script src="YOUR_JS_FILE_HERE"></script>
+<script src="script-tests/canvas-lost-gpu-context.js"></script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>

Powered by Google App Engine
This is Rietveld 408576698