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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "platform/graphics/paint/DisplayItems.h" 6 #include "platform/graphics/paint/DisplayItems.h"
7 7
8 namespace blink { 8 namespace blink {
9 9
10 DisplayItems::DisplayItems()
11 {
12 }
13
14 DisplayItems::~DisplayItems() 10 DisplayItems::~DisplayItems()
15 { 11 {
16 } 12 }
17 13
18 void DisplayItems::append(PassOwnPtr<DisplayItem> displayItem) 14 void DisplayItems::appendByMoving(const Iterator& other)
19 { 15 {
20 m_items.append(displayItem); 16 ASSERT(!other->isGone());
21 } 17 size_t indexInSource = other.m_iterator - other.m_owningList->m_ptrs.begin() ;
22 18 DisplayItem* source = other.m_owningList->m_ptrs[indexInSource];
23 void DisplayItems::appendByMoving(const Iterator& it) 19 m_items.appendByMoving(source);
24 { 20 m_ptrs.append(source);
25 // Release the underlying OwnPtr to move the display item ownership. 21 other.m_owningList->m_ptrs[indexInSource] = nullptr;
26 ASSERT(!it->isGone());
27 append(it.m_iterator->release());
28 } 22 }
29 23
30 void DisplayItems::removeLast() 24 void DisplayItems::removeLast()
31 { 25 {
26 m_ptrs.removeLast();
32 m_items.removeLast(); 27 m_items.removeLast();
33 } 28 }
34 29
35 void DisplayItems::clear() 30 void DisplayItems::clear()
36 { 31 {
32 m_ptrs.clear();
37 m_items.clear(); 33 m_items.clear();
38 } 34 }
39 35
40 void DisplayItems::swap(DisplayItems& other) 36 void DisplayItems::swap(DisplayItems& other)
41 { 37 {
38 m_ptrs.swap(other.m_ptrs);
42 m_items.swap(other.m_items); 39 m_items.swap(other.m_items);
43 } 40 }
44 41
45 void DisplayItems::setGone(const Iterator& it) 42 void DisplayItems::setGone(const Iterator& it)
46 { 43 {
47 it.m_iterator->clear(); 44 size_t index = it.m_iterator - it.m_owningList->m_ptrs.begin();
45 m_ptrs[index] = nullptr;
48 } 46 }
49 47
50 } // namespace blink 48 } // namespace blink
OLDNEW
« 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