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_SERVICE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Purges any memory not needed. | 64 // Purges any memory not needed. |
65 void PurgeMemory() { | 65 void PurgeMemory() { |
66 if (storage_.get()) | 66 if (storage_.get()) |
67 storage_->PurgeMemory(); | 67 storage_->PurgeMemory(); |
68 } | 68 } |
69 | 69 |
70 // Determines if a request for 'url' can be satisfied while offline. | 70 // Determines if a request for 'url' can be satisfied while offline. |
71 // This method always completes asynchronously. | 71 // This method always completes asynchronously. |
72 void CanHandleMainResourceOffline(const GURL& url, | 72 void CanHandleMainResourceOffline(const GURL& url, |
73 const GURL& first_party, | 73 const GURL& first_party, |
74 net::OldCompletionCallback* callback); | 74 const net::CompletionCallback& callback); |
75 | 75 |
76 // Populates 'collection' with info about all of the appcaches stored | 76 // Populates 'collection' with info about all of the appcaches stored |
77 // within the service, 'callback' is invoked upon completion. The service | 77 // within the service, 'callback' is invoked upon completion. The service |
78 // acquires a reference to the 'collection' until until completion. | 78 // acquires a reference to the 'collection' until until completion. |
79 // This method always completes asynchronously. | 79 // This method always completes asynchronously. |
80 void GetAllAppCacheInfo(AppCacheInfoCollection* collection, | 80 void GetAllAppCacheInfo(AppCacheInfoCollection* collection, |
81 net::OldCompletionCallback* callback); | 81 net::OldCompletionCallback* callback); |
82 | 82 |
83 // Deletes the group identified by 'manifest_url', 'callback' is | 83 // Deletes the group identified by 'manifest_url', 'callback' is |
84 // invoked upon completion. Upon completion, the cache group and | 84 // invoked upon completion. Upon completion, the cache group and |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 bool clear_local_state_on_exit() const { return clear_local_state_on_exit_; } | 143 bool clear_local_state_on_exit() const { return clear_local_state_on_exit_; } |
144 void set_clear_local_state_on_exit(bool clear_local_state_on_exit) { | 144 void set_clear_local_state_on_exit(bool clear_local_state_on_exit) { |
145 clear_local_state_on_exit_ = clear_local_state_on_exit; } | 145 clear_local_state_on_exit_ = clear_local_state_on_exit; } |
146 | 146 |
147 protected: | 147 protected: |
148 friend class AppCacheStorageImplTest; | 148 friend class AppCacheStorageImplTest; |
149 friend class AppCacheServiceTest; | 149 friend class AppCacheServiceTest; |
150 | 150 |
151 class AsyncHelper; | 151 class AsyncHelper; |
| 152 class NewAsyncHelper; |
152 class CanHandleOfflineHelper; | 153 class CanHandleOfflineHelper; |
153 class DeleteHelper; | 154 class DeleteHelper; |
154 class DeleteOriginHelper; | 155 class DeleteOriginHelper; |
155 class GetInfoHelper; | 156 class GetInfoHelper; |
156 class CheckResponseHelper; | 157 class CheckResponseHelper; |
157 | 158 |
158 typedef std::set<AsyncHelper*> PendingAsyncHelpers; | 159 typedef std::set<AsyncHelper*> PendingAsyncHelpers; |
| 160 typedef std::set<NewAsyncHelper*> PendingNewAsyncHelpers; |
159 typedef std::map<int, AppCacheBackendImpl*> BackendMap; | 161 typedef std::map<int, AppCacheBackendImpl*> BackendMap; |
160 | 162 |
161 AppCachePolicy* appcache_policy_; | 163 AppCachePolicy* appcache_policy_; |
162 AppCacheQuotaClient* quota_client_; | 164 AppCacheQuotaClient* quota_client_; |
163 scoped_ptr<AppCacheStorage> storage_; | 165 scoped_ptr<AppCacheStorage> storage_; |
164 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 166 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
165 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 167 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
166 PendingAsyncHelpers pending_helpers_; | 168 PendingAsyncHelpers pending_helpers_; |
| 169 PendingNewAsyncHelpers pending_new_helpers_; |
167 BackendMap backends_; // One 'backend' per child process. | 170 BackendMap backends_; // One 'backend' per child process. |
168 // Context for use during cache updates. | 171 // Context for use during cache updates. |
169 net::URLRequestContext* request_context_; | 172 net::URLRequestContext* request_context_; |
170 bool clear_local_state_on_exit_; | 173 bool clear_local_state_on_exit_; |
171 | 174 |
172 DISALLOW_COPY_AND_ASSIGN(AppCacheService); | 175 DISALLOW_COPY_AND_ASSIGN(AppCacheService); |
173 }; | 176 }; |
174 | 177 |
175 } // namespace appcache | 178 } // namespace appcache |
176 | 179 |
177 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 180 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
OLD | NEW |