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

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

Issue 13051003: cpplint.py pass on cc/(base|debug|quads|resources)/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix prioritized_resource_unittest Created 7 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/base/scoped_ptr_deque.h ('k') | cc/base/scoped_ptr_vector.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_BASE_SCOPED_PTR_HASH_MAP_H_ 5 #ifndef CC_BASE_SCOPED_PTR_HASH_MAP_H_
6 #define CC_BASE_SCOPED_PTR_HASH_MAP_H_ 6 #define CC_BASE_SCOPED_PTR_HASH_MAP_H_
7 7
8 #include <algorithm>
9 #include <utility>
10
8 #include "base/basictypes.h" 11 #include "base/basictypes.h"
9 #include "base/hash_tables.h" 12 #include "base/hash_tables.h"
10 #include "base/logging.h" 13 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
12 #include "base/stl_util.h" 15 #include "base/stl_util.h"
13 16
14 namespace cc { 17 namespace cc {
15 18
16 // This type acts like a hash_map<K, scoped_ptr<V> >, based on top of 19 // This type acts like a hash_map<K, scoped_ptr<V> >, based on top of
17 // std::hash_map. The ScopedPtrHashMap has ownership of all values in the data 20 // base::hash_map. The ScopedPtrHashMap has ownership of all values in the data
18 // structure. 21 // structure.
19 template <typename Key, typename Value> 22 template <typename Key, typename Value>
20 class ScopedPtrHashMap { 23 class ScopedPtrHashMap {
21 typedef base::hash_map<Key, Value*> Container; 24 typedef base::hash_map<Key, Value*> Container;
25
22 public: 26 public:
23 typedef typename Container::iterator iterator; 27 typedef typename Container::iterator iterator;
24 typedef typename Container::const_iterator const_iterator; 28 typedef typename Container::const_iterator const_iterator;
25 29
26 ScopedPtrHashMap() {} 30 ScopedPtrHashMap() {}
27 31
28 ~ScopedPtrHashMap() { clear(); } 32 ~ScopedPtrHashMap() { clear(); }
29 33
30 void swap(ScopedPtrHashMap<Key, Value*>& other) { 34 void swap(ScopedPtrHashMap<Key, Value*>& other) {
31 data_.swap(other.data_); 35 data_.swap(other.data_);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 148
145 private: 149 private:
146 Container data_; 150 Container data_;
147 151
148 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap); 152 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap);
149 }; 153 };
150 154
151 } // namespace cc 155 } // namespace cc
152 156
153 #endif // CC_BASE_SCOPED_PTR_HASH_MAP_H_ 157 #endif // CC_BASE_SCOPED_PTR_HASH_MAP_H_
OLDNEW
« no previous file with comments | « cc/base/scoped_ptr_deque.h ('k') | cc/base/scoped_ptr_vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698