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

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

Issue 2368333003: Improve speed of 2D canvas hibernation unit tests (Closed)
Patch Set: Created 4 years, 3 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 2f76b3b0b98b5aa04c79a43eb49fea1286886678..ad2861119f4b13eb001d4226aac1ac809b192ce9 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -380,6 +380,11 @@ static void hibernateWrapper(WeakPtr<Canvas2DLayerBridge> bridge, double /*idleD
}
}
+static void hibernateWrapperForTesting(WeakPtr<Canvas2DLayerBridge> bridge)
+{
+ hibernateWrapper(bridge, 0);
+}
+
void Canvas2DLayerBridge::hibernate()
{
DCHECK(!isHibernating());
@@ -606,7 +611,11 @@ void Canvas2DLayerBridge::setIsHidden(bool hidden)
m_layer->clearTexture();
m_logger->reportHibernationEvent(HibernationScheduled);
m_hibernationScheduled = true;
- Platform::current()->currentThread()->scheduler()->postIdleTask(BLINK_FROM_HERE, WTF::bind(&hibernateWrapper, m_weakPtrFactory.createWeakPtr()));
+ if (m_dontUseIdleSchedulingForTesting) {
+ Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&hibernateWrapperForTesting, m_weakPtrFactory.createWeakPtr()));
+ } else {
+ Platform::current()->currentThread()->scheduler()->postIdleTask(BLINK_FROM_HERE, WTF::bind(&hibernateWrapper, m_weakPtrFactory.createWeakPtr()));
+ }
}
if (!isHidden() && m_softwareRenderingWhileHidden) {
flushRecordingOnly();

Powered by Google App Engine
This is Rietveld 408576698