OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "content/browser/service_worker/service_worker_context_core.h" | 13 #include "content/browser/service_worker/service_worker_context_core.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/service_worker_context.h" | 15 #include "content/public/browser/service_worker_context.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class FilePath; | 18 class FilePath; |
19 class MessageLoopProxy; | 19 class MessageLoopProxy; |
20 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
21 } | 21 } |
22 | 22 |
| 23 namespace net { |
| 24 class URLRequestContextGetter; |
| 25 } |
| 26 |
23 namespace quota { | 27 namespace quota { |
24 class QuotaManagerProxy; | 28 class QuotaManagerProxy; |
25 } | 29 } |
26 | 30 |
27 namespace content { | 31 namespace content { |
28 | 32 |
29 class BrowserContext; | 33 class BrowserContext; |
| 34 class ChromeBlobStorageContext; |
30 class ServiceWorkerContextCore; | 35 class ServiceWorkerContextCore; |
31 class ServiceWorkerContextObserver; | 36 class ServiceWorkerContextObserver; |
32 | 37 |
33 // A refcounted wrapper class for our core object. Higher level content lib | 38 // A refcounted wrapper class for our core object. Higher level content lib |
34 // classes keep references to this class on mutliple threads. The inner core | 39 // classes keep references to this class on mutliple threads. The inner core |
35 // instance is strictly single threaded and is not refcounted, the core object | 40 // instance is strictly single threaded and is not refcounted, the core object |
36 // is what is used internally in the service worker lib. | 41 // is what is used internally in the service worker lib. |
37 class CONTENT_EXPORT ServiceWorkerContextWrapper | 42 class CONTENT_EXPORT ServiceWorkerContextWrapper |
38 : NON_EXPORTED_BASE(public ServiceWorkerContext), | 43 : NON_EXPORTED_BASE(public ServiceWorkerContext), |
39 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { | 44 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { |
(...skipping 29 matching lines...) Expand all Loading... |
69 OVERRIDE; | 74 OVERRIDE; |
70 virtual void Terminate() OVERRIDE; | 75 virtual void Terminate() OVERRIDE; |
71 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) OVERRIDE; | 76 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) OVERRIDE; |
72 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE; | 77 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE; |
73 | 78 |
74 void AddObserver(ServiceWorkerContextObserver* observer); | 79 void AddObserver(ServiceWorkerContextObserver* observer); |
75 void RemoveObserver(ServiceWorkerContextObserver* observer); | 80 void RemoveObserver(ServiceWorkerContextObserver* observer); |
76 | 81 |
77 bool is_incognito() const { return is_incognito_; } | 82 bool is_incognito() const { return is_incognito_; } |
78 | 83 |
| 84 // The URLRequestContext doesn't exist until after the StoragePartition is |
| 85 // made (which is after this object is made). This function must be called |
| 86 // after this object is created but before any ServiceWorkerCache operations. |
| 87 // It must be called on the IO thread. If either parameter is NULL the |
| 88 // function immediately returns without forwarding to the |
| 89 // ServiceWorkerCacheStorageManager. |
| 90 void SetBlobParametersForCache( |
| 91 net::URLRequestContextGetter* request_context, |
| 92 ChromeBlobStorageContext* blob_storage_context); |
| 93 |
79 private: | 94 private: |
80 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; | 95 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; |
81 friend class EmbeddedWorkerTestHelper; | 96 friend class EmbeddedWorkerTestHelper; |
82 friend class ServiceWorkerProcessManager; | 97 friend class ServiceWorkerProcessManager; |
83 virtual ~ServiceWorkerContextWrapper(); | 98 virtual ~ServiceWorkerContextWrapper(); |
84 | 99 |
85 void InitInternal(const base::FilePath& user_data_directory, | 100 void InitInternal(const base::FilePath& user_data_directory, |
86 base::SequencedTaskRunner* stores_task_runner, | 101 base::SequencedTaskRunner* stores_task_runner, |
87 base::SequencedTaskRunner* database_task_runner, | 102 base::SequencedTaskRunner* database_task_runner, |
88 base::MessageLoopProxy* disk_cache_thread, | 103 base::MessageLoopProxy* disk_cache_thread, |
(...skipping 15 matching lines...) Expand all Loading... |
104 // Cleared in Shutdown(): | 119 // Cleared in Shutdown(): |
105 scoped_ptr<ServiceWorkerContextCore> context_core_; | 120 scoped_ptr<ServiceWorkerContextCore> context_core_; |
106 | 121 |
107 // Initialized in Init(); true of the user data directory is empty. | 122 // Initialized in Init(); true of the user data directory is empty. |
108 bool is_incognito_; | 123 bool is_incognito_; |
109 }; | 124 }; |
110 | 125 |
111 } // namespace content | 126 } // namespace content |
112 | 127 |
113 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 128 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
OLD | NEW |