Chromium Code Reviews| Index: cc/quads/list_container.h |
| diff --git a/cc/quads/list_container.h b/cc/quads/list_container.h |
| index 34a30aadd6e74c2403fce5d339d61b9f00c428e6..5915a862afcd500e837c4cdd99bc5fc794bb5807 100644 |
| --- a/cc/quads/list_container.h |
| +++ b/cc/quads/list_container.h |
| @@ -150,9 +150,15 @@ class CC_EXPORT ListContainer { |
| // Allocate(). |
| template <typename DerivedElementType> |
| DerivedElementType* AllocateAndConstruct() { |
| - DerivedElementType* result = |
| - new (Allocate(sizeof(DerivedElementType))) DerivedElementType; |
| - return result; |
| + return new (Allocate(sizeof(DerivedElementType))) DerivedElementType; |
| + } |
| + // Take in derived element type and copy construct it at location generated by |
| + // Allocate(). |
| + template <typename DerivedElementType> |
| + DerivedElementType* AllocateAndCopyConstruct( |
|
danakj
2014/09/23 17:59:38
nit: AllocateAndCopyFrom?
weiliangc
2014/09/24 20:14:35
Done.
|
| + const DerivedElementType* source) { |
| + return new (Allocate(sizeof(DerivedElementType))) |
| + DerivedElementType(*source); |
| } |
| size_t size() const; |