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

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

Issue 2637553002: Stop unnecessary flushing in Canvas2DLayerBridge (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5ad87f841357bda2150a4ddf0fa980b627260f29..0efabea5065304afbc0f849a5302d3ac50b8cf40 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -785,19 +785,24 @@ void Canvas2DLayerBridge::flushRecordingOnly() {
}
void Canvas2DLayerBridge::flush() {
- if (!getOrCreateSurface())
+ if (!m_didDrawSinceLastFlush)
xlai (Olivia) 2017/01/16 16:58:19 I have a second thought about this CL: how about w
return;
TRACE_EVENT0("cc", "Canvas2DLayerBridge::flush");
+ if (!getOrCreateSurface())
+ return;
flushRecordingOnly();
getOrCreateSurface()->getCanvas()->flush();
+ m_didDrawSinceLastFlush = false;
}
void Canvas2DLayerBridge::flushGpu() {
- TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushGpu");
flush();
gpu::gles2::GLES2Interface* gl = contextGL();
- if (isAccelerated() && gl)
+ if (isAccelerated() && gl && m_didDrawSinceLastGpuFlush) {
+ TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushGpu");
gl->Flush();
+ m_didDrawSinceLastGpuFlush = false;
+ }
}
gpu::gles2::GLES2Interface* Canvas2DLayerBridge::contextGL() {
@@ -1053,6 +1058,8 @@ void Canvas2DLayerBridge::didDraw(const FloatRect& rect) {
Platform::current()->currentThread()->addTaskObserver(this);
m_isRegisteredTaskObserver = true;
}
+ m_didDrawSinceLastFlush = true;
+ m_didDrawSinceLastGpuFlush = true;
}
void Canvas2DLayerBridge::prepareSurfaceForPaintingIfNeeded() {
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698