OLD | NEW |
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_SCOPED_PTR_HASH_MAP_H_ | 5 #ifndef CC_BASE_SCOPED_PTR_HASH_MAP_H_ |
6 #define CC_SCOPED_PTR_HASH_MAP_H_ | 6 #define CC_BASE_SCOPED_PTR_HASH_MAP_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 // This type acts like a hash_map<K, scoped_ptr<V> >, based on top of | 16 // 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 | 17 // std::hash_map. The ScopedPtrHashMap has ownership of all values in the data |
18 // structure. | 18 // structure. |
19 template <typename Key, typename Value> | 19 template <typename Key, typename Value> |
20 class ScopedPtrHashMap { | 20 class ScopedPtrHashMap { |
21 typedef base::hash_map<Key, Value*> Container; | 21 typedef base::hash_map<Key, Value*> Container; |
22 public: | 22 public: |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 inline const_iterator end() const { return data_.end(); } | 143 inline const_iterator end() const { return data_.end(); } |
144 | 144 |
145 private: | 145 private: |
146 Container data_; | 146 Container data_; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap); | 148 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace cc | 151 } // namespace cc |
152 | 152 |
153 #endif // CC_SCOPED_PTR_HASH_MAP_H_ | 153 #endif // CC_BASE_SCOPED_PTR_HASH_MAP_H_ |
OLD | NEW |