| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 namespace storage { | 27 namespace storage { |
| 28 class QuotaManagerProxy; | 28 class QuotaManagerProxy; |
| 29 class SpecialStoragePolicy; | 29 class SpecialStoragePolicy; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 | 33 |
| 34 class BrowserContext; | 34 class BrowserContext; |
| 35 class ResourceContext; | 35 class ResourceContext; |
| 36 class ServiceWorkerContextCore; | 36 class ServiceWorkerContextCore; |
| 37 class ServiceWorkerContextObserver; | 37 class ServiceWorkerContextCoreObserver; |
| 38 class StoragePartitionImpl; | 38 class StoragePartitionImpl; |
| 39 | 39 |
| 40 // A refcounted wrapper class for our core object. Higher level content lib | 40 // 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 | 41 // 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 | 42 // instance is strictly single threaded and is not refcounted, the core object |
| 43 // is what is used internally in the service worker lib. | 43 // is what is used internally in the service worker lib. |
| 44 class CONTENT_EXPORT ServiceWorkerContextWrapper | 44 class CONTENT_EXPORT ServiceWorkerContextWrapper |
| 45 : NON_EXPORTED_BASE(public ServiceWorkerContext), | 45 : NON_EXPORTED_BASE(public ServiceWorkerContext), |
| 46 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { | 46 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { |
| 47 public: | 47 public: |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // This function can be called from any thread, but the callback will always | 210 // This function can be called from any thread, but the callback will always |
| 211 // be called on the UI thread. | 211 // be called on the UI thread. |
| 212 void StartServiceWorker(const GURL& pattern, const StatusCallback& callback); | 212 void StartServiceWorker(const GURL& pattern, const StatusCallback& callback); |
| 213 | 213 |
| 214 // This function can be called from any thread. | 214 // This function can be called from any thread. |
| 215 void SkipWaitingWorker(const GURL& pattern); | 215 void SkipWaitingWorker(const GURL& pattern); |
| 216 | 216 |
| 217 // These methods can be called from any thread. | 217 // These methods can be called from any thread. |
| 218 void UpdateRegistration(const GURL& pattern); | 218 void UpdateRegistration(const GURL& pattern); |
| 219 void SetForceUpdateOnPageLoad(bool force_update_on_page_load); | 219 void SetForceUpdateOnPageLoad(bool force_update_on_page_load); |
| 220 void AddObserver(ServiceWorkerContextObserver* observer); | 220 void AddObserver(ServiceWorkerContextCoreObserver* observer); |
| 221 void RemoveObserver(ServiceWorkerContextObserver* observer); | 221 void RemoveObserver(ServiceWorkerContextCoreObserver* observer); |
| 222 | 222 |
| 223 bool is_incognito() const { return is_incognito_; } | 223 bool is_incognito() const { return is_incognito_; } |
| 224 | 224 |
| 225 // Must be called from the IO thread. | 225 // Must be called from the IO thread. |
| 226 bool OriginHasForeignFetchRegistrations(const GURL& origin); | 226 bool OriginHasForeignFetchRegistrations(const GURL& origin); |
| 227 | 227 |
| 228 // Binds the ServiceWorkerWorkerClient of a dedicated (or shared) worker to | 228 // Binds the ServiceWorkerWorkerClient of a dedicated (or shared) worker to |
| 229 // the parent frame's ServiceWorkerProviderHost. (This is used only when | 229 // the parent frame's ServiceWorkerProviderHost. (This is used only when |
| 230 // off-main-thread-fetch is enabled.) | 230 // off-main-thread-fetch is enabled.) |
| 231 void BindWorkerFetchContext( | 231 void BindWorkerFetchContext( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 277 |
| 278 void DidFindRegistrationForUpdate( | 278 void DidFindRegistrationForUpdate( |
| 279 ServiceWorkerStatusCode status, | 279 ServiceWorkerStatusCode status, |
| 280 scoped_refptr<content::ServiceWorkerRegistration> registration); | 280 scoped_refptr<content::ServiceWorkerRegistration> registration); |
| 281 | 281 |
| 282 // The core context is only for use on the IO thread. | 282 // The core context is only for use on the IO thread. |
| 283 // Can be null before/during init, during/after shutdown, and after | 283 // Can be null before/during init, during/after shutdown, and after |
| 284 // DeleteAndStartOver fails. | 284 // DeleteAndStartOver fails. |
| 285 ServiceWorkerContextCore* context(); | 285 ServiceWorkerContextCore* context(); |
| 286 | 286 |
| 287 const scoped_refptr<base::ObserverListThreadSafe< | 287 const scoped_refptr< |
| 288 ServiceWorkerContextObserver>> observer_list_; | 288 base::ObserverListThreadSafe<ServiceWorkerContextCoreObserver>> |
| 289 observer_list_; |
| 289 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; | 290 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; |
| 290 // Cleared in ShutdownOnIO(): | 291 // Cleared in ShutdownOnIO(): |
| 291 std::unique_ptr<ServiceWorkerContextCore> context_core_; | 292 std::unique_ptr<ServiceWorkerContextCore> context_core_; |
| 292 | 293 |
| 293 // Initialized in Init(); true if the user data directory is empty. | 294 // Initialized in Init(); true if the user data directory is empty. |
| 294 bool is_incognito_; | 295 bool is_incognito_; |
| 295 | 296 |
| 296 // Raw pointer to the StoragePartitionImpl owning |this|. | 297 // Raw pointer to the StoragePartitionImpl owning |this|. |
| 297 StoragePartitionImpl* storage_partition_; | 298 StoragePartitionImpl* storage_partition_; |
| 298 | 299 |
| 299 // The ResourceContext associated with this context. | 300 // The ResourceContext associated with this context. |
| 300 ResourceContext* resource_context_; | 301 ResourceContext* resource_context_; |
| 301 | 302 |
| 302 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); | 303 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); |
| 303 }; | 304 }; |
| 304 | 305 |
| 305 } // namespace content | 306 } // namespace content |
| 306 | 307 |
| 307 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 308 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| OLD | NEW |