OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 do { \ | 207 do { \ |
208 for (DelegateReferenceVector::iterator it = delegates.begin(); \ | 208 for (DelegateReferenceVector::iterator it = delegates.begin(); \ |
209 it != delegates.end(); ++it) { \ | 209 it != delegates.end(); ++it) { \ |
210 if (it->get()->delegate) \ | 210 if (it->get()->delegate) \ |
211 it->get()->delegate->func_and_args; \ | 211 it->get()->delegate->func_and_args; \ |
212 } \ | 212 } \ |
213 } while (0) | 213 } while (0) |
214 | 214 |
215 // Helper used to manage multiple references to a 'delegate' and to | 215 // Helper used to manage multiple references to a 'delegate' and to |
216 // allow all pending callbacks to that delegate to be easily cancelled. | 216 // allow all pending callbacks to that delegate to be easily cancelled. |
217 struct DelegateReference : public base::RefCounted<DelegateReference> { | 217 struct CONTENT_EXPORT DelegateReference : |
| 218 public base::RefCounted<DelegateReference> { |
218 Delegate* delegate; | 219 Delegate* delegate; |
219 AppCacheStorage* storage; | 220 AppCacheStorage* storage; |
220 | 221 |
221 DelegateReference(Delegate* delegate, AppCacheStorage* storage); | 222 DelegateReference(Delegate* delegate, AppCacheStorage* storage); |
222 | 223 |
223 void CancelReference() { | 224 void CancelReference() { |
224 storage->delegate_references_.erase(delegate); | 225 storage->delegate_references_.erase(delegate); |
225 storage = NULL; | 226 storage = NULL; |
226 delegate = NULL; | 227 delegate = NULL; |
227 } | 228 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 318 |
318 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, DelegateReferences); | 319 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, DelegateReferences); |
319 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, UsageMap); | 320 FRIEND_TEST_ALL_PREFIXES(content::AppCacheStorageTest, UsageMap); |
320 | 321 |
321 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); | 322 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); |
322 }; | 323 }; |
323 | 324 |
324 } // namespace content | 325 } // namespace content |
325 | 326 |
326 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ | 327 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_STORAGE_H_ |
OLD | NEW |