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

Unified Diff: Source/platform/graphics/paint/DisplayItemList.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
« no previous file with comments | « Source/platform/graphics/paint/DisplayItem.h ('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 6140393706b7623c5d446e44b6535b85afe53190..5409b43b3aa8efe09c104033ce9b9ae83d9f6c63 100644
--- a/Source/platform/graphics/paint/DisplayItemList.h
+++ b/Source/platform/graphics/paint/DisplayItemList.h
@@ -16,6 +16,8 @@ namespace blink {
class GraphicsContext;
+static const size_t kInitialDisplayItemsCapacity = 32;
+
class PLATFORM_EXPORT DisplayItemList {
WTF_MAKE_NONCOPYABLE(DisplayItemList);
WTF_MAKE_FAST_ALLOCATED(DisplayItemList);
@@ -30,7 +32,15 @@ public:
void invalidateAll();
// These methods are called during painting.
- void add(WTF::PassOwnPtr<DisplayItem>);
+ template<typename DisplayItemClass>
+ DisplayItemClass& createAndAppend(const DisplayItemClientWrapper& client, DisplayItem::Type type)
+ {
+ DisplayItemClass& item = m_newDisplayItems.createAndAppend<DisplayItemClass>();
+ item.setClientAndType(client, type);
+ processNewItem(&item);
+ return item;
+ }
+ void add(WTF::PassOwnPtr<DisplayItem>) { } // REMOVE ME
void beginScope(DisplayItemClient);
void endScope(DisplayItemClient);
@@ -72,7 +82,9 @@ public:
protected:
DisplayItemList()
- : m_validlyCachedClientsDirty(false)
+ : m_currentDisplayItems(kInitialDisplayItemsCapacity)
+ , m_newDisplayItems(kInitialDisplayItemsCapacity)
+ , m_validlyCachedClientsDirty(false)
, m_constructionDisabled(false)
, m_skippingCacheCount(0)
, m_numCachedItems(0) { }
@@ -82,6 +94,10 @@ private:
friend class DisplayItemListPaintTest;
friend class LayoutObjectDrawingRecorderTest;
+ // Set new item state (scopes, cache skipping, etc) for a new item.
+ // TODO(pdr): This only passes a pointer to make the patch easier to review. Change to a reference.
+ void processNewItem(DisplayItem*);
+
void updateValidlyCachedClientsIfNeeded() const;
#ifndef NDEBUG
« no previous file with comments | « Source/platform/graphics/paint/DisplayItem.h ('k') | Source/platform/graphics/paint/DisplayItemList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698