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

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: Subtree => Subsequence 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..d71c91cd2df8c68ce3613ee1100fc63e409f6472
--- /dev/null
+++ b/Source/platform/graphics/paint/SubsequenceRecorder.cpp
@@ -0,0 +1,57 @@
+// 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)
+{
+ // The conditions of returning false is not complete for a specific client.
chrishtr 2015/08/26 23:34:23 Move to .h file, and suggest changing as described
Xianzhu 2015/08/26 23:42:36 Done.
+ // The client must check additional conditions before calling this function.
+
+ 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

Powered by Google App Engine
This is Rietveld 408576698