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

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

Issue 1203343002: WIP for display item list backed by ListContainer Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/DisplayItem.h
diff --git a/Source/platform/graphics/paint/DisplayItem.h b/Source/platform/graphics/paint/DisplayItem.h
index ed8985384fd6aee80bffa12ab56447a5271950e0..dce94f8c88e84c79c4ded2163dec47bfe154557c 100644
--- a/Source/platform/graphics/paint/DisplayItem.h
+++ b/Source/platform/graphics/paint/DisplayItem.h
@@ -23,6 +23,17 @@ class WebDisplayItemList;
class PLATFORM_EXPORT DisplayItem {
public:
+ DisplayItem()
+ : m_client(nullptr)
+ , m_scopeContainer(nullptr)
+ , m_scopeId(0)
+ , m_type(UninitializedType)
+ , m_skippedCache(false)
+#ifndef NDEBUG
+ , m_clientDebugString("invalid")
+#endif
+ { }
+
enum {
// Must be kept in sync with core/layout/PaintPhase.h.
PaintPhaseMax = 12,
@@ -173,7 +184,8 @@ public:
EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax,
EndSubtreeLast = EndSubtreePaintPhaseLast,
- TypeLast = EndSubtreeLast
+ UninitializedType,
+ TypeLast = UninitializedType
};
struct Id {
@@ -311,23 +323,29 @@ public:
#endif
protected:
- DisplayItem(const DisplayItemClientWrapper& client, Type type)
- : m_client(client.displayItemClient())
- , m_scopeContainer(nullptr)
- , m_scopeId(0)
- , m_type(type)
- , m_skippedCache(false)
+ // TODO(pdr): friend just the function DisplayItemList::createAndAppend(...).
+ friend class DisplayItemList;
+ void setClientAndType(const DisplayItemClientWrapper& clientWrapper, Type type)
+ {
+ // Clients should never change once set.
+ ASSERT(m_client == nullptr);
+ m_client = clientWrapper.displayItemClient();
+
+ // Types should never change once set.
+ ASSERT(m_type = UninitializedType);
+ m_type = type;
+
#ifndef NDEBUG
- , m_clientDebugString(client.debugName())
+ m_clientDebugString = clientWrapper.debugName();
#endif
- { }
+ }
private:
- const DisplayItemClient m_client;
+ DisplayItemClient m_client;
DisplayItemClient m_scopeContainer;
int m_scopeId;
static_assert(TypeLast < (1 << 16), "DisplayItem::Type should fit in 16 bits");
- const Type m_type : 16;
+ Type m_type : 16;
unsigned m_skippedCache : 1;
#ifndef NDEBUG
@@ -337,7 +355,7 @@ private:
class PLATFORM_EXPORT PairedBeginDisplayItem : public DisplayItem {
protected:
- PairedBeginDisplayItem(const DisplayItemClientWrapper& client, Type type) : DisplayItem(client, type) { }
+ PairedBeginDisplayItem() { }
private:
virtual bool isBegin() const override final { return true; }
@@ -345,7 +363,7 @@ private:
class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem {
protected:
- PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : DisplayItem(client, type) { }
+ PairedEndDisplayItem() { }
#if ENABLE(ASSERT)
virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0;
« no previous file with comments | « Source/platform/graphics/paint/CompositingDisplayItem.h ('k') | Source/platform/graphics/paint/DisplayItemList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698