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

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

Issue 892293002: First version of new merge algorithm (not enabled yet) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove scope-related code (accidentally mixed in this CL) Created 5 years, 10 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/core/paint/SubtreeInfoRecorder.cpp
diff --git a/Source/core/paint/SubtreeInfoRecorder.cpp b/Source/core/paint/SubtreeInfoRecorder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6244424b16824a3e50f505f2f045ae74bd0bccad
--- /dev/null
+++ b/Source/core/paint/SubtreeInfoRecorder.cpp
@@ -0,0 +1,56 @@
+// 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 "core/paint/SubtreeInfoRecorder.h"
+
+#include "core/rendering/RenderObject.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/paint/DisplayItemList.h"
+#include "platform/graphics/paint/SubtreeDisplayItem.h"
+
+namespace blink {
+
+SubtreeInfoRecorder::SubtreeInfoRecorder(GraphicsContext* context, const RenderObject& renderer, PaintPhase paintPhase)
+ : m_displayItemList(context->displayItemList())
+ , m_renderer(renderer)
+ , m_paintPhase(paintPhase)
+ , m_begun(false)
+{
+ if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
+ return;
+
+ ASSERT(m_displayItemList);
+}
+
+SubtreeInfoRecorder::~SubtreeInfoRecorder()
+{
+ if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
+ return;
+
+ if (m_begun)
+ addDisplayItem(EndSubtreeDisplayItem::create(m_renderer.displayItemClient(), DisplayItem::paintPhaseToEndSubtreeType(m_paintPhase)));
+ else if (m_displayItemList->clientCacheIsValid(m_renderer.displayItemClient()))
+ addDisplayItem(SubtreeCachedDisplayItem::create(m_renderer.displayItemClient(), DisplayItem::paintPhaseToSubtreeCachedType(m_paintPhase)));
+}
+
+void SubtreeInfoRecorder::begin()
+{
+ if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
+ return;
+
+ addDisplayItem(BeginSubtreeDisplayItem::create(m_renderer.displayItemClient(), DisplayItem::paintPhaseToBeginSubtreeType(m_paintPhase)));
+ m_begun = true;
+}
+
+void SubtreeInfoRecorder::addDisplayItem(PassOwnPtr<DisplayItem> displayItem)
+{
+#ifndef NDEBUG
+ displayItem->setClientDebugString(String::format("renderer: \"%p %s\"", &m_renderer, m_renderer.debugName().utf8().data()));
+#endif
+ m_displayItemList->add(displayItem);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698