| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 void Initialize(const FilePath& cache_directory, | 52 void Initialize(const FilePath& cache_directory, |
| 53 base::MessageLoopProxy* cache_thread); | 53 base::MessageLoopProxy* cache_thread); |
| 54 | 54 |
| 55 // Purges any memory not needed. | 55 // Purges any memory not needed. |
| 56 void PurgeMemory() { | 56 void PurgeMemory() { |
| 57 if (storage_.get()) | 57 if (storage_.get()) |
| 58 storage_->PurgeMemory(); | 58 storage_->PurgeMemory(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Determines if a request for 'url' can be satisfied while offline. |
| 62 // This method always completes asynchronously. |
| 63 void CanHandleMainResourceOffline(const GURL& url, |
| 64 net::CompletionCallback* callback); |
| 65 |
| 61 // Populates 'collection' with info about all of the appcaches stored | 66 // Populates 'collection' with info about all of the appcaches stored |
| 62 // within the service, 'callback' is invoked upon completion. The service | 67 // within the service, 'callback' is invoked upon completion. The service |
| 63 // acquires a reference to the 'collection' until until completion. | 68 // acquires a reference to the 'collection' until until completion. |
| 64 // This method always completes asynchronously. | 69 // This method always completes asynchronously. |
| 65 void GetAllAppCacheInfo(AppCacheInfoCollection* collection, | 70 void GetAllAppCacheInfo(AppCacheInfoCollection* collection, |
| 66 net::CompletionCallback* callback); | 71 net::CompletionCallback* callback); |
| 67 | 72 |
| 68 // Deletes the group identified by 'manifest_url', 'callback' is | 73 // Deletes the group identified by 'manifest_url', 'callback' is |
| 69 // invoked upon completion. Upon completion, the cache group and | 74 // invoked upon completion. Upon completion, the cache group and |
| 70 // any resources within the group are no longer loadable and all | 75 // any resources within the group are no longer loadable and all |
| (...skipping 25 matching lines...) Expand all Loading... |
| 96 void UnregisterBackend(AppCacheBackendImpl* backend_impl); | 101 void UnregisterBackend(AppCacheBackendImpl* backend_impl); |
| 97 AppCacheBackendImpl* GetBackend(int id) const { | 102 AppCacheBackendImpl* GetBackend(int id) const { |
| 98 BackendMap::const_iterator it = backends_.find(id); | 103 BackendMap::const_iterator it = backends_.find(id); |
| 99 return (it != backends_.end()) ? it->second : NULL; | 104 return (it != backends_.end()) ? it->second : NULL; |
| 100 } | 105 } |
| 101 | 106 |
| 102 AppCacheStorage* storage() const { return storage_.get(); } | 107 AppCacheStorage* storage() const { return storage_.get(); } |
| 103 | 108 |
| 104 protected: | 109 protected: |
| 105 class AsyncHelper; | 110 class AsyncHelper; |
| 111 class CanHandleOfflineHelper; |
| 106 class DeleteHelper; | 112 class DeleteHelper; |
| 107 class GetInfoHelper; | 113 class GetInfoHelper; |
| 108 | 114 |
| 109 typedef std::set<AsyncHelper*> PendingAsyncHelpers; | 115 typedef std::set<AsyncHelper*> PendingAsyncHelpers; |
| 110 typedef std::map<int, AppCacheBackendImpl*> BackendMap; | 116 typedef std::map<int, AppCacheBackendImpl*> BackendMap; |
| 111 | 117 |
| 112 AppCachePolicy* appcache_policy_; | 118 AppCachePolicy* appcache_policy_; |
| 113 scoped_ptr<AppCacheStorage> storage_; | 119 scoped_ptr<AppCacheStorage> storage_; |
| 114 PendingAsyncHelpers pending_helpers_; | 120 PendingAsyncHelpers pending_helpers_; |
| 115 BackendMap backends_; // One 'backend' per child process. | 121 BackendMap backends_; // One 'backend' per child process. |
| 116 // Context for use during cache updates. | 122 // Context for use during cache updates. |
| 117 net::URLRequestContext* request_context_; | 123 net::URLRequestContext* request_context_; |
| 118 | 124 |
| 119 DISALLOW_COPY_AND_ASSIGN(AppCacheService); | 125 DISALLOW_COPY_AND_ASSIGN(AppCacheService); |
| 120 }; | 126 }; |
| 121 | 127 |
| 122 } // namespace appcache | 128 } // namespace appcache |
| 123 | 129 |
| 124 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 130 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| OLD | NEW |