Chromium Code Reviews| 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_APPCACHE_APPCACHE_STORAGE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 bool was_blocked_by_policy) {} | 69 bool was_blocked_by_policy) {} |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 explicit AppCacheStorage(AppCacheService* service); | 72 explicit AppCacheStorage(AppCacheService* service); |
| 73 virtual ~AppCacheStorage(); | 73 virtual ~AppCacheStorage(); |
| 74 | 74 |
| 75 // Schedules a task to retrieve basic info about all groups and caches | 75 // Schedules a task to retrieve basic info about all groups and caches |
| 76 // stored in the system. Upon completion the delegate will be called | 76 // stored in the system. Upon completion the delegate will be called |
| 77 // with the results. | 77 // with the results. |
| 78 virtual void GetAllInfo(Delegate* delegate) = 0; | 78 virtual void GetAllInfo(Delegate* delegate) = 0; |
| 79 // The same as GetAllInfo but completes synchronously (delegate will be called | |
| 80 // within the method). | |
| 81 virtual void SyncGetAllInfo(Delegate* delegate) = 0; | |
|
michaeln
2011/07/14 00:42:34
Please remove all of these Sync prefixed methods f
marja(google)
2011/07/14 10:31:59
Done.
| |
| 79 | 82 |
| 80 // Schedules a cache to be loaded from storage. Upon load completion | 83 // Schedules a cache to be loaded from storage. Upon load completion |
| 81 // the delegate will be called back. If the cache already resides in | 84 // the delegate will be called back. If the cache already resides in |
| 82 // memory, the delegate will be called back immediately without returning | 85 // memory, the delegate will be called back immediately without returning |
| 83 // to the message loop. If the load fails, the delegate will be called | 86 // to the message loop. If the load fails, the delegate will be called |
| 84 // back with a NULL cache pointer. | 87 // back with a NULL cache pointer. |
| 85 virtual void LoadCache(int64 id, Delegate* delegate) = 0; | 88 virtual void LoadCache(int64 id, Delegate* delegate) = 0; |
| 86 | 89 |
| 87 // Schedules a group and its newest cache, if any, to be loaded from storage. | 90 // Schedules a group and its newest cache, if any, to be loaded from storage. |
| 88 // Upon load completion the delegate will be called back. If the group | 91 // Upon load completion the delegate will be called back. If the group |
| 89 // and newest cache already reside in memory, the delegate will be called | 92 // and newest cache already reside in memory, the delegate will be called |
| 90 // back immediately without returning to the message loop. If the load fails, | 93 // back immediately without returning to the message loop. If the load fails, |
| 91 // the delegate will be called back with a NULL group pointer. | 94 // the delegate will be called back with a NULL group pointer. |
| 92 virtual void LoadOrCreateGroup( | 95 virtual void LoadOrCreateGroup( |
| 93 const GURL& manifest_url, Delegate* delegate) = 0; | 96 const GURL& manifest_url, Delegate* delegate) = 0; |
| 97 // The same as SyncLoadOrCreateGroup but completes synchronously (delegate | |
| 98 // will be called within the method). | |
| 99 virtual void SyncLoadOrCreateGroup( | |
| 100 const GURL& manifest_url, Delegate* delegate) = 0; | |
| 94 | 101 |
| 95 // Schedules response info to be loaded from storage. | 102 // Schedules response info to be loaded from storage. |
| 96 // Upon load completion the delegate will be called back. If the data | 103 // Upon load completion the delegate will be called back. If the data |
| 97 // already resides in memory, the delegate will be called back | 104 // already resides in memory, the delegate will be called back |
| 98 // immediately without returning to the message loop. If the load fails, | 105 // immediately without returning to the message loop. If the load fails, |
| 99 // the delegate will be called back with a NULL pointer. | 106 // the delegate will be called back with a NULL pointer. |
| 100 virtual void LoadResponseInfo( | 107 virtual void LoadResponseInfo( |
| 101 const GURL& manifest_url, int64 response_id, Delegate* delegate); | 108 const GURL& manifest_url, int64 response_id, Delegate* delegate); |
| 102 | 109 |
| 103 // Schedules a group and its newest complete cache to be initially stored or | 110 // Schedules a group and its newest complete cache to be initially stored or |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 130 // and schedules a task to update persistent storage. If the cache is | 137 // and schedules a task to update persistent storage. If the cache is |
| 131 // already scheduled to be loaded, upon loading completion the entry | 138 // already scheduled to be loaded, upon loading completion the entry |
| 132 // will be marked. There is no delegate completion callback. | 139 // will be marked. There is no delegate completion callback. |
| 133 virtual void MarkEntryAsForeign(const GURL& entry_url, int64 cache_id) = 0; | 140 virtual void MarkEntryAsForeign(const GURL& entry_url, int64 cache_id) = 0; |
| 134 | 141 |
| 135 // Schedules a task to update persistent storage and doom the group and all | 142 // Schedules a task to update persistent storage and doom the group and all |
| 136 // related caches and responses for deletion. Upon completion the in-memory | 143 // related caches and responses for deletion. Upon completion the in-memory |
| 137 // instance is marked as obsolete and the delegate callback is called. | 144 // instance is marked as obsolete and the delegate callback is called. |
| 138 virtual void MakeGroupObsolete( | 145 virtual void MakeGroupObsolete( |
| 139 AppCacheGroup* group, Delegate* delegate) = 0; | 146 AppCacheGroup* group, Delegate* delegate) = 0; |
| 147 // The same as MakeGroupObsolete but completes synchronously (delegate will be | |
| 148 // called within the method). | |
| 149 virtual void SyncMakeGroupObsolete( | |
| 150 AppCacheGroup* group, Delegate* delegate) = 0; | |
| 140 | 151 |
| 141 // Cancels all pending callbacks for the delegate. The delegate callbacks | 152 // Cancels all pending callbacks for the delegate. The delegate callbacks |
| 142 // will not be invoked after, however any scheduled operations will still | 153 // will not be invoked after, however any scheduled operations will still |
| 143 // take place. The callbacks for subsequently scheduled operations are | 154 // take place. The callbacks for subsequently scheduled operations are |
| 144 // unaffected. | 155 // unaffected. |
| 145 void CancelDelegateCallbacks(Delegate* delegate) { | 156 void CancelDelegateCallbacks(Delegate* delegate) { |
| 146 DelegateReference* delegate_reference = GetDelegateReference(delegate); | 157 DelegateReference* delegate_reference = GetDelegateReference(delegate); |
| 147 if (delegate_reference) | 158 if (delegate_reference) |
| 148 delegate_reference->CancelReference(); | 159 delegate_reference->CancelReference(); |
| 149 } | 160 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 | 317 |
| 307 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, DelegateReferences); | 318 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, DelegateReferences); |
| 308 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, UsageMap); | 319 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, UsageMap); |
| 309 | 320 |
| 310 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); | 321 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); |
| 311 }; | 322 }; |
| 312 | 323 |
| 313 } // namespace appcache | 324 } // namespace appcache |
| 314 | 325 |
| 315 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ | 326 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ |
| 316 | |
| OLD | NEW |