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

Unified Diff: Source/core/paint/ScopeRecorder.cpp

Issue 1144203004: Allow certain SP recorder classes to defer their "begin" operation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | « Source/core/paint/ScopeRecorder.h ('k') | Source/core/paint/ScrollRecorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/ScopeRecorder.cpp
diff --git a/Source/core/paint/ScopeRecorder.cpp b/Source/core/paint/ScopeRecorder.cpp
index 5b96bc7f0bd87c0764990d18e1784bd472e8c419..8b9eef1d5da98e1a1063f5087f46d8a31ec021f9 100644
--- a/Source/core/paint/ScopeRecorder.cpp
+++ b/Source/core/paint/ScopeRecorder.cpp
@@ -12,23 +12,35 @@
namespace blink {
-ScopeRecorder::ScopeRecorder(GraphicsContext& context, const LayoutObject& object)
+ScopeRecorder::ScopeRecorder(GraphicsContext& context, const LayoutObject& object, ShouldBegin shouldBegin)
: m_displayItemList(context.displayItemList())
, m_object(object)
+ , m_engaged(false)
{
+ if (shouldBegin == BeginOnConstruction)
+ begin();
+}
+
+ScopeRecorder::~ScopeRecorder()
+{
+ if (!m_engaged)
+ return;
if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
return;
- ASSERT(m_displayItemList);
- m_displayItemList->beginScope(m_object.displayItemClient());
+ m_displayItemList->endScope(m_object.displayItemClient());
}
-ScopeRecorder::~ScopeRecorder()
+void ScopeRecorder::begin()
{
+ ASSERT(!m_engaged);
+ m_engaged = true;
+
if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
return;
- m_displayItemList->endScope(m_object.displayItemClient());
+ ASSERT(m_displayItemList);
+ m_displayItemList->beginScope(m_object.displayItemClient());
}
} // namespace blink
« no previous file with comments | « Source/core/paint/ScopeRecorder.h ('k') | Source/core/paint/ScrollRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698