| 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 |
| 52 // ServiceWorkerContext implementation: | 57 // ServiceWorkerContext implementation: |
| 53 virtual void RegisterServiceWorker( | 58 virtual void RegisterServiceWorker( |
| 54 const GURL& pattern, | 59 const GURL& pattern, |
| 55 const GURL& script_url, | 60 const GURL& script_url, |
| 56 const ResultCallback& continuation) OVERRIDE; | 61 const ResultCallback& continuation) OVERRIDE; |
| 57 virtual void UnregisterServiceWorker(const GURL& pattern, | 62 virtual void UnregisterServiceWorker(const GURL& pattern, |
| 58 const ResultCallback& continuation) | 63 const ResultCallback& continuation) |
| 59 OVERRIDE; | 64 OVERRIDE; |
| 60 | 65 |
| 61 void AddObserver(ServiceWorkerContextObserver* observer); | 66 void AddObserver(ServiceWorkerContextObserver* observer); |
| 62 void RemoveObserver(ServiceWorkerContextObserver* observer); | 67 void RemoveObserver(ServiceWorkerContextObserver* observer); |
| 63 | 68 |
| 64 private: | 69 private: |
| 65 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; | 70 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; |
| 66 friend class EmbeddedWorkerTestHelper; | 71 friend class EmbeddedWorkerTestHelper; |
| 67 friend class ServiceWorkerProcessManager; | 72 friend class ServiceWorkerProcessManager; |
| 68 virtual ~ServiceWorkerContextWrapper(); | 73 virtual ~ServiceWorkerContextWrapper(); |
| 69 | 74 |
| 70 void InitInternal(const base::FilePath& user_data_directory, | 75 void InitInternal(const base::FilePath& user_data_directory, |
| 71 base::SequencedTaskRunner* database_task_runner, | 76 base::SequencedTaskRunner* database_task_runner, |
| 72 base::MessageLoopProxy* disk_cache_thread, | 77 base::MessageLoopProxy* disk_cache_thread, |
| 73 quota::QuotaManagerProxy* quota_manager_proxy); | 78 quota::QuotaManagerProxy* quota_manager_proxy); |
| 79 void ShutdownOnIO(); |
| 74 | 80 |
| 75 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > | 81 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > |
| 76 observer_list_; | 82 observer_list_; |
| 83 const scoped_ptr<ServiceWorkerProcessManager> process_manager_; |
| 77 // Cleared in Shutdown(): | 84 // Cleared in Shutdown(): |
| 78 BrowserContext* browser_context_; | |
| 79 scoped_ptr<ServiceWorkerContextCore> context_core_; | 85 scoped_ptr<ServiceWorkerContextCore> context_core_; |
| 80 }; | 86 }; |
| 81 | 87 |
| 82 } // namespace content | 88 } // namespace content |
| 83 | 89 |
| 84 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 90 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| OLD | NEW |