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

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

Issue 1282713003: Painter side preparation for subtree caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: needsSubtreeRecorder Created 5 years, 4 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/SubtreeRecorder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/SubtreeRecorder.cpp
diff --git a/Source/core/paint/SubtreeRecorder.cpp b/Source/core/paint/SubtreeRecorder.cpp
index d748e39196b2ec755fa19617c2445772bff6523f..f9ec65e5f3801cbec096cb99a4a342285d2b6947 100644
--- a/Source/core/paint/SubtreeRecorder.cpp
+++ b/Source/core/paint/SubtreeRecorder.cpp
@@ -17,35 +17,42 @@ SubtreeRecorder::SubtreeRecorder(GraphicsContext& context, const LayoutObject& s
: m_displayItemList(context.displayItemList())
, m_subtreeRoot(subtreeRoot)
, m_paintPhase(paintPhase)
- , m_begun(false)
+ , m_canUseCache(false)
+#if ENABLE(ASSERT)
+ , m_checkedCanUseCache(false)
+#endif
{
- if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
return;
ASSERT(m_displayItemList);
+
+ // TODO(wangxianzhu): Implement subtree caching.
+
+ if (!m_canUseCache)
+ m_displayItemList->createAndAppend<BeginSubtreeDisplayItem>(m_subtreeRoot, DisplayItem::paintPhaseToBeginSubtreeType(paintPhase));
}
SubtreeRecorder::~SubtreeRecorder()
{
- if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
return;
- if (m_begun) {
- if (m_displayItemList->lastDisplayItemIsNoopBegin())
- m_displayItemList->removeLastDisplayItem();
- else
- m_displayItemList->createAndAppend<EndSubtreeDisplayItem>(m_subtreeRoot, DisplayItem::paintPhaseToEndSubtreeType(m_paintPhase));
- }
+ ASSERT(m_checkedCanUseCache);
+ if (m_canUseCache)
+ m_displayItemList->createAndAppend<SubtreeCachedDisplayItem>(m_subtreeRoot, DisplayItem::paintPhaseToSubtreeCachedType(m_paintPhase));
+ else if (m_displayItemList->lastDisplayItemIsNoopBegin())
+ m_displayItemList->removeLastDisplayItem();
+ else
+ m_displayItemList->createAndAppend<EndSubtreeDisplayItem>(m_subtreeRoot, DisplayItem::paintPhaseToEndSubtreeType(m_paintPhase));
}
-void SubtreeRecorder::begin()
+bool SubtreeRecorder::canUseCache() const
{
- if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
- return;
- if (m_displayItemList->displayItemConstructionIsDisabled())
- return;
- m_displayItemList->createAndAppend<BeginSubtreeDisplayItem>(m_subtreeRoot, DisplayItem::paintPhaseToBeginSubtreeType(m_paintPhase));
- m_begun = true;
+#if ENABLE(ASSERT)
+ m_checkedCanUseCache = true;
+#endif
+ return m_canUseCache;
}
} // namespace blink
« no previous file with comments | « Source/core/paint/SubtreeRecorder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698