Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 67 virtual void UnregisterServiceWorker(const GURL& pattern, | 72 virtual void UnregisterServiceWorker(const GURL& pattern, |
| 68 const ResultCallback& continuation) | 73 const ResultCallback& continuation) |
| 69 OVERRIDE; | 74 OVERRIDE; |
| 70 virtual void Terminate() OVERRIDE; | 75 virtual void Terminate() OVERRIDE; |
| 71 | 76 |
| 72 void AddObserver(ServiceWorkerContextObserver* observer); | 77 void AddObserver(ServiceWorkerContextObserver* observer); |
| 73 void RemoveObserver(ServiceWorkerContextObserver* observer); | 78 void RemoveObserver(ServiceWorkerContextObserver* observer); |
| 74 | 79 |
| 75 bool is_incognito() const { return is_incognito_; } | 80 bool is_incognito() const { return is_incognito_; } |
| 76 | 81 |
| 82 net::URLRequestContextGetter* request_context_getter() { | |
| 83 return request_context_getter_; | |
| 84 } | |
| 85 ChromeBlobStorageContext* blob_storage_context() { | |
|
michaeln
2014/08/12 03:48:52
this swsystem needs to use these things, but it do
jkarlin
2014/08/12 18:45:18
No longer applicable, see update. Now a public se
| |
| 86 return blob_storage_context_; | |
| 87 } | |
| 88 | |
| 77 private: | 89 private: |
| 78 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; | 90 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; |
| 79 friend class EmbeddedWorkerTestHelper; | 91 friend class EmbeddedWorkerTestHelper; |
| 80 friend class ServiceWorkerProcessManager; | 92 friend class ServiceWorkerProcessManager; |
| 81 virtual ~ServiceWorkerContextWrapper(); | 93 virtual ~ServiceWorkerContextWrapper(); |
| 82 | 94 |
| 83 void InitInternal(const base::FilePath& user_data_directory, | 95 void InitInternal(const base::FilePath& user_data_directory, |
| 84 base::SequencedTaskRunner* stores_task_runner, | 96 base::SequencedTaskRunner* stores_task_runner, |
| 85 base::SequencedTaskRunner* database_task_runner, | 97 base::SequencedTaskRunner* database_task_runner, |
| 86 base::MessageLoopProxy* disk_cache_thread, | 98 base::MessageLoopProxy* disk_cache_thread, |
| 87 quota::QuotaManagerProxy* quota_manager_proxy); | 99 quota::QuotaManagerProxy* quota_manager_proxy); |
| 88 void ShutdownOnIO(); | 100 void ShutdownOnIO(); |
| 89 | 101 |
| 90 void DidDeleteAndStartOver(ServiceWorkerStatusCode status); | 102 void DidDeleteAndStartOver(ServiceWorkerStatusCode status); |
| 91 | 103 |
| 92 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > | 104 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > |
| 93 observer_list_; | 105 observer_list_; |
| 94 const scoped_ptr<ServiceWorkerProcessManager> process_manager_; | 106 const scoped_ptr<ServiceWorkerProcessManager> process_manager_; |
| 95 // Cleared in Shutdown(): | 107 // Cleared in Shutdown(): |
| 96 scoped_ptr<ServiceWorkerContextCore> context_core_; | 108 scoped_ptr<ServiceWorkerContextCore> context_core_; |
| 97 | 109 |
| 98 // Initialized in Init(); true of the user data directory is empty. | 110 // Initialized in Init(); true of the user data directory is empty. |
| 99 bool is_incognito_; | 111 bool is_incognito_; |
| 112 | |
| 113 net::URLRequestContextGetter* request_context_getter_; | |
|
michaeln
2014/08/12 03:48:52
scoped_refptr<T> for both of these new data refcou
jkarlin
2014/08/12 18:45:18
No longer applicable. I removed these members.
| |
| 114 ChromeBlobStorageContext* blob_storage_context_; | |
| 100 }; | 115 }; |
| 101 | 116 |
| 102 } // namespace content | 117 } // namespace content |
| 103 | 118 |
| 104 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 119 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| OLD | NEW |