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_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 void CanHandleMainResourceOffline(const GURL& url, | |
|
oshima
2011/01/23 15:24:18
Comment?
michaeln
2011/01/24 20:38:34
Done.
| |
| 62 net::CompletionCallback* callback); | |
| 63 | |
| 61 // Populates 'collection' with info about all of the appcaches stored | 64 // Populates 'collection' with info about all of the appcaches stored |
| 62 // within the service, 'callback' is invoked upon completion. The service | 65 // within the service, 'callback' is invoked upon completion. The service |
| 63 // acquires a reference to the 'collection' until until completion. | 66 // acquires a reference to the 'collection' until until completion. |
| 64 // This method always completes asynchronously. | 67 // This method always completes asynchronously. |
| 65 void GetAllAppCacheInfo(AppCacheInfoCollection* collection, | 68 void GetAllAppCacheInfo(AppCacheInfoCollection* collection, |
| 66 net::CompletionCallback* callback); | 69 net::CompletionCallback* callback); |
| 67 | 70 |
| 68 // Deletes the group identified by 'manifest_url', 'callback' is | 71 // Deletes the group identified by 'manifest_url', 'callback' is |
| 69 // invoked upon completion. Upon completion, the cache group and | 72 // invoked upon completion. Upon completion, the cache group and |
| 70 // any resources within the group are no longer loadable and all | 73 // any resources within the group are no longer loadable and all |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 96 void UnregisterBackend(AppCacheBackendImpl* backend_impl); | 99 void UnregisterBackend(AppCacheBackendImpl* backend_impl); |
| 97 AppCacheBackendImpl* GetBackend(int id) const { | 100 AppCacheBackendImpl* GetBackend(int id) const { |
| 98 BackendMap::const_iterator it = backends_.find(id); | 101 BackendMap::const_iterator it = backends_.find(id); |
| 99 return (it != backends_.end()) ? it->second : NULL; | 102 return (it != backends_.end()) ? it->second : NULL; |
| 100 } | 103 } |
| 101 | 104 |
| 102 AppCacheStorage* storage() const { return storage_.get(); } | 105 AppCacheStorage* storage() const { return storage_.get(); } |
| 103 | 106 |
| 104 protected: | 107 protected: |
| 105 class AsyncHelper; | 108 class AsyncHelper; |
| 109 class CanHandleOfflineHelper; | |
| 106 class DeleteHelper; | 110 class DeleteHelper; |
| 107 class GetInfoHelper; | 111 class GetInfoHelper; |
| 108 | 112 |
| 109 typedef std::set<AsyncHelper*> PendingAsyncHelpers; | 113 typedef std::set<AsyncHelper*> PendingAsyncHelpers; |
| 110 typedef std::map<int, AppCacheBackendImpl*> BackendMap; | 114 typedef std::map<int, AppCacheBackendImpl*> BackendMap; |
| 111 | 115 |
| 112 AppCachePolicy* appcache_policy_; | 116 AppCachePolicy* appcache_policy_; |
| 113 scoped_ptr<AppCacheStorage> storage_; | 117 scoped_ptr<AppCacheStorage> storage_; |
| 114 PendingAsyncHelpers pending_helpers_; | 118 PendingAsyncHelpers pending_helpers_; |
| 115 BackendMap backends_; // One 'backend' per child process. | 119 BackendMap backends_; // One 'backend' per child process. |
| 116 // Context for use during cache updates. | 120 // Context for use during cache updates. |
| 117 net::URLRequestContext* request_context_; | 121 net::URLRequestContext* request_context_; |
| 118 | 122 |
| 119 DISALLOW_COPY_AND_ASSIGN(AppCacheService); | 123 DISALLOW_COPY_AND_ASSIGN(AppCacheService); |
| 120 }; | 124 }; |
| 121 | 125 |
| 122 } // namespace appcache | 126 } // namespace appcache |
| 123 | 127 |
| 124 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 128 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| OLD | NEW |