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

Side by Side Diff: content/browser/service_worker/service_worker_context_wrapper.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_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 SequencedTaskRunner; 19 class SequencedTaskRunner;
20 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
21 } 21 }
22 22
23 namespace net {
24 class URLRequestContextGetter;
25 }
26
27 namespace storage { 23 namespace storage {
28 class QuotaManagerProxy; 24 class QuotaManagerProxy;
29 class SpecialStoragePolicy; 25 class SpecialStoragePolicy;
30 } 26 }
31 27
32 namespace content { 28 namespace content {
33 29
34 class BrowserContext; 30 class BrowserContext;
35 class ChromeBlobStorageContext;
36 class ServiceWorkerContextCore; 31 class ServiceWorkerContextCore;
37 class ServiceWorkerContextObserver; 32 class ServiceWorkerContextObserver;
38 class StoragePartitionImpl; 33 class StoragePartitionImpl;
39 34
40 // A refcounted wrapper class for our core object. Higher level content lib 35 // A refcounted wrapper class for our core object. Higher level content lib
41 // classes keep references to this class on mutliple threads. The inner core 36 // classes keep references to this class on mutliple threads. The inner core
42 // instance is strictly single threaded and is not refcounted, the core object 37 // instance is strictly single threaded and is not refcounted, the core object
43 // is what is used internally in the service worker lib. 38 // is what is used internally in the service worker lib.
44 class CONTENT_EXPORT ServiceWorkerContextWrapper 39 class CONTENT_EXPORT ServiceWorkerContextWrapper
45 : NON_EXPORTED_BASE(public ServiceWorkerContext), 40 : NON_EXPORTED_BASE(public ServiceWorkerContext),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // DeleteForOrigin with completion callback. Does not exit early, and returns 88 // DeleteForOrigin with completion callback. Does not exit early, and returns
94 // false if one or more of the deletions fail. 89 // false if one or more of the deletions fail.
95 virtual void DeleteForOrigin(const GURL& origin_url, 90 virtual void DeleteForOrigin(const GURL& origin_url,
96 const ResultCallback& done); 91 const ResultCallback& done);
97 92
98 void AddObserver(ServiceWorkerContextObserver* observer); 93 void AddObserver(ServiceWorkerContextObserver* observer);
99 void RemoveObserver(ServiceWorkerContextObserver* observer); 94 void RemoveObserver(ServiceWorkerContextObserver* observer);
100 95
101 bool is_incognito() const { return is_incognito_; } 96 bool is_incognito() const { return is_incognito_; }
102 97
103 // The URLRequestContext doesn't exist until after the StoragePartition is
104 // made (which is after this object is made). This function must be called
105 // after this object is created but before any ServiceWorkerCache operations.
106 // It must be called on the IO thread. If either parameter is NULL the
107 // function immediately returns without forwarding to the
108 // ServiceWorkerCacheStorageManager.
109 void SetBlobParametersForCache(
110 net::URLRequestContextGetter* request_context,
111 ChromeBlobStorageContext* blob_storage_context);
112
113 private: 98 private:
114 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; 99 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>;
115 friend class EmbeddedWorkerTestHelper; 100 friend class EmbeddedWorkerTestHelper;
116 friend class ServiceWorkerProcessManager; 101 friend class ServiceWorkerProcessManager;
117 friend class MockServiceWorkerContextWrapper; 102 friend class MockServiceWorkerContextWrapper;
118 103
119 ~ServiceWorkerContextWrapper() override; 104 ~ServiceWorkerContextWrapper() override;
120 105
121 void InitInternal( 106 void InitInternal(
122 const base::FilePath& user_data_directory, 107 const base::FilePath& user_data_directory,
123 const scoped_refptr<base::SequencedTaskRunner>& stores_task_runner,
124 scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager, 108 scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager,
125 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, 109 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread,
126 storage::QuotaManagerProxy* quota_manager_proxy, 110 storage::QuotaManagerProxy* quota_manager_proxy,
127 storage::SpecialStoragePolicy* special_storage_policy); 111 storage::SpecialStoragePolicy* special_storage_policy);
128 void ShutdownOnIO(); 112 void ShutdownOnIO();
129 113
130 void DidDeleteAndStartOver(ServiceWorkerStatusCode status); 114 void DidDeleteAndStartOver(ServiceWorkerStatusCode status);
131 115
132 void DidGetAllRegistrationsForGetAllOrigins( 116 void DidGetAllRegistrationsForGetAllOrigins(
133 const GetUsageInfoCallback& callback, 117 const GetUsageInfoCallback& callback,
(...skipping 14 matching lines...) Expand all
148 // Initialized in Init(); true if the user data directory is empty. 132 // Initialized in Init(); true if the user data directory is empty.
149 bool is_incognito_; 133 bool is_incognito_;
150 134
151 // Raw pointer to the StoragePartitionImpl owning |this|. 135 // Raw pointer to the StoragePartitionImpl owning |this|.
152 StoragePartitionImpl* storage_partition_; 136 StoragePartitionImpl* storage_partition_;
153 }; 137 };
154 138
155 } // namespace content 139 } // namespace content
156 140
157 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 141 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698