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

Unified Diff: Source/platform/graphics/paint/DisplayItems.cpp

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/DisplayItems.h ('k') | Source/platform/graphics/paint/DrawingDisplayItem.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/paint/DisplayItems.cpp
diff --git a/Source/platform/graphics/paint/DisplayItems.cpp b/Source/platform/graphics/paint/DisplayItems.cpp
index 78c940dd9fbb388db8aafa2f38485e799f974a76..26aba57f1b8331b5450dc217b960da99a080012e 100644
--- a/Source/platform/graphics/paint/DisplayItems.cpp
+++ b/Source/platform/graphics/paint/DisplayItems.cpp
@@ -7,44 +7,42 @@
namespace blink {
-DisplayItems::DisplayItems()
-{
-}
-
DisplayItems::~DisplayItems()
{
}
-void DisplayItems::append(PassOwnPtr<DisplayItem> displayItem)
-{
- m_items.append(displayItem);
-}
-
-void DisplayItems::appendByMoving(const Iterator& it)
+void DisplayItems::appendByMoving(const Iterator& other)
{
- // Release the underlying OwnPtr to move the display item ownership.
- ASSERT(!it->isGone());
- append(it.m_iterator->release());
+ ASSERT(!other->isGone());
+ size_t indexInSource = other.m_iterator - other.m_owningList->m_ptrs.begin();
+ DisplayItem* source = other.m_owningList->m_ptrs[indexInSource];
+ m_items.appendByMoving(source);
+ m_ptrs.append(source);
+ other.m_owningList->m_ptrs[indexInSource] = nullptr;
}
void DisplayItems::removeLast()
{
+ m_ptrs.removeLast();
m_items.removeLast();
}
void DisplayItems::clear()
{
+ m_ptrs.clear();
m_items.clear();
}
void DisplayItems::swap(DisplayItems& other)
{
+ m_ptrs.swap(other.m_ptrs);
m_items.swap(other.m_items);
}
void DisplayItems::setGone(const Iterator& it)
{
- it.m_iterator->clear();
+ size_t index = it.m_iterator - it.m_owningList->m_ptrs.begin();
+ m_ptrs[index] = nullptr;
}
} // namespace blink
« no previous file with comments | « Source/platform/graphics/paint/DisplayItems.h ('k') | Source/platform/graphics/paint/DrawingDisplayItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698