| 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 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 const net::CompletionCallback& callback); | 92 const net::CompletionCallback& callback); |
| 93 | 93 |
| 94 // Deletes all appcaches for the origin, 'callback' is invoked upon | 94 // Deletes all appcaches for the origin, 'callback' is invoked upon |
| 95 // completion. This method always completes asynchronously. | 95 // completion. This method always completes asynchronously. |
| 96 // (virtual for unit testing) | 96 // (virtual for unit testing) |
| 97 virtual void DeleteAppCachesForOrigin( | 97 virtual void DeleteAppCachesForOrigin( |
| 98 const GURL& origin, const net::CompletionCallback& callback); | 98 const GURL& origin, const net::CompletionCallback& callback); |
| 99 | 99 |
| 100 // Checks the integrity of 'response_id' by reading the headers and data. | 100 // Checks the integrity of 'response_id' by reading the headers and data. |
| 101 // If it cannot be read, the cache group for 'manifest_url' is deleted. | 101 // If it cannot be read, the cache group for 'manifest_url' is deleted. |
| 102 void CheckAppCacheResponse(const GURL& manifest_url_, int64 cache_id, | 102 void CheckAppCacheResponse(const GURL& manifest_url, int64 cache_id, |
| 103 int64 response_id); | 103 int64 response_id); |
| 104 | 104 |
| 105 // Context for use during cache updates, should only be accessed | 105 // Context for use during cache updates, should only be accessed |
| 106 // on the IO thread. We do NOT add a reference to the request context, | 106 // on the IO thread. We do NOT add a reference to the request context, |
| 107 // it is the callers responsibility to ensure that the pointer | 107 // it is the callers responsibility to ensure that the pointer |
| 108 // remains valid while set. | 108 // remains valid while set. |
| 109 net::URLRequestContext* request_context() const { return request_context_; } | 109 net::URLRequestContext* request_context() const { return request_context_; } |
| 110 void set_request_context(net::URLRequestContext* context) { | 110 void set_request_context(net::URLRequestContext* context) { |
| 111 request_context_ = context; | 111 request_context_ = context; |
| 112 } | 112 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // data (also session-only data). | 152 // data (also session-only data). |
| 153 void set_save_session_state(bool save_session_state) { | 153 void set_save_session_state(bool save_session_state) { |
| 154 save_session_state_ = save_session_state; | 154 save_session_state_ = save_session_state; |
| 155 } | 155 } |
| 156 | 156 |
| 157 protected: | 157 protected: |
| 158 friend class AppCacheStorageImplTest; | 158 friend class AppCacheStorageImplTest; |
| 159 friend class AppCacheServiceTest; | 159 friend class AppCacheServiceTest; |
| 160 | 160 |
| 161 class AsyncHelper; | 161 class AsyncHelper; |
| 162 class NewAsyncHelper; | |
| 163 class CanHandleOfflineHelper; | 162 class CanHandleOfflineHelper; |
| 164 class DeleteHelper; | 163 class DeleteHelper; |
| 165 class DeleteOriginHelper; | 164 class DeleteOriginHelper; |
| 166 class GetInfoHelper; | 165 class GetInfoHelper; |
| 167 class CheckResponseHelper; | 166 class CheckResponseHelper; |
| 168 | 167 |
| 169 typedef std::set<AsyncHelper*> PendingAsyncHelpers; | 168 typedef std::set<AsyncHelper*> PendingAsyncHelpers; |
| 170 typedef std::set<NewAsyncHelper*> PendingNewAsyncHelpers; | |
| 171 typedef std::map<int, AppCacheBackendImpl*> BackendMap; | 169 typedef std::map<int, AppCacheBackendImpl*> BackendMap; |
| 172 | 170 |
| 173 AppCachePolicy* appcache_policy_; | 171 AppCachePolicy* appcache_policy_; |
| 174 AppCacheQuotaClient* quota_client_; | 172 AppCacheQuotaClient* quota_client_; |
| 175 scoped_ptr<AppCacheStorage> storage_; | 173 scoped_ptr<AppCacheStorage> storage_; |
| 176 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 174 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
| 177 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 175 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 178 PendingAsyncHelpers pending_helpers_; | 176 PendingAsyncHelpers pending_helpers_; |
| 179 PendingNewAsyncHelpers pending_new_helpers_; | |
| 180 BackendMap backends_; // One 'backend' per child process. | 177 BackendMap backends_; // One 'backend' per child process. |
| 181 // Context for use during cache updates. | 178 // Context for use during cache updates. |
| 182 net::URLRequestContext* request_context_; | 179 net::URLRequestContext* request_context_; |
| 183 bool clear_local_state_on_exit_; | 180 bool clear_local_state_on_exit_; |
| 184 // If true, nothing (not even session-only data) should be deleted on exit. | 181 // If true, nothing (not even session-only data) should be deleted on exit. |
| 185 bool save_session_state_; | 182 bool save_session_state_; |
| 186 | 183 |
| 187 DISALLOW_COPY_AND_ASSIGN(AppCacheService); | 184 DISALLOW_COPY_AND_ASSIGN(AppCacheService); |
| 188 }; | 185 }; |
| 189 | 186 |
| 190 } // namespace appcache | 187 } // namespace appcache |
| 191 | 188 |
| 192 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 189 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| OLD | NEW |