| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROME_APPCACHE_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 6 #define CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/sequenced_task_runner_helpers.h" | 10 #include "base/sequenced_task_runner_helpers.h" |
| 11 #include "content/browser/appcache/appcache_policy.h" |
| 12 #include "content/browser/appcache/appcache_service_impl.h" |
| 11 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 12 #include "webkit/browser/appcache/appcache_policy.h" | |
| 13 #include "webkit/browser/appcache/appcache_service_impl.h" | |
| 14 #include "webkit/browser/quota/special_storage_policy.h" | 14 #include "webkit/browser/quota/special_storage_policy.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class FilePath; | 17 class FilePath; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 class ResourceContext; | 25 class ResourceContext; |
| 26 | 26 |
| 27 struct ChromeAppCacheServiceDeleter; | 27 struct ChromeAppCacheServiceDeleter; |
| 28 | 28 |
| 29 // An AppCacheServiceImpl subclass used by the chrome. There is an instance | 29 // An AppCacheServiceImpl subclass used by the chrome. There is an instance |
| 30 // associated with each BrowserContext. This derivation adds refcounting | 30 // associated with each BrowserContext. This derivation adds refcounting |
| 31 // semantics since a browser context has multiple URLRequestContexts which refer | 31 // semantics since a browser context has multiple URLRequestContexts which refer |
| 32 // to the same object, and those URLRequestContexts are refcounted independently | 32 // to the same object, and those URLRequestContexts are refcounted independently |
| 33 // of the owning browser context. | 33 // of the owning browser context. |
| 34 // | 34 // |
| 35 // All methods, except the ctor, are expected to be called on | 35 // All methods, except the ctor, are expected to be called on |
| 36 // the IO thread (unless specifically called out in doc comments). | 36 // the IO thread (unless specifically called out in doc comments). |
| 37 // | 37 // |
| 38 // TODO(dpranke): Fix dependencies on AppCacheServiceImpl so that we don't have | 38 // TODO(dpranke): Fix dependencies on AppCacheServiceImpl so that we don't have |
| 39 // to worry about clients calling AppCacheServiceImpl methods. | 39 // to worry about clients calling AppCacheServiceImpl methods. |
| 40 class CONTENT_EXPORT ChromeAppCacheService | 40 class CONTENT_EXPORT ChromeAppCacheService |
| 41 : public base::RefCountedThreadSafe<ChromeAppCacheService, | 41 : public base::RefCountedThreadSafe<ChromeAppCacheService, |
| 42 ChromeAppCacheServiceDeleter>, | 42 ChromeAppCacheServiceDeleter>, |
| 43 NON_EXPORTED_BASE(public appcache::AppCacheServiceImpl), | 43 NON_EXPORTED_BASE(public AppCacheServiceImpl), |
| 44 NON_EXPORTED_BASE(public appcache::AppCachePolicy) { | 44 NON_EXPORTED_BASE(public AppCachePolicy) { |
| 45 public: | 45 public: |
| 46 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); | 46 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); |
| 47 | 47 |
| 48 // If |cache_path| is empty we will use in-memory structs. | 48 // If |cache_path| is empty we will use in-memory structs. |
| 49 void InitializeOnIOThread( | 49 void InitializeOnIOThread( |
| 50 const base::FilePath& cache_path, | 50 const base::FilePath& cache_path, |
| 51 ResourceContext* resource_context, | 51 ResourceContext* resource_context, |
| 52 net::URLRequestContextGetter* request_context_getter, | 52 net::URLRequestContextGetter* request_context_getter, |
| 53 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); | 53 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); |
| 54 | 54 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 | 77 |
| 78 struct ChromeAppCacheServiceDeleter { | 78 struct ChromeAppCacheServiceDeleter { |
| 79 static void Destruct(const ChromeAppCacheService* service) { | 79 static void Destruct(const ChromeAppCacheService* service) { |
| 80 service->DeleteOnCorrectThread(); | 80 service->DeleteOnCorrectThread(); |
| 81 } | 81 } |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace content | 84 } // namespace content |
| 85 | 85 |
| 86 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 86 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
| OLD | NEW |