OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_QUOTA_QUOTA_TYPES_H_ | 5 #ifndef WEBKIT_QUOTA_QUOTA_TYPES_H_ |
6 #define WEBKIT_QUOTA_QUOTA_TYPES_H_ | 6 #define WEBKIT_QUOTA_QUOTA_TYPES_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 typedef typename CallbackMap::iterator iterator; | 156 typedef typename CallbackMap::iterator iterator; |
157 | 157 |
158 bool Add(const KEY& key, CallbackType callback) { | 158 bool Add(const KEY& key, CallbackType callback) { |
159 return callback_map_[key].Add(callback); | 159 return callback_map_[key].Add(callback); |
160 } | 160 } |
161 | 161 |
162 bool HasCallbacks(const KEY& key) const { | 162 bool HasCallbacks(const KEY& key) const { |
163 return (callback_map_.find(key) != callback_map_.end()); | 163 return (callback_map_.find(key) != callback_map_.end()); |
164 } | 164 } |
165 | 165 |
| 166 bool HasAnyCallbacks() const { |
| 167 return !callback_map_.empty(); |
| 168 } |
| 169 |
166 iterator Begin() { return callback_map_.begin(); } | 170 iterator Begin() { return callback_map_.begin(); } |
167 iterator End() { return callback_map_.end(); } | 171 iterator End() { return callback_map_.end(); } |
168 | 172 |
169 void Clear() { callback_map_.clear(); } | 173 void Clear() { callback_map_.clear(); } |
170 | 174 |
171 protected: | 175 protected: |
172 CallbackMap callback_map_; | 176 CallbackMap callback_map_; |
173 }; | 177 }; |
174 | 178 |
175 template <typename CallbackType1, typename KEY, typename ARG> | 179 template <typename CallbackType1, typename KEY, typename ARG> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 const std::string&, | 276 const std::string&, |
273 StorageType, int64> HostUsageCallbackMap; | 277 StorageType, int64> HostUsageCallbackMap; |
274 typedef CallbackQueueMap4<HostQuotaCallback*, std::string, | 278 typedef CallbackQueueMap4<HostQuotaCallback*, std::string, |
275 QuotaStatusCode, | 279 QuotaStatusCode, |
276 const std::string&, | 280 const std::string&, |
277 StorageType, int64> HostQuotaCallbackMap; | 281 StorageType, int64> HostQuotaCallbackMap; |
278 | 282 |
279 } // namespace quota | 283 } // namespace quota |
280 | 284 |
281 #endif // WEBKIT_QUOTA_QUOTA_TYPES_H_ | 285 #endif // WEBKIT_QUOTA_QUOTA_TYPES_H_ |
OLD | NEW |