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

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

Issue 2943463002: Implement dumb URLLoader{Factory} for ServiceWorker script loading (Closed)
Patch Set: rebased Created 3 years, 6 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_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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 namespace storage { 29 namespace storage {
30 class QuotaManagerProxy; 30 class QuotaManagerProxy;
31 class SpecialStoragePolicy; 31 class SpecialStoragePolicy;
32 } 32 }
33 33
34 namespace content { 34 namespace content {
35 35
36 class BrowserContext; 36 class BrowserContext;
37 class ChromeBlobStorageContext;
37 class ResourceContext; 38 class ResourceContext;
38 class ServiceWorkerContextObserver; 39 class ServiceWorkerContextObserver;
39 class StoragePartitionImpl; 40 class StoragePartitionImpl;
41 class URLLoaderFactoryGetter;
40 42
41 // A refcounted wrapper class for our core object. Higher level content lib 43 // A refcounted wrapper class for our core object. Higher level content lib
42 // classes keep references to this class on mutliple threads. The inner core 44 // classes keep references to this class on mutliple threads. The inner core
43 // instance is strictly single threaded and is not refcounted, the core object 45 // instance is strictly single threaded and is not refcounted, the core object
44 // is what is used internally in the service worker lib. 46 // is what is used internally in the service worker lib.
45 class CONTENT_EXPORT ServiceWorkerContextWrapper 47 class CONTENT_EXPORT ServiceWorkerContextWrapper
46 : NON_EXPORTED_BASE(public ServiceWorkerContext), 48 : NON_EXPORTED_BASE(public ServiceWorkerContext),
47 public ServiceWorkerContextCoreObserver, 49 public ServiceWorkerContextCoreObserver,
48 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { 50 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> {
49 public: 51 public:
50 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode)>; 52 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode)>;
51 using BoolCallback = base::Callback<void(bool)>; 53 using BoolCallback = base::Callback<void(bool)>;
52 using FindRegistrationCallback = 54 using FindRegistrationCallback =
53 ServiceWorkerStorage::FindRegistrationCallback; 55 ServiceWorkerStorage::FindRegistrationCallback;
54 using GetRegistrationsInfosCallback = 56 using GetRegistrationsInfosCallback =
55 ServiceWorkerStorage::GetRegistrationsInfosCallback; 57 ServiceWorkerStorage::GetRegistrationsInfosCallback;
56 using GetUserDataCallback = ServiceWorkerStorage::GetUserDataCallback; 58 using GetUserDataCallback = ServiceWorkerStorage::GetUserDataCallback;
57 using GetUserDataForAllRegistrationsCallback = 59 using GetUserDataForAllRegistrationsCallback =
58 ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback; 60 ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback;
59 61
60 ServiceWorkerContextWrapper(BrowserContext* browser_context); 62 ServiceWorkerContextWrapper(BrowserContext* browser_context);
61 63
62 // Init and Shutdown are for use on the UI thread when the profile, 64 // Init and Shutdown are for use on the UI thread when the profile,
63 // storagepartition is being setup and torn down. 65 // storagepartition is being setup and torn down.
66 // |blob_context| and |url_loader_factory_getter| are used only
67 // when IsServicificationEnabled is true.
64 void Init(const base::FilePath& user_data_directory, 68 void Init(const base::FilePath& user_data_directory,
65 storage::QuotaManagerProxy* quota_manager_proxy, 69 storage::QuotaManagerProxy* quota_manager_proxy,
66 storage::SpecialStoragePolicy* special_storage_policy); 70 storage::SpecialStoragePolicy* special_storage_policy,
71 ChromeBlobStorageContext* blob_context,
72 URLLoaderFactoryGetter* url_loader_factory_getter);
67 void Shutdown(); 73 void Shutdown();
68 74
69 // Must be called on the IO thread. 75 // Must be called on the IO thread.
70 void InitializeResourceContext(ResourceContext* resource_context); 76 void InitializeResourceContext(ResourceContext* resource_context);
71 77
72 // Deletes all files on disk and restarts the system asynchronously. This 78 // Deletes all files on disk and restarts the system asynchronously. This
73 // leaves the system in a disabled state until it's done. This should be 79 // leaves the system in a disabled state until it's done. This should be
74 // called on the IO thread. 80 // called on the IO thread.
75 void DeleteAndStartOver(); 81 void DeleteAndStartOver();
76 82
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 friend class ServiceWorkerVersionBrowserTest; 264 friend class ServiceWorkerVersionBrowserTest;
259 friend class MockServiceWorkerContextWrapper; 265 friend class MockServiceWorkerContextWrapper;
260 266
261 ~ServiceWorkerContextWrapper() override; 267 ~ServiceWorkerContextWrapper() override;
262 268
263 void InitInternal( 269 void InitInternal(
264 const base::FilePath& user_data_directory, 270 const base::FilePath& user_data_directory,
265 std::unique_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager, 271 std::unique_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager,
266 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, 272 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread,
267 storage::QuotaManagerProxy* quota_manager_proxy, 273 storage::QuotaManagerProxy* quota_manager_proxy,
268 storage::SpecialStoragePolicy* special_storage_policy); 274 storage::SpecialStoragePolicy* special_storage_policy,
275 ChromeBlobStorageContext* blob_context,
276 URLLoaderFactoryGetter* url_loader_factory_getter);
269 void ShutdownOnIO(); 277 void ShutdownOnIO();
270 278
271 void DidFindRegistrationForFindReady( 279 void DidFindRegistrationForFindReady(
272 const FindRegistrationCallback& callback, 280 const FindRegistrationCallback& callback,
273 ServiceWorkerStatusCode status, 281 ServiceWorkerStatusCode status,
274 scoped_refptr<ServiceWorkerRegistration> registration); 282 scoped_refptr<ServiceWorkerRegistration> registration);
275 void OnStatusChangedForFindReadyRegistration( 283 void OnStatusChangedForFindReadyRegistration(
276 const FindRegistrationCallback& callback, 284 const FindRegistrationCallback& callback,
277 scoped_refptr<ServiceWorkerRegistration> registration); 285 scoped_refptr<ServiceWorkerRegistration> registration);
278 286
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 339
332 // The ResourceContext associated with this context. 340 // The ResourceContext associated with this context.
333 ResourceContext* resource_context_; 341 ResourceContext* resource_context_;
334 342
335 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); 343 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper);
336 }; 344 };
337 345
338 } // namespace content 346 } // namespace content
339 347
340 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 348 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698