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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp

Issue 1812153002: Move DisplayItemList complex inline method implementations to .cpp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head. Created 4 years, 9 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 | « third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
index 173cf911e74522080a4cd1116709651488157799..9615d6d9b3b8371c699b3254c998fd24dce974f5 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
@@ -6,8 +6,44 @@
#include "platform/graphics/paint/PaintChunk.h"
+#ifndef NDEBUG
+#include "wtf/text/WTFString.h"
+#endif
+
namespace blink {
+DisplayItem& DisplayItemList::appendByMoving(DisplayItem& item, const IntRect& visualRect)
+{
+#ifndef NDEBUG
+ String originalDebugString = item.asDebugString();
+#endif
+ ASSERT(item.hasValidClient());
+ DisplayItem& result = ContiguousContainer::appendByMoving(item, item.derivedSize());
+ // ContiguousContainer::appendByMoving() calls an in-place constructor
+ // on item which replaces it with a tombstone/"dead display item" that
+ // can be safely destructed but should never be used.
+ ASSERT(!item.hasValidClient());
+#ifndef NDEBUG
+ // Save original debug string in the old item to help debugging.
+ item.setClientDebugString(originalDebugString);
+#endif
+ appendVisualRect(visualRect);
+ return result;
+}
+
+#if ENABLE(ASSERT)
+void DisplayItemList::assertDisplayItemClientsAreAlive() const
+{
+ for (auto& item : *this) {
+#ifdef NDEBUG
+ DCHECK(DisplayItemClient::isAlive(item.client())) << "Short-lived DisplayItemClient. See crbug.com/570030.";
+#else
+ DCHECK(DisplayItemClient::isAlive(item.client())) << "Short-lived DisplayItemClient: " << item.clientDebugString() << ". See crbug.com/570030.";
+#endif
+ }
+}
+#endif
+
void DisplayItemList::appendVisualRect(const IntRect& visualRect)
{
size_t itemIndex = m_visualRects.size();
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698