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" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // Init and Shutdown are for use on the UI thread when the profile, | 43 // Init and Shutdown are for use on the UI thread when the profile, |
44 // storagepartition is being setup and torn down. | 44 // storagepartition is being setup and torn down. |
45 void Init(const base::FilePath& user_data_directory, | 45 void Init(const base::FilePath& user_data_directory, |
46 quota::QuotaManagerProxy* quota_manager_proxy); | 46 quota::QuotaManagerProxy* quota_manager_proxy); |
47 void Shutdown(); | 47 void Shutdown(); |
48 | 48 |
49 // The core context is only for use on the IO thread. | 49 // The core context is only for use on the IO thread. |
50 ServiceWorkerContextCore* context(); | 50 ServiceWorkerContextCore* context(); |
51 | 51 |
52 // The process manager can be used on either UI or IO. | |
53 ServiceWorkerProcessManager* process_manager() { | |
54 return process_manager_.get(); | |
55 } | |
56 | |
57 // ServiceWorkerContext implementation: | 52 // ServiceWorkerContext implementation: |
58 virtual void RegisterServiceWorker( | 53 virtual void RegisterServiceWorker( |
59 const GURL& pattern, | 54 const GURL& pattern, |
60 const GURL& script_url, | 55 const GURL& script_url, |
61 const ResultCallback& continuation) OVERRIDE; | 56 const ResultCallback& continuation) OVERRIDE; |
62 virtual void UnregisterServiceWorker(const GURL& pattern, | 57 virtual void UnregisterServiceWorker(const GURL& pattern, |
63 const ResultCallback& continuation) | 58 const ResultCallback& continuation) |
64 OVERRIDE; | 59 OVERRIDE; |
65 | 60 |
66 void AddObserver(ServiceWorkerContextObserver* observer); | 61 void AddObserver(ServiceWorkerContextObserver* observer); |
67 void RemoveObserver(ServiceWorkerContextObserver* observer); | 62 void RemoveObserver(ServiceWorkerContextObserver* observer); |
68 | 63 |
69 private: | 64 private: |
70 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; | 65 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; |
71 friend class EmbeddedWorkerTestHelper; | 66 friend class EmbeddedWorkerTestHelper; |
72 friend class ServiceWorkerProcessManager; | 67 friend class ServiceWorkerProcessManager; |
73 virtual ~ServiceWorkerContextWrapper(); | 68 virtual ~ServiceWorkerContextWrapper(); |
74 | 69 |
75 void InitInternal(const base::FilePath& user_data_directory, | 70 void InitInternal(const base::FilePath& user_data_directory, |
76 base::SequencedTaskRunner* database_task_runner, | 71 base::SequencedTaskRunner* database_task_runner, |
77 base::MessageLoopProxy* disk_cache_thread, | 72 base::MessageLoopProxy* disk_cache_thread, |
78 quota::QuotaManagerProxy* quota_manager_proxy); | 73 quota::QuotaManagerProxy* quota_manager_proxy); |
79 void ShutdownOnIO(); | |
80 | 74 |
81 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > | 75 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > |
82 observer_list_; | 76 observer_list_; |
83 const scoped_ptr<ServiceWorkerProcessManager> process_manager_; | |
84 // Cleared in Shutdown(): | 77 // Cleared in Shutdown(): |
| 78 BrowserContext* browser_context_; |
85 scoped_ptr<ServiceWorkerContextCore> context_core_; | 79 scoped_ptr<ServiceWorkerContextCore> context_core_; |
86 }; | 80 }; |
87 | 81 |
88 } // namespace content | 82 } // namespace content |
89 | 83 |
90 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 84 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
OLD | NEW |