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

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

Issue 1479473002: base: Use std::move() instead of Pass() for real movable types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: basepass: missing-include Created 5 years 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_map.h » ('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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return 1; 75 return 1;
76 } 76 }
77 77
78 ScopedPtr take(iterator it) { 78 ScopedPtr take(iterator it) {
79 DCHECK(it != data_.end()); 79 DCHECK(it != data_.end());
80 if (it == data_.end()) 80 if (it == data_.end())
81 return ScopedPtr(); 81 return ScopedPtr();
82 82
83 ScopedPtr ret(it->second); 83 ScopedPtr ret(it->second);
84 it->second = NULL; 84 it->second = NULL;
85 return ret.Pass(); 85 return ret;
86 } 86 }
87 87
88 ScopedPtr take(const Key& k) { 88 ScopedPtr take(const Key& k) {
89 iterator it = find(k); 89 iterator it = find(k);
90 if (it == data_.end()) 90 if (it == data_.end())
91 return ScopedPtr(); 91 return ScopedPtr();
92 92
93 return take(it); 93 return take(it);
94 } 94 }
95 95
96 ScopedPtr take_and_erase(iterator it) { 96 ScopedPtr take_and_erase(iterator it) {
97 DCHECK(it != data_.end()); 97 DCHECK(it != data_.end());
98 if (it == data_.end()) 98 if (it == data_.end())
99 return ScopedPtr(); 99 return ScopedPtr();
100 100
101 ScopedPtr ret(it->second); 101 ScopedPtr ret(it->second);
102 data_.erase(it); 102 data_.erase(it);
103 return ret.Pass(); 103 return ret;
104 } 104 }
105 105
106 ScopedPtr take_and_erase(const Key& k) { 106 ScopedPtr take_and_erase(const Key& k) {
107 iterator it = find(k); 107 iterator it = find(k);
108 if (it == data_.end()) 108 if (it == data_.end())
109 return ScopedPtr(); 109 return ScopedPtr();
110 110
111 return take_and_erase(it); 111 return take_and_erase(it);
112 } 112 }
113 113
(...skipping 49 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_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698