Chromium Code Reviews| Index: base/id_map.h |
| diff --git a/base/id_map.h b/base/id_map.h |
| index 8702982f172ffd0f06725207f296104946965d4d..7bdfd429d6dd6841ed859acbd5f13321220dae57 100644 |
| --- a/base/id_map.h |
| +++ b/base/id_map.h |
| @@ -17,8 +17,13 @@ |
| #include "base/macros.h" |
| #include "base/sequence_checker.h" |
| -// Ownership semantics - own pointer means the pointer is deleted in Remove() |
| -// & during destruction |
| +// Ownership semantics: |
| +// - OwnPointer means we store a unique_ptr that owns the object (so the |
| +// object is deleted in Remove() and during destruction). |
| +// - ExternalPointer means we store a raw pointer and don't own the object |
| + |
| +// TODO (http://crbug.com/647091): eliminate this enum, replace OwnPointer |
| +// mode in callsites with IDMap<unique_ptr<T>> |
| enum IDMapOwnershipSemantics { |
| IDMapExternalPointer, |
| IDMapOwnPointer |
| @@ -82,15 +87,12 @@ class IDMap { |
| AddWithIDInternal(std::move(data), id); |
| } |
| - // http://crbug.com/647091: Raw pointer Add()s in IDMapOwnPointer mode are |
| - // deprecated. Users of IDMapOwnPointer should transition to the unique_ptr |
| - // variant above, and the following methods should only be used in |
| - // IDMapExternalPointer mode. |
| + // The following two methods are used in IDMapExternalPointer mode. |
| KeyType Add(T* data) { |
|
aelias_OOO_until_Jul13
2016/11/08 01:55:09
I don't think the explicit overloading is needed a
|
| - return AddInternal(V(data)); |
| + return AddInternal(data); |
| } |
| void AddWithID(T* data, KeyType id) { |
| - AddWithIDInternal(V(data), id); |
| + AddWithIDInternal(data, id); |
| } |
| void Remove(KeyType id) { |