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

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

Issue 1313223002: Simplify subtree (now subsequence) caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
Index: Source/platform/graphics/paint/SubsequenceRecorder.cpp
diff --git a/Source/platform/graphics/paint/SubsequenceRecorder.cpp b/Source/platform/graphics/paint/SubsequenceRecorder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4f54dbff0cc2797c37d6c7e5174a82f4f75ef98c
--- /dev/null
+++ b/Source/platform/graphics/paint/SubsequenceRecorder.cpp
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "platform/graphics/paint/SubsequenceRecorder.h"
+
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/paint/CachedDisplayItem.h"
+#include "platform/graphics/paint/DisplayItemList.h"
+#include "platform/graphics/paint/SubsequenceDisplayItem.h"
+
+namespace blink {
+
+bool SubsequenceRecorder::useCachedSubsequenceIfPossible(GraphicsContext& context, const DisplayItemClientWrapper& client)
+{
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ return false;
+
+ ASSERT(context.displayItemList());
+
+ if (context.displayItemList()->displayItemConstructionIsDisabled() || RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled())
+ return false;
+
+ if (!context.displayItemList()->clientCacheIsValid(client.displayItemClient()))
+ return false;
+
+ context.displayItemList()->createAndAppend<CachedDisplayItem>(client, DisplayItem::CachedSubsequence);
+ return true;
+}
+
+SubsequenceRecorder::SubsequenceRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client)
+ : m_displayItemList(context.displayItemList())
+ , m_client(client)
+{
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ return;
+
+ ASSERT(m_displayItemList);
+ m_displayItemList->createAndAppend<BeginSubsequenceDisplayItem>(m_client);
+}
+
+SubsequenceRecorder::~SubsequenceRecorder()
+{
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ return;
+
+ // Don't remove no-op BeginSubsequence/EndSubsequence pairs because we need to
+ // match them later with CachedSubsequences.
+ m_displayItemList->createAndAppend<EndSubsequenceDisplayItem>(m_client);
+}
+
+} // namespace blink
« no previous file with comments | « Source/platform/graphics/paint/SubsequenceRecorder.h ('k') | Source/platform/graphics/paint/SubtreeDisplayItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698