| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 class AppCacheQuotaClient; | 43 class AppCacheQuotaClient; |
| 44 class AppCachePolicy; | 44 class AppCachePolicy; |
| 45 class AppCacheServiceImplTest; | 45 class AppCacheServiceImplTest; |
| 46 class AppCacheStorageImplTest; | 46 class AppCacheStorageImplTest; |
| 47 class AppCacheStorage; | 47 class AppCacheStorage; |
| 48 | 48 |
| 49 // Refcounted container to manage the lifetime of the old storage instance | 49 // Refcounted container to manage the lifetime of the old storage instance |
| 50 // during Reinitialization. | 50 // during Reinitialization. |
| 51 class CONTENT_EXPORT AppCacheStorageReference | 51 class CONTENT_EXPORT AppCacheStorageReference |
| 52 : public base::RefCounted<AppCacheStorageReference> { | 52 : public base::RefCounted<AppCacheStorageReference> { |
| 53 public: | 53 public: |
| 54 AppCacheStorage* storage() const { return storage_.get(); } | 54 AppCacheStorage* storage() const { return storage_.get(); } |
| 55 private: | 55 |
| 56 private: |
| 56 friend class AppCacheServiceImpl; | 57 friend class AppCacheServiceImpl; |
| 57 friend class base::RefCounted<AppCacheStorageReference>; | 58 friend class base::RefCounted<AppCacheStorageReference>; |
| 58 AppCacheStorageReference(std::unique_ptr<AppCacheStorage> storage); | 59 AppCacheStorageReference(std::unique_ptr<AppCacheStorage> storage); |
| 59 ~AppCacheStorageReference(); | 60 ~AppCacheStorageReference(); |
| 60 | 61 |
| 61 std::unique_ptr<AppCacheStorage> storage_; | 62 std::unique_ptr<AppCacheStorage> storage_; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 // Class that manages the application cache service. Sends notifications | 65 // Class that manages the application cache service. Sends notifications |
| 65 // to many frontends. One instance per user-profile. Each instance has | 66 // to many frontends. One instance per user-profile. Each instance has |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 AppCacheStorageReference* old_storage_ref) {} | 82 AppCacheStorageReference* old_storage_ref) {} |
| 82 virtual ~Observer() {} | 83 virtual ~Observer() {} |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 // If not using quota management, the proxy may be NULL. | 86 // If not using quota management, the proxy may be NULL. |
| 86 explicit AppCacheServiceImpl(storage::QuotaManagerProxy* quota_manager_proxy); | 87 explicit AppCacheServiceImpl(storage::QuotaManagerProxy* quota_manager_proxy); |
| 87 ~AppCacheServiceImpl() override; | 88 ~AppCacheServiceImpl() override; |
| 88 | 89 |
| 89 void Initialize( | 90 void Initialize( |
| 90 const base::FilePath& cache_directory, | 91 const base::FilePath& cache_directory, |
| 91 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | |
| 92 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread); | 92 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread); |
| 93 | 93 |
| 94 void AddObserver(Observer* observer) { | 94 void AddObserver(Observer* observer) { |
| 95 observers_.AddObserver(observer); | 95 observers_.AddObserver(observer); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void RemoveObserver(Observer* observer) { | 98 void RemoveObserver(Observer* observer) { |
| 99 observers_.RemoveObserver(observer); | 99 observers_.RemoveObserver(observer); |
| 100 } | 100 } |
| 101 | 101 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 class GetInfoHelper; | 194 class GetInfoHelper; |
| 195 class CheckResponseHelper; | 195 class CheckResponseHelper; |
| 196 | 196 |
| 197 using PendingAsyncHelpers = | 197 using PendingAsyncHelpers = |
| 198 std::map<AsyncHelper*, std::unique_ptr<AsyncHelper>>; | 198 std::map<AsyncHelper*, std::unique_ptr<AsyncHelper>>; |
| 199 using BackendMap = std::map<int, AppCacheBackendImpl*>; | 199 using BackendMap = std::map<int, AppCacheBackendImpl*>; |
| 200 | 200 |
| 201 void Reinitialize(); | 201 void Reinitialize(); |
| 202 | 202 |
| 203 base::FilePath cache_directory_; | 203 base::FilePath cache_directory_; |
| 204 scoped_refptr<base::SingleThreadTaskRunner> db_thread_; | 204 scoped_refptr<base::SequencedTaskRunner> db_task_runner_; |
| 205 scoped_refptr<base::SingleThreadTaskRunner> cache_thread_; | 205 scoped_refptr<base::SingleThreadTaskRunner> cache_thread_; |
| 206 AppCachePolicy* appcache_policy_; | 206 AppCachePolicy* appcache_policy_; |
| 207 AppCacheQuotaClient* quota_client_; | 207 AppCacheQuotaClient* quota_client_; |
| 208 AppCacheExecutableHandlerFactory* handler_factory_; | 208 AppCacheExecutableHandlerFactory* handler_factory_; |
| 209 std::unique_ptr<AppCacheStorage> storage_; | 209 std::unique_ptr<AppCacheStorage> storage_; |
| 210 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; | 210 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; |
| 211 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; | 211 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; |
| 212 PendingAsyncHelpers pending_helpers_; | 212 PendingAsyncHelpers pending_helpers_; |
| 213 BackendMap backends_; // One 'backend' per child process. | 213 BackendMap backends_; // One 'backend' per child process. |
| 214 // Context for use during cache updates. | 214 // Context for use during cache updates. |
| 215 net::URLRequestContext* request_context_; | 215 net::URLRequestContext* request_context_; |
| 216 // If true, nothing (not even session-only data) should be deleted on exit. | 216 // If true, nothing (not even session-only data) should be deleted on exit. |
| 217 bool force_keep_session_state_; | 217 bool force_keep_session_state_; |
| 218 base::Time last_reinit_time_; | 218 base::Time last_reinit_time_; |
| 219 base::TimeDelta next_reinit_delay_; | 219 base::TimeDelta next_reinit_delay_; |
| 220 base::OneShotTimer reinit_timer_; | 220 base::OneShotTimer reinit_timer_; |
| 221 base::ObserverList<Observer> observers_; | 221 base::ObserverList<Observer> observers_; |
| 222 | 222 |
| 223 private: | 223 private: |
| 224 base::WeakPtrFactory<AppCacheServiceImpl> weak_factory_; | 224 base::WeakPtrFactory<AppCacheServiceImpl> weak_factory_; |
| 225 | 225 |
| 226 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); | 226 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 } // namespace content | 229 } // namespace content |
| 230 | 230 |
| 231 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 231 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
| OLD | NEW |