summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Novosad <junov@chromium.org>2016-03-14 10:09:42 -0400
committerJustin Novosad <junov@chromium.org>2016-03-14 14:11:45 +0000
commiteff51d7f79425e6c3a4bc7b80f3c73da92b4494c (patch)
tree7ead16380805583ea67807bc1de496a3dd927715
parent9ff4553676ef51d666220bfad631263cd8fed6f8 (diff)
downloadchromium_src-eff51d7f79425e6c3a4bc7b80f3c73da92b4494c.zip
chromium_src-eff51d7f79425e6c3a4bc7b80f3c73da92b4494c.tar.gz
chromium_src-eff51d7f79425e6c3a4bc7b80f3c73da92b4494c.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/1801713002 . Cr-Commit-Position: refs/branch-heads/2623@{#619} Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907}
-rw-r--r--third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp2
-rw-r--r--third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h8
-rw-r--r--third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp48
3 files changed, 57 insertions, 1 deletions
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
index 223f8712..e2352ea 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -418,7 +418,7 @@ void Canvas2DLayerBridge::setIsHidden(bool hidden)
return;
m_isHidden = newHiddenValue;
- if (m_surface && isHidden() && !m_destructionInProgress) {
+ if (CANVAS2D_HIBERNATION_ENABLED && m_surface && isHidden() && !m_destructionInProgress) {
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 dc25f1d..ffbc762 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 3bf5794..3829560 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -455,7 +455,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"));
@@ -503,7 +507,11 @@ TEST_F(Canvas2DLayerBridgeTest, HibernationLifeCycle)
::testing::Mock::VerifyAndClearExpectations(&mainMock);
}
+#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"));
@@ -580,7 +588,11 @@ private:
WebWaitableEvent* m_doneEvent;
};
+#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"));
@@ -637,7 +649,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"));
@@ -702,7 +718,11 @@ TEST_F(Canvas2DLayerBridgeTest, BackgroundRenderingWhileHibernatingWithDeferredR
bridgeDestroyedEvent->wait();
}
+#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"));
@@ -764,7 +784,11 @@ TEST_F(Canvas2DLayerBridgeTest, DisableDeferredRenderingWhileHibernating)
bridgeDestroyedEvent->wait();
}
+#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"));
@@ -819,7 +843,11 @@ private:
WebWaitableEvent* 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"));
@@ -876,7 +904,11 @@ private:
Canvas2DLayerBridge* m_bridge;
};
+#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"));
@@ -912,7 +944,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"));
@@ -951,7 +987,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"));
@@ -988,7 +1028,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"));
@@ -1027,7 +1071,11 @@ TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxWhileHibernating)
bridgeDestroyedEvent->wait();
}
+#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"));