OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class FilePath; | 25 class FilePath; |
26 class SingleThreadTaskRunner; | 26 class SingleThreadTaskRunner; |
27 } // namespace base | 27 } // namespace base |
28 | 28 |
29 namespace net { | 29 namespace net { |
30 class URLRequestContext; | 30 class URLRequestContext; |
31 } // namespace net | 31 } // namespace net |
32 | 32 |
33 namespace quota { | 33 namespace storage { |
34 class SpecialStoragePolicy; | 34 class SpecialStoragePolicy; |
35 } // namespace quota | 35 } // namespace storage |
36 | 36 |
37 namespace content { | 37 namespace content { |
38 FORWARD_DECLARE_TEST(AppCacheServiceImplTest, ScheduleReinitialize); | 38 FORWARD_DECLARE_TEST(AppCacheServiceImplTest, ScheduleReinitialize); |
39 class AppCacheBackendImpl; | 39 class AppCacheBackendImpl; |
40 class AppCacheExecutableHandlerFactory; | 40 class AppCacheExecutableHandlerFactory; |
41 class AppCacheQuotaClient; | 41 class AppCacheQuotaClient; |
42 class AppCachePolicy; | 42 class AppCachePolicy; |
43 class AppCacheServiceImplTest; | 43 class AppCacheServiceImplTest; |
44 class AppCacheStorageImplTest; | 44 class AppCacheStorageImplTest; |
45 class AppCacheStorage; | 45 class AppCacheStorage; |
(...skipping 25 matching lines...) Expand all Loading... |
71 // An observer method to inform consumers of reinitialzation. Managing | 71 // An observer method to inform consumers of reinitialzation. Managing |
72 // the lifetime of the old storage instance is a delicate process. | 72 // the lifetime of the old storage instance is a delicate process. |
73 // Consumers can keep the old disabled instance alive by hanging on to the | 73 // Consumers can keep the old disabled instance alive by hanging on to the |
74 // ref provided. | 74 // ref provided. |
75 virtual void OnServiceReinitialized( | 75 virtual void OnServiceReinitialized( |
76 AppCacheStorageReference* old_storage_ref) = 0; | 76 AppCacheStorageReference* old_storage_ref) = 0; |
77 virtual ~Observer() {} | 77 virtual ~Observer() {} |
78 }; | 78 }; |
79 | 79 |
80 // If not using quota management, the proxy may be NULL. | 80 // If not using quota management, the proxy may be NULL. |
81 explicit AppCacheServiceImpl(quota::QuotaManagerProxy* quota_manager_proxy); | 81 explicit AppCacheServiceImpl(storage::QuotaManagerProxy* quota_manager_proxy); |
82 virtual ~AppCacheServiceImpl(); | 82 virtual ~AppCacheServiceImpl(); |
83 | 83 |
84 void Initialize( | 84 void Initialize( |
85 const base::FilePath& cache_directory, | 85 const base::FilePath& cache_directory, |
86 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 86 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
87 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread); | 87 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread); |
88 | 88 |
89 void AddObserver(Observer* observer) { | 89 void AddObserver(Observer* observer) { |
90 observers_.AddObserver(observer); | 90 observers_.AddObserver(observer); |
91 } | 91 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // The service does NOT assume ownership of the factory, it is the callers | 143 // The service does NOT assume ownership of the factory, it is the callers |
144 // responsibility to ensure that the pointer remains valid while set. | 144 // responsibility to ensure that the pointer remains valid while set. |
145 AppCacheExecutableHandlerFactory* handler_factory() const { | 145 AppCacheExecutableHandlerFactory* handler_factory() const { |
146 return handler_factory_; | 146 return handler_factory_; |
147 } | 147 } |
148 void set_handler_factory( | 148 void set_handler_factory( |
149 AppCacheExecutableHandlerFactory* factory) { | 149 AppCacheExecutableHandlerFactory* factory) { |
150 handler_factory_ = factory; | 150 handler_factory_ = factory; |
151 } | 151 } |
152 | 152 |
153 quota::SpecialStoragePolicy* special_storage_policy() const { | 153 storage::SpecialStoragePolicy* special_storage_policy() const { |
154 return special_storage_policy_.get(); | 154 return special_storage_policy_.get(); |
155 } | 155 } |
156 void set_special_storage_policy(quota::SpecialStoragePolicy* policy); | 156 void set_special_storage_policy(storage::SpecialStoragePolicy* policy); |
157 | 157 |
158 quota::QuotaManagerProxy* quota_manager_proxy() const { | 158 storage::QuotaManagerProxy* quota_manager_proxy() const { |
159 return quota_manager_proxy_.get(); | 159 return quota_manager_proxy_.get(); |
160 } | 160 } |
161 | 161 |
162 AppCacheQuotaClient* quota_client() const { | 162 AppCacheQuotaClient* quota_client() const { |
163 return quota_client_; | 163 return quota_client_; |
164 } | 164 } |
165 | 165 |
166 // Each child process in chrome uses a distinct backend instance. | 166 // Each child process in chrome uses a distinct backend instance. |
167 // See chrome/browser/AppCacheDispatcherHost. | 167 // See chrome/browser/AppCacheDispatcherHost. |
168 void RegisterBackend(AppCacheBackendImpl* backend_impl); | 168 void RegisterBackend(AppCacheBackendImpl* backend_impl); |
(...skipping 27 matching lines...) Expand all Loading... |
196 | 196 |
197 void Reinitialize(); | 197 void Reinitialize(); |
198 | 198 |
199 base::FilePath cache_directory_; | 199 base::FilePath cache_directory_; |
200 scoped_refptr<base::SingleThreadTaskRunner> db_thread_; | 200 scoped_refptr<base::SingleThreadTaskRunner> db_thread_; |
201 scoped_refptr<base::SingleThreadTaskRunner> cache_thread_; | 201 scoped_refptr<base::SingleThreadTaskRunner> cache_thread_; |
202 AppCachePolicy* appcache_policy_; | 202 AppCachePolicy* appcache_policy_; |
203 AppCacheQuotaClient* quota_client_; | 203 AppCacheQuotaClient* quota_client_; |
204 AppCacheExecutableHandlerFactory* handler_factory_; | 204 AppCacheExecutableHandlerFactory* handler_factory_; |
205 scoped_ptr<AppCacheStorage> storage_; | 205 scoped_ptr<AppCacheStorage> storage_; |
206 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 206 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; |
207 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 207 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; |
208 PendingAsyncHelpers pending_helpers_; | 208 PendingAsyncHelpers pending_helpers_; |
209 BackendMap backends_; // One 'backend' per child process. | 209 BackendMap backends_; // One 'backend' per child process. |
210 // Context for use during cache updates. | 210 // Context for use during cache updates. |
211 net::URLRequestContext* request_context_; | 211 net::URLRequestContext* request_context_; |
212 // If true, nothing (not even session-only data) should be deleted on exit. | 212 // If true, nothing (not even session-only data) should be deleted on exit. |
213 bool force_keep_session_state_; | 213 bool force_keep_session_state_; |
214 base::Time last_reinit_time_; | 214 base::Time last_reinit_time_; |
215 base::TimeDelta next_reinit_delay_; | 215 base::TimeDelta next_reinit_delay_; |
216 base::OneShotTimer<AppCacheServiceImpl> reinit_timer_; | 216 base::OneShotTimer<AppCacheServiceImpl> reinit_timer_; |
217 ObserverList<Observer> observers_; | 217 ObserverList<Observer> observers_; |
218 | 218 |
219 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); | 219 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); |
220 }; | 220 }; |
221 | 221 |
222 } // namespace content | 222 } // namespace content |
223 | 223 |
224 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 224 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
OLD | NEW |