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

Unified Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 1736333002: Fix a race condition in canvas hibernation when visibility is toggled repeatedly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
index 49a2d787ddd0905f4d6ca69cbd9aded38fa7b9a5..25df12691278e2dc1a0ef8e332c9130e38e93924 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -207,6 +207,9 @@ static void hibernateWrapper(WeakPtr<Canvas2DLayerBridge> bridge, double /*idleD
void Canvas2DLayerBridge::hibernate()
{
ASSERT(!isHibernating());
+ ASSERT(m_hibernationScheduled);
+
+ m_hibernationScheduled = false;
Stephen White 2016/02/26 20:16:04 For the future, it might be worth thinking about t
if (m_destructionInProgress) {
m_logger->reportHibernationEvent(HibernationAbortedDueToPendingDestruction);
@@ -421,10 +424,11 @@ void Canvas2DLayerBridge::setIsHidden(bool hidden)
return;
m_isHidden = newHiddenValue;
- if (m_surface && isHidden() && !m_destructionInProgress) {
+ if (m_surface && isHidden() && !m_destructionInProgress && !m_hibernationScheduled) {
if (m_layer)
m_layer->clearTexture();
m_logger->reportHibernationEvent(HibernationScheduled);
+ m_hibernationScheduled = true;
Platform::current()->currentThread()->scheduler()->postIdleTask(BLINK_FROM_HERE, WTF::bind<double>(&hibernateWrapper, m_weakPtrFactory.createWeakPtr()));
}
if (!isHidden() && m_softwareRenderingWhileHidden) {

Powered by Google App Engine
This is Rietveld 408576698