Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: content/browser/service_worker/service_worker_context_core.h

Issue 992353003: Decouple Cache Storage messaging from Service Worker/Embedded Worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_CORE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "content/common/content_export.h" 22 #include "content/common/content_export.h"
23 23
24 class GURL; 24 class GURL;
25 25
26 namespace base { 26 namespace base {
27 class FilePath; 27 class FilePath;
28 class SequencedTaskRunner; 28 class SequencedTaskRunner;
29 class SingleThreadTaskRunner; 29 class SingleThreadTaskRunner;
30 } 30 }
31 31
32 namespace net {
33 class URLRequestContext;
34 }
35
36 namespace storage { 32 namespace storage {
37 class QuotaManagerProxy; 33 class QuotaManagerProxy;
38 class SpecialStoragePolicy; 34 class SpecialStoragePolicy;
39 } 35 }
40 36
41 namespace content { 37 namespace content {
42 38
43 class EmbeddedWorkerRegistry; 39 class EmbeddedWorkerRegistry;
44 class ServiceWorkerCacheStorageManager;
45 class ServiceWorkerContextObserver; 40 class ServiceWorkerContextObserver;
46 class ServiceWorkerContextWrapper; 41 class ServiceWorkerContextWrapper;
47 class ServiceWorkerDatabaseTaskManager; 42 class ServiceWorkerDatabaseTaskManager;
48 class ServiceWorkerHandle; 43 class ServiceWorkerHandle;
49 class ServiceWorkerJobCoordinator; 44 class ServiceWorkerJobCoordinator;
50 class ServiceWorkerProviderHost; 45 class ServiceWorkerProviderHost;
51 class ServiceWorkerRegistration; 46 class ServiceWorkerRegistration;
52 class ServiceWorkerStorage; 47 class ServiceWorkerStorage;
53 48
54 // This class manages data associated with service workers. 49 // This class manages data associated with service workers.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 }; 95 };
101 96
102 // This is owned by the StoragePartition, which will supply it with 97 // This is owned by the StoragePartition, which will supply it with
103 // the local path on disk. Given an empty |user_data_directory|, 98 // the local path on disk. Given an empty |user_data_directory|,
104 // nothing will be stored on disk. |observer_list| is created in 99 // nothing will be stored on disk. |observer_list| is created in
105 // ServiceWorkerContextWrapper. When Notify() of |observer_list| is called in 100 // ServiceWorkerContextWrapper. When Notify() of |observer_list| is called in
106 // ServiceWorkerContextCore, the methods of ServiceWorkerContextObserver will 101 // ServiceWorkerContextCore, the methods of ServiceWorkerContextObserver will
107 // be called on the thread which called AddObserver() of |observer_list|. 102 // be called on the thread which called AddObserver() of |observer_list|.
108 ServiceWorkerContextCore( 103 ServiceWorkerContextCore(
109 const base::FilePath& user_data_directory, 104 const base::FilePath& user_data_directory,
110 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner,
111 scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_runner_manager, 105 scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_runner_manager,
112 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, 106 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread,
113 storage::QuotaManagerProxy* quota_manager_proxy, 107 storage::QuotaManagerProxy* quota_manager_proxy,
114 storage::SpecialStoragePolicy* special_storage_policy, 108 storage::SpecialStoragePolicy* special_storage_policy,
115 ObserverListThreadSafe<ServiceWorkerContextObserver>* observer_list, 109 ObserverListThreadSafe<ServiceWorkerContextObserver>* observer_list,
116 ServiceWorkerContextWrapper* wrapper); 110 ServiceWorkerContextWrapper* wrapper);
117 ServiceWorkerContextCore( 111 ServiceWorkerContextCore(
118 ServiceWorkerContextCore* old_context, 112 ServiceWorkerContextCore* old_context,
119 ServiceWorkerContextWrapper* wrapper); 113 ServiceWorkerContextWrapper* wrapper);
120 ~ServiceWorkerContextCore() override; 114 ~ServiceWorkerContextCore() override;
121 115
122 // ServiceWorkerVersion::Listener overrides. 116 // ServiceWorkerVersion::Listener overrides.
123 void OnRunningStateChanged(ServiceWorkerVersion* version) override; 117 void OnRunningStateChanged(ServiceWorkerVersion* version) override;
124 void OnVersionStateChanged(ServiceWorkerVersion* version) override; 118 void OnVersionStateChanged(ServiceWorkerVersion* version) override;
125 void OnErrorReported(ServiceWorkerVersion* version, 119 void OnErrorReported(ServiceWorkerVersion* version,
126 const base::string16& error_message, 120 const base::string16& error_message,
127 int line_number, 121 int line_number,
128 int column_number, 122 int column_number,
129 const GURL& source_url) override; 123 const GURL& source_url) override;
130 void OnReportConsoleMessage(ServiceWorkerVersion* version, 124 void OnReportConsoleMessage(ServiceWorkerVersion* version,
131 int source_identifier, 125 int source_identifier,
132 int message_level, 126 int message_level,
133 const base::string16& message, 127 const base::string16& message,
134 int line_number, 128 int line_number,
135 const GURL& source_url) override; 129 const GURL& source_url) override;
136 130
137 ServiceWorkerContextWrapper* wrapper() const { return wrapper_; } 131 ServiceWorkerContextWrapper* wrapper() const { return wrapper_; }
138 ServiceWorkerStorage* storage() { return storage_.get(); } 132 ServiceWorkerStorage* storage() { return storage_.get(); }
139 ServiceWorkerCacheStorageManager* cache_manager() {
140 return cache_manager_.get();
141 }
142 ServiceWorkerProcessManager* process_manager(); 133 ServiceWorkerProcessManager* process_manager();
143 EmbeddedWorkerRegistry* embedded_worker_registry() { 134 EmbeddedWorkerRegistry* embedded_worker_registry() {
144 return embedded_worker_registry_.get(); 135 return embedded_worker_registry_.get();
145 } 136 }
146 ServiceWorkerJobCoordinator* job_coordinator() { 137 ServiceWorkerJobCoordinator* job_coordinator() {
147 return job_coordinator_.get(); 138 return job_coordinator_.get();
148 } 139 }
149 140
150 // The context class owns the set of ProviderHosts. 141 // The context class owns the set of ProviderHosts.
151 ServiceWorkerProviderHost* GetProviderHost(int process_id, int provider_id); 142 ServiceWorkerProviderHost* GetProviderHost(int process_id, int provider_id);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // Returns new context-local unique ID. 192 // Returns new context-local unique ID.
202 int GetNewServiceWorkerHandleId(); 193 int GetNewServiceWorkerHandleId();
203 int GetNewRegistrationHandleId(); 194 int GetNewRegistrationHandleId();
204 195
205 void ScheduleDeleteAndStartOver() const; 196 void ScheduleDeleteAndStartOver() const;
206 197
207 // Deletes all files on disk and restarts the system. This leaves the system 198 // Deletes all files on disk and restarts the system. This leaves the system
208 // in a disabled state until it's done. 199 // in a disabled state until it's done.
209 void DeleteAndStartOver(const StatusCallback& callback); 200 void DeleteAndStartOver(const StatusCallback& callback);
210 201
211 void SetBlobParametersForCache(
212 net::URLRequestContext* request_context,
213 base::WeakPtr<storage::BlobStorageContext> blob_storage_context);
214
215 // Methods to support cross site navigations. 202 // Methods to support cross site navigations.
216 scoped_ptr<ServiceWorkerProviderHost> TransferProviderHostOut( 203 scoped_ptr<ServiceWorkerProviderHost> TransferProviderHostOut(
217 int process_id, 204 int process_id,
218 int provider_id); 205 int provider_id);
219 void TransferProviderHostIn( 206 void TransferProviderHostIn(
220 int new_process_id, 207 int new_process_id,
221 int new_host_id, 208 int new_host_id,
222 scoped_ptr<ServiceWorkerProviderHost> provider_host); 209 scoped_ptr<ServiceWorkerProviderHost> provider_host);
223 210
224 base::WeakPtr<ServiceWorkerContextCore> AsWeakPtr() { 211 base::WeakPtr<ServiceWorkerContextCore> AsWeakPtr() {
(...skipping 25 matching lines...) Expand all
250 const GURL& origin, 237 const GURL& origin,
251 const std::vector<ServiceWorkerRegistrationInfo>& registrations); 238 const std::vector<ServiceWorkerRegistrationInfo>& registrations);
252 239
253 // It's safe to store a raw pointer instead of a scoped_refptr to |wrapper_| 240 // It's safe to store a raw pointer instead of a scoped_refptr to |wrapper_|
254 // because the Wrapper::Shutdown call that hops threads to destroy |this| uses 241 // because the Wrapper::Shutdown call that hops threads to destroy |this| uses
255 // Bind() to hold a reference to |wrapper_| until |this| is fully destroyed. 242 // Bind() to hold a reference to |wrapper_| until |this| is fully destroyed.
256 ServiceWorkerContextWrapper* wrapper_; 243 ServiceWorkerContextWrapper* wrapper_;
257 scoped_ptr<ProcessToProviderMap> providers_; 244 scoped_ptr<ProcessToProviderMap> providers_;
258 scoped_ptr<ProviderByClientUUIDMap> provider_by_uuid_; 245 scoped_ptr<ProviderByClientUUIDMap> provider_by_uuid_;
259 scoped_ptr<ServiceWorkerStorage> storage_; 246 scoped_ptr<ServiceWorkerStorage> storage_;
260 scoped_ptr<ServiceWorkerCacheStorageManager> cache_manager_;
261 scoped_refptr<EmbeddedWorkerRegistry> embedded_worker_registry_; 247 scoped_refptr<EmbeddedWorkerRegistry> embedded_worker_registry_;
262 scoped_ptr<ServiceWorkerJobCoordinator> job_coordinator_; 248 scoped_ptr<ServiceWorkerJobCoordinator> job_coordinator_;
263 std::map<int64, ServiceWorkerRegistration*> live_registrations_; 249 std::map<int64, ServiceWorkerRegistration*> live_registrations_;
264 std::map<int64, ServiceWorkerVersion*> live_versions_; 250 std::map<int64, ServiceWorkerVersion*> live_versions_;
265 int next_handle_id_; 251 int next_handle_id_;
266 int next_registration_handle_id_; 252 int next_registration_handle_id_;
267 scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > 253 scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> >
268 observer_list_; 254 observer_list_;
269 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; 255 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_;
270 256
271 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); 257 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore);
272 }; 258 };
273 259
274 } // namespace content 260 } // namespace content
275 261
276 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ 262 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698