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

Side by Side Diff: Source/platform/graphics/ContiguousContainer.h

Issue 1287863003: Avoid re-iterate out-of-order display items (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/graphics/paint/DisplayItem.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef ContiguousContainer_h 5 #ifndef ContiguousContainer_h
6 #define ContiguousContainer_h 6 #define ContiguousContainer_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "wtf/Alignment.h" 9 #include "wtf/Alignment.h"
10 #include "wtf/Compiler.h" 10 #include "wtf/Compiler.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // things. The whole random access iterator interface is a bit much. 83 // things. The whole random access iterator interface is a bit much.
84 template <typename BaseIterator, typename ValueType> 84 template <typename BaseIterator, typename ValueType>
85 class IteratorWrapper : public std::iterator<ValueType, std::forward_iterato r_tag> { 85 class IteratorWrapper : public std::iterator<ValueType, std::forward_iterato r_tag> {
86 public: 86 public:
87 IteratorWrapper() {} 87 IteratorWrapper() {}
88 bool operator==(const IteratorWrapper& other) const { return m_it == oth er.m_it; } 88 bool operator==(const IteratorWrapper& other) const { return m_it == oth er.m_it; }
89 bool operator!=(const IteratorWrapper& other) const { return m_it != oth er.m_it; } 89 bool operator!=(const IteratorWrapper& other) const { return m_it != oth er.m_it; }
90 ValueType& operator*() const { return *static_cast<ValueType*>(*m_it); } 90 ValueType& operator*() const { return *static_cast<ValueType*>(*m_it); }
91 ValueType* operator->() const { return &operator*(); } 91 ValueType* operator->() const { return &operator*(); }
92 IteratorWrapper operator+(std::ptrdiff_t n) const { return IteratorWrapp er(m_it + n); } 92 IteratorWrapper operator+(std::ptrdiff_t n) const { return IteratorWrapp er(m_it + n); }
93 IteratorWrapper operator++(int) const { IteratorWrapper tmp = *this; ope rator++(); return tmp; } 93 IteratorWrapper operator++(int) { IteratorWrapper tmp = *this; ++m_it; r eturn tmp; }
94 std::ptrdiff_t operator-(const IteratorWrapper& other) const { return m_ it - other.m_it; } 94 std::ptrdiff_t operator-(const IteratorWrapper& other) const { return m_ it - other.m_it; }
95 IteratorWrapper& operator++() { ++m_it; return *this; } 95 IteratorWrapper& operator++() { ++m_it; return *this; }
96 private: 96 private:
97 explicit IteratorWrapper(const BaseIterator& it) : m_it(it) {} 97 explicit IteratorWrapper(const BaseIterator& it) : m_it(it) {}
98 BaseIterator m_it; 98 BaseIterator m_it;
99 friend class ContiguousContainer; 99 friend class ContiguousContainer;
100 }; 100 };
101 101
102 public: 102 public:
103 using iterator = IteratorWrapper<Vector<void*>::iterator, BaseElementType>; 103 using iterator = IteratorWrapper<Vector<void*>::iterator, BaseElementType>;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 ASSERT(alignedSize % alignment == 0); 187 ASSERT(alignedSize % alignment == 0);
188 ASSERT(alignedSize >= size); 188 ASSERT(alignedSize >= size);
189 ASSERT(alignedSize < size + alignment); 189 ASSERT(alignedSize < size + alignment);
190 return alignedSize; 190 return alignedSize;
191 } 191 }
192 }; 192 };
193 193
194 } // namespace blink 194 } // namespace blink
195 195
196 #endif // ContiguousContainer_h 196 #endif // ContiguousContainer_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/paint/DisplayItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698