| Index: base/id_map.h
|
| diff --git a/base/id_map.h b/base/id_map.h
|
| index 8702982f172ffd0f06725207f296104946965d4d..7ec33b89b0dfdcbeb32f0d28f8857d382eb3f74d 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
|
| @@ -68,8 +73,7 @@ class IDMap {
|
| void set_check_on_null_data(bool value) { check_on_null_data_ = value; }
|
|
|
| // Adds a view with an automatically generated unique ID. See AddWithID.
|
| - // (This unique_ptr<> variant will not compile in IDMapExternalPointer mode.)
|
| - KeyType Add(std::unique_ptr<T> data) {
|
| + KeyType Add(V data) {
|
| return AddInternal(std::move(data));
|
| }
|
|
|
| @@ -77,22 +81,10 @@ class IDMap {
|
| // the list. The caller either must generate all unique IDs itself and use
|
| // this function, or allow this object to generate IDs and call Add. These
|
| // two methods may not be mixed, or duplicate IDs may be generated.
|
| - // (This unique_ptr<> variant will not compile in IDMapExternalPointer mode.)
|
| - void AddWithID(std::unique_ptr<T> data, KeyType id) {
|
| + void AddWithID(V data, KeyType id) {
|
| 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.
|
| - KeyType Add(T* data) {
|
| - return AddInternal(V(data));
|
| - }
|
| - void AddWithID(T* data, KeyType id) {
|
| - AddWithIDInternal(V(data), id);
|
| - }
|
| -
|
| void Remove(KeyType id) {
|
| DCHECK(sequence_checker_.CalledOnValidSequence());
|
| typename HashTable::iterator i = data_.find(id);
|
|
|