diff options
author | Justin Novosad <junov@chromium.org> | 2016-03-14 09:57:25 -0400 |
---|---|---|
committer | Justin Novosad <junov@chromium.org> | 2016-03-14 13:59:55 +0000 |
commit | 35482dfaa0627ca726c77b29f59822d115d4a069 (patch) | |
tree | 3ec8b3308d15df1d120a43d777163e4209f1fdf8 | |
parent | fed264dacda55dcbcddbf257895af0cedae11395 (diff) | |
download | chromium_src-35482dfaa0627ca726c77b29f59822d115d4a069.zip chromium_src-35482dfaa0627ca726c77b29f59822d115d4a069.tar.gz chromium_src-35482dfaa0627ca726c77b29f59822d115d4a069.tar.bz2 |
Disable canvas hibernation on MacOSX to fix content loss issue
Tab switching can cause canvases to go blank on Mac.
This is a temporary solution until a proper fix can be found.
BUG=588434
Review URL: https://codereview.chromium.org/1762783002
Cr-Commit-Position: refs/heads/master@{#380245}
(cherry picked from commit db1d1c9054628f3c0b2e46029447aa08635b13d0)
Review URL: https://codereview.chromium.org/1803633002 .
Cr-Commit-Position: refs/branch-heads/2661@{#212}
Cr-Branched-From: ef6f6ae5e4c96622286b563658d5cd62a6cf1197-refs/heads/master@{#378081}
3 files changed, 61 insertions, 1 deletions
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index 25df126..93fb8217 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp @@ -424,7 +424,7 @@ void Canvas2DLayerBridge::setIsHidden(bool hidden) return; m_isHidden = newHiddenValue; - if (m_surface && isHidden() && !m_destructionInProgress && !m_hibernationScheduled) { + if (CANVAS2D_HIBERNATION_ENABLED && m_surface && isHidden() && !m_destructionInProgress && !m_hibernationScheduled) { if (m_layer) m_layer->clearTexture(); m_logger->reportHibernationEvent(HibernationScheduled); diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h index d2dfc7e..1508238 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h @@ -53,6 +53,14 @@ class WebGraphicsContext3D; class WebGraphicsContext3DProvider; class SharedContextRateLimiter; +#if OS(MACOSX) +// Canvas hibernation is currently disabled on MacOS X due to a bug that causes content loss +// TODO: Find a better fix for crbug.com/588434 +#define CANVAS2D_HIBERNATION_ENABLED 0 +#else +#define CANVAS2D_HIBERNATION_ENABLED 1 +#endif + class PLATFORM_EXPORT Canvas2DLayerBridge : public WebExternalTextureLayerClient, public WebThread::TaskObserver, public RefCounted<Canvas2DLayerBridge> { WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge); public: diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp index 31dc743..f9758f4 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp @@ -460,7 +460,11 @@ public: virtual ~MockImageBuffer() { } }; +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, HibernationLifeCycle) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationLifeCycle) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -502,7 +506,11 @@ TEST_F(Canvas2DLayerBridgeTest, HibernationLifeCycle) ::testing::Mock::VerifyAndClearExpectations(&mainMock); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, HibernationReEntry) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationReEntry) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -550,7 +558,11 @@ TEST_F(Canvas2DLayerBridgeTest, HibernationReEntry) } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, HibernationLifeCycleWithDeferredRenderingDisabled) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationLifeCycleWithDeferredRenderingDisabled) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -618,7 +630,11 @@ void postAndWaitRenderingTask(const WebTraceLocation& location, WebThread* testT doneEvent->wait(); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, BackgroundRenderingWhileHibernating) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_BackgroundRenderingWhileHibernating) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -667,7 +683,11 @@ TEST_F(Canvas2DLayerBridgeTest, BackgroundRenderingWhileHibernating) ::testing::Mock::VerifyAndClearExpectations(&mainMock); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, BackgroundRenderingWhileHibernatingWithDeferredRenderingDisabled) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_BackgroundRenderingWhileHibernatingWithDeferredRenderingDisabled) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -724,7 +744,11 @@ TEST_F(Canvas2DLayerBridgeTest, BackgroundRenderingWhileHibernatingWithDeferredR postAndWaitDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, DisableDeferredRenderingWhileHibernating) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_DisableDeferredRenderingWhileHibernating) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -780,7 +804,11 @@ TEST_F(Canvas2DLayerBridgeTest, DisableDeferredRenderingWhileHibernating) postAndWaitDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, TeardownWhileHibernating) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_TeardownWhileHibernating) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -831,7 +859,11 @@ private: WaitableEvent* m_doneEvent; }; +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, TeardownWhileHibernationIsPending) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_TeardownWhileHibernationIsPending) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -869,7 +901,11 @@ TEST_F(Canvas2DLayerBridgeTest, TeardownWhileHibernationIsPending) ::testing::Mock::VerifyAndClearExpectations(&mainMock); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, HibernationAbortedDueToPendingTeardown) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToPendingTeardown) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -901,7 +937,11 @@ TEST_F(Canvas2DLayerBridgeTest, HibernationAbortedDueToPendingTeardown) ::testing::Mock::VerifyAndClearExpectations(&mainMock); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, HibernationAbortedDueToVisibilityChange) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToVisibilityChange) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -936,7 +976,11 @@ TEST_F(Canvas2DLayerBridgeTest, HibernationAbortedDueToVisibilityChange) ::testing::Mock::VerifyAndClearExpectations(&mainMock); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, HibernationAbortedDueToLostContext) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_HibernationAbortedDueToLostContext) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -969,7 +1013,11 @@ TEST_F(Canvas2DLayerBridgeTest, HibernationAbortedDueToLostContext) ::testing::Mock::VerifyAndClearExpectations(&mainMock); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxWhileHibernating) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_PrepareMailboxWhileHibernating) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); @@ -1004,7 +1052,11 @@ TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxWhileHibernating) postAndWaitDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); } +#if CANVAS2D_HIBERNATION_ENABLED TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxWhileBackgroundRendering) +#else +TEST_F(Canvas2DLayerBridgeTest, DISABLED_PrepareMailboxWhileBackgroundRendering) +#endif { MockCanvasContext mainMock; OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); |