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

Side by Side Diff: base/containers/scoped_ptr_hash_map.h

Issue 1423663010: Change ScopedPtr(Hash)Map to make qualified calls to ignore_result(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix whitespace Created 5 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
« no previous file with comments | « no previous file | base/containers/scoped_ptr_hash_map_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_ 5 #ifndef BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_
6 #define BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_ 6 #define BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 return data_.insert(std::make_pair(key, data.release())).first; 52 return data_.insert(std::make_pair(key, data.release())).first;
53 } 53 }
54 54
55 // Does nothing if key is already present 55 // Does nothing if key is already present
56 std::pair<iterator, bool> add(const Key& key, ScopedPtr data) { 56 std::pair<iterator, bool> add(const Key& key, ScopedPtr data) {
57 std::pair<iterator, bool> result = 57 std::pair<iterator, bool> result =
58 data_.insert(std::make_pair(key, data.get())); 58 data_.insert(std::make_pair(key, data.get()));
59 if (result.second) 59 if (result.second)
60 ignore_result(data.release()); 60 ::ignore_result(data.release());
61 return result; 61 return result;
62 } 62 }
63 63
64 void erase(iterator it) { 64 void erase(iterator it) {
65 // Let ScopedPtr decide how to delete. 65 // Let ScopedPtr decide how to delete.
66 ScopedPtr(it->second).reset(); 66 ScopedPtr(it->second).reset();
67 data_.erase(it); 67 data_.erase(it);
68 } 68 }
69 69
70 size_t erase(const Key& k) { 70 size_t erase(const Key& k) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 private: 164 private:
165 Container data_; 165 Container data_;
166 166
167 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap); 167 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap);
168 }; 168 };
169 169
170 } // namespace base 170 } // namespace base
171 171
172 #endif // BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_ 172 #endif // BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | base/containers/scoped_ptr_hash_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698