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

Side by Side Diff: content/browser/indexed_db/indexed_db_dispatcher_host.h

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Clean up unnecessary release/cast Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // IDMap for RefCounted types 119 // IDMap for RefCounted types
120 template <typename RefCountedType> 120 template <typename RefCountedType>
121 class RefIDMap { 121 class RefIDMap {
122 public: 122 public:
123 typedef int32_t KeyType; 123 typedef int32_t KeyType;
124 124
125 RefIDMap() {} 125 RefIDMap() {}
126 ~RefIDMap() {} 126 ~RefIDMap() {}
127 127
128 KeyType Add(RefCountedType* data) { 128 KeyType Add(RefCountedType* data) {
129 return map_.Add(new scoped_refptr<RefCountedType>(data)); 129 return map_.Add(base::MakeUnique<scoped_refptr<RefCountedType>>(data));
130 } 130 }
131 131
132 RefCountedType* Lookup(KeyType id) { 132 RefCountedType* Lookup(KeyType id) {
133 scoped_refptr<RefCountedType>* ptr = map_.Lookup(id); 133 scoped_refptr<RefCountedType>* ptr = map_.Lookup(id);
134 if (ptr == NULL) 134 if (ptr == NULL)
135 return NULL; 135 return NULL;
136 return ptr->get(); 136 return ptr->get();
137 } 137 }
138 138
139 void Remove(KeyType id) { map_.Remove(id); } 139 void Remove(KeyType id) { map_.Remove(id); }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 // Used to set file permissions for blob storage. 246 // Used to set file permissions for blob storage.
247 int ipc_process_id_; 247 int ipc_process_id_;
248 248
249 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 249 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
250 }; 250 };
251 251
252 } // namespace content 252 } // namespace content
253 253
254 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 254 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698