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

Unified Diff: Source/platform/graphics/paint/DrawingRecorder.cpp

Issue 799563002: Use DrawingRecorder::canUseCachedDrawing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years 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 | « Source/core/rendering/RenderBlockFlow.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/paint/DrawingRecorder.cpp
diff --git a/Source/platform/graphics/paint/DrawingRecorder.cpp b/Source/platform/graphics/paint/DrawingRecorder.cpp
index 5980def66b7d3acbef2747f5ab227ac62b713263..81bdef4c78d1695e12f6bd2577ba64c11e9f4c11 100644
--- a/Source/platform/graphics/paint/DrawingRecorder.cpp
+++ b/Source/platform/graphics/paint/DrawingRecorder.cpp
@@ -35,9 +35,13 @@ DrawingRecorder::DrawingRecorder(GraphicsContext* context, const DisplayItemClie
#endif
m_canUseCachedDrawing = context->displayItemList()->clientCacheIsValid(displayItemClient);
- // FIXME: beginRecording only if !m_canUseCachedDrawing or ENABLE(ASSERT)
- // after all painters call canUseCachedDrawing().
+#if ENABLE(ASSERT)
+ // Enable recording to check if any painter is still doing unnecessary painting when we can use cache.
m_context->beginRecording(bounds);
+#else
+ if (!m_canUseCachedDrawing)
+ m_context->beginRecording(bounds);
+#endif
}
DrawingRecorder::~DrawingRecorder()
@@ -52,10 +56,10 @@ DrawingRecorder::~DrawingRecorder()
OwnPtr<DisplayItem> displayItem;
if (m_canUseCachedDrawing) {
- // FIXME: endRecording only if ENABLE(ASSERT), and enable the following ASSERT
- // after all painters call canUseCachedDrawing().
+#if ENABLE(ASSERT)
RefPtr<const SkPicture> picture = m_context->endRecording();
- // ASSERT(!picture || !picture->approximateOpCount());
+ ASSERT(!picture || !picture->approximateOpCount());
+#endif
displayItem = CachedDisplayItem::create(m_displayItemClient, m_displayItemType);
} else {
RefPtr<const SkPicture> picture = m_context->endRecording();
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698