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

Unified Diff: Source/platform/graphics/paint/DisplayItemList.h

Issue 1323263002: Show debug information for invalid display items (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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/platform/graphics/paint/DisplayItem.cpp ('k') | Source/platform/graphics/paint/DisplayItemList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/paint/DisplayItemList.h
diff --git a/Source/platform/graphics/paint/DisplayItemList.h b/Source/platform/graphics/paint/DisplayItemList.h
index a20ba16997c4b2dcc357531c5b5bf150a3eef6df..b154bda9bad26771a827f50b0fdf25a8e85f500a 100644
--- a/Source/platform/graphics/paint/DisplayItemList.h
+++ b/Source/platform/graphics/paint/DisplayItemList.h
@@ -33,7 +33,26 @@ static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem
// which were invalidated on this frame and do not change SimpleLayers.
using DisplayListDiff = HashMap<DisplayItemClient, DisplayItem*>;
-using DisplayItems = ContiguousContainer<DisplayItem, kDisplayItemAlignment>;
+class DisplayItems : public ContiguousContainer<DisplayItem, kDisplayItemAlignment> {
+public:
+ DisplayItems(size_t initialSizeBytes)
+ : ContiguousContainer(kMaximumDisplayItemSize, initialSizeBytes) {}
+
+ DisplayItem& appendByMoving(DisplayItem& item)
+ {
+#ifndef NDEBUG
+ WTF::String originalDebugString = item.asDebugString();
+#endif
+ DisplayItem& result = ContiguousContainer::appendByMoving(item, item.derivedSize());
+ // ContiguousContainer::appendByMoving() called in-place constructor on item, which invalidated it.
+ ASSERT(!item.isValid());
+#ifndef NDEBUG
+ // Save original debug string in the old item to help debugging.
+ item.setClientDebugString(originalDebugString);
+#endif
+ return result;
+ }
+};
class PLATFORM_EXPORT DisplayItemList {
WTF_MAKE_NONCOPYABLE(DisplayItemList);
@@ -141,8 +160,8 @@ public:
protected:
DisplayItemList()
- : m_currentDisplayItems(kMaximumDisplayItemSize, 0)
- , m_newDisplayItems(kMaximumDisplayItemSize, kInitialDisplayItemsCapacity * kMaximumDisplayItemSize)
+ : m_currentDisplayItems(0)
+ , m_newDisplayItems(kInitialDisplayItemsCapacity * kMaximumDisplayItemSize)
, m_validlyCachedClientsDirty(false)
, m_constructionDisabled(false)
, m_skippingCacheCount(0)
« no previous file with comments | « Source/platform/graphics/paint/DisplayItem.cpp ('k') | Source/platform/graphics/paint/DisplayItemList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698