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> |
| 11 #include <memory> |
11 #include <set> | 12 #include <set> |
12 | 13 |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
20 #include "content/common/appcache_interfaces.h" | 20 #include "content/common/appcache_interfaces.h" |
21 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
22 #include "content/public/browser/appcache_service.h" | 22 #include "content/public/browser/appcache_service.h" |
23 #include "net/base/completion_callback.h" | 23 #include "net/base/completion_callback.h" |
24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
25 #include "storage/browser/quota/quota_manager_proxy.h" | 25 #include "storage/browser/quota/quota_manager_proxy.h" |
26 | 26 |
(...skipping 22 matching lines...) Expand all Loading... |
49 | 49 |
50 // Refcounted container to manage the lifetime of the old storage instance | 50 // Refcounted container to manage the lifetime of the old storage instance |
51 // during Reinitialization. | 51 // during Reinitialization. |
52 class CONTENT_EXPORT AppCacheStorageReference | 52 class CONTENT_EXPORT AppCacheStorageReference |
53 : public base::RefCounted<AppCacheStorageReference> { | 53 : public base::RefCounted<AppCacheStorageReference> { |
54 public: | 54 public: |
55 AppCacheStorage* storage() const { return storage_.get(); } | 55 AppCacheStorage* storage() const { return storage_.get(); } |
56 private: | 56 private: |
57 friend class AppCacheServiceImpl; | 57 friend class AppCacheServiceImpl; |
58 friend class base::RefCounted<AppCacheStorageReference>; | 58 friend class base::RefCounted<AppCacheStorageReference>; |
59 AppCacheStorageReference(scoped_ptr<AppCacheStorage> storage); | 59 AppCacheStorageReference(std::unique_ptr<AppCacheStorage> storage); |
60 ~AppCacheStorageReference(); | 60 ~AppCacheStorageReference(); |
61 | 61 |
62 scoped_ptr<AppCacheStorage> storage_; | 62 std::unique_ptr<AppCacheStorage> storage_; |
63 }; | 63 }; |
64 | 64 |
65 // Class that manages the application cache service. Sends notifications | 65 // Class that manages the application cache service. Sends notifications |
66 // to many frontends. One instance per user-profile. Each instance has | 66 // to many frontends. One instance per user-profile. Each instance has |
67 // exclusive access to its cache_directory on disk. | 67 // exclusive access to its cache_directory on disk. |
68 class CONTENT_EXPORT AppCacheServiceImpl | 68 class CONTENT_EXPORT AppCacheServiceImpl |
69 : public AppCacheService { | 69 : public AppCacheService { |
70 public: | 70 public: |
71 | 71 |
72 class CONTENT_EXPORT Observer { | 72 class CONTENT_EXPORT Observer { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 typedef std::map<int, AppCacheBackendImpl*> BackendMap; | 196 typedef std::map<int, AppCacheBackendImpl*> BackendMap; |
197 | 197 |
198 void Reinitialize(); | 198 void Reinitialize(); |
199 | 199 |
200 base::FilePath cache_directory_; | 200 base::FilePath cache_directory_; |
201 scoped_refptr<base::SingleThreadTaskRunner> db_thread_; | 201 scoped_refptr<base::SingleThreadTaskRunner> db_thread_; |
202 scoped_refptr<base::SingleThreadTaskRunner> cache_thread_; | 202 scoped_refptr<base::SingleThreadTaskRunner> cache_thread_; |
203 AppCachePolicy* appcache_policy_; | 203 AppCachePolicy* appcache_policy_; |
204 AppCacheQuotaClient* quota_client_; | 204 AppCacheQuotaClient* quota_client_; |
205 AppCacheExecutableHandlerFactory* handler_factory_; | 205 AppCacheExecutableHandlerFactory* handler_factory_; |
206 scoped_ptr<AppCacheStorage> storage_; | 206 std::unique_ptr<AppCacheStorage> storage_; |
207 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; | 207 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; |
208 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; | 208 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; |
209 PendingAsyncHelpers pending_helpers_; | 209 PendingAsyncHelpers pending_helpers_; |
210 BackendMap backends_; // One 'backend' per child process. | 210 BackendMap backends_; // One 'backend' per child process. |
211 // Context for use during cache updates. | 211 // Context for use during cache updates. |
212 net::URLRequestContext* request_context_; | 212 net::URLRequestContext* request_context_; |
213 // If true, nothing (not even session-only data) should be deleted on exit. | 213 // If true, nothing (not even session-only data) should be deleted on exit. |
214 bool force_keep_session_state_; | 214 bool force_keep_session_state_; |
215 base::Time last_reinit_time_; | 215 base::Time last_reinit_time_; |
216 base::TimeDelta next_reinit_delay_; | 216 base::TimeDelta next_reinit_delay_; |
217 base::OneShotTimer reinit_timer_; | 217 base::OneShotTimer reinit_timer_; |
218 base::ObserverList<Observer> observers_; | 218 base::ObserverList<Observer> observers_; |
219 | 219 |
220 private: | 220 private: |
221 base::WeakPtrFactory<AppCacheServiceImpl> weak_factory_; | 221 base::WeakPtrFactory<AppCacheServiceImpl> weak_factory_; |
222 | 222 |
223 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); | 223 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); |
224 }; | 224 }; |
225 | 225 |
226 } // namespace content | 226 } // namespace content |
227 | 227 |
228 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 228 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
OLD | NEW |