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

Side by Side Diff: cc/base/list_container.h

Issue 2064833002: Implement DrawQuad StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bad type converter test Created 4 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
« no previous file with comments | « no previous file | cc/ipc/DEPS » ('j') | cc/ipc/quads_struct_traits.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CC_BASE_LIST_CONTAINER_H_ 5 #ifndef CC_BASE_LIST_CONTAINER_H_
6 #define CC_BASE_LIST_CONTAINER_H_ 6 #define CC_BASE_LIST_CONTAINER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 Iterator InsertBeforeAndInvalidateAllPointers(Iterator at, size_t count) { 137 Iterator InsertBeforeAndInvalidateAllPointers(Iterator at, size_t count) {
138 helper_.InsertBeforeAndInvalidateAllPointers(&at, count); 138 helper_.InsertBeforeAndInvalidateAllPointers(&at, count);
139 Iterator result = at; 139 Iterator result = at;
140 for (size_t i = 0; i < count; ++i) { 140 for (size_t i = 0; i < count; ++i) {
141 new (at.item_iterator) DerivedElementType(); 141 new (at.item_iterator) DerivedElementType();
142 ++at; 142 ++at;
143 } 143 }
144 return result; 144 return result;
145 } 145 }
146 146
147 ListContainer& operator=(ListContainer&& other) {
dcheng 2016/06/16 20:57:41 Even if you don't need it now, it's better form to
Fady Samuel 2016/06/16 22:56:29 Agreed. Done.
148 helper_.data_.swap(other.helper_.data_);
149 return *this;
150 }
151
147 template <typename DerivedElementType> 152 template <typename DerivedElementType>
148 void swap(ListContainer<DerivedElementType>& other) { 153 void swap(ListContainer<DerivedElementType>& other) {
149 helper_.data_.swap(other.helper_.data_); 154 helper_.data_.swap(other.helper_.data_);
150 } 155 }
151 156
152 // Appends a new item without copying. The original item will not be 157 // Appends a new item without copying. The original item will not be
153 // destructed and will be replaced with a new DerivedElementType. The 158 // destructed and will be replaced with a new DerivedElementType. The
154 // DerivedElementType does not have to match the moved type as a full block 159 // DerivedElementType does not have to match the moved type as a full block
155 // of memory will be moved (up to MaxSizeForDerivedClass()). A pointer to 160 // of memory will be moved (up to MaxSizeForDerivedClass()). A pointer to
156 // the moved element is returned. 161 // the moved element is returned.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 343
339 private: 344 private:
340 ListContainerHelper helper_; 345 ListContainerHelper helper_;
341 346
342 DISALLOW_COPY_AND_ASSIGN(ListContainer); 347 DISALLOW_COPY_AND_ASSIGN(ListContainer);
343 }; 348 };
344 349
345 } // namespace cc 350 } // namespace cc
346 351
347 #endif // CC_BASE_LIST_CONTAINER_H_ 352 #endif // CC_BASE_LIST_CONTAINER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/ipc/DEPS » ('j') | cc/ipc/quads_struct_traits.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698