Chromium Code Reviews| Index: content/child/background_sync/background_sync_provider.h |
| diff --git a/content/child/background_sync/background_sync_provider.h b/content/child/background_sync/background_sync_provider.h |
| index 0dc6d6c3a56d2acdad12b756f4369698ad532373..bf5489f42493d774948f76c8b5350363e857abac 100644 |
| --- a/content/child/background_sync/background_sync_provider.h |
| +++ b/content/child/background_sync/background_sync_provider.h |
| @@ -8,24 +8,27 @@ |
| #include <string> |
| #include "base/memory/scoped_ptr.h" |
| -#include "content/child/worker_task_runner.h" |
| #include "content/common/background_sync_service.mojom.h" |
| +#include "content/public/child/worker_thread.h" |
| #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProvider.h" |
| -namespace content { |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} |
| -class ServiceRegistry; |
| +namespace content { |
| // The BackgroundSyncProvider is called by the SyncManager and SyncRegistration |
| // objects (and their Periodic counterparts) and communicates with the |
| -// BackgroundSyncManager object in the browser process. This class is |
| -// instantiated on the main thread by BlinkPlatformImpl, and its methods can be |
| -// called directly from the main thread. |
| -class BackgroundSyncProvider : public blink::WebSyncProvider { |
| +// BackgroundSyncManager object in the browser process. Each thread will have |
|
jkarlin
2015/09/28 20:10:05
It communicates with the BackgroundSyncManager via
chasej
2015/10/08 03:28:53
Acknowledged.
|
| +// its own instance (e.g. main thread, worker threads), instantiated as needed |
| +// by BlinkPlatformImpl. Each instance of the provider will create a separate |
| +// mojo connection to the BackgroundSyncManager object in the browser process. |
|
jkarlin
2015/09/28 20:10:05
Each instance creates a new mojo connection to a n
chasej
2015/10/08 03:28:53
Comment updated to be more precise about the behav
|
| +class BackgroundSyncProvider : public blink::WebSyncProvider, |
| + public WorkerThread::Observer { |
| public: |
| - explicit BackgroundSyncProvider(ServiceRegistry* service_registry); |
| - |
| - ~BackgroundSyncProvider() override; |
| + static BackgroundSyncProvider* GetThreadInstance( |
| + base::SingleThreadTaskRunner* main_thread_task_runner); |
| // blink::WebSyncProvider implementation |
| // TODO(jkarlin) convert int64_t handle_id to int handle_id in all |
| @@ -66,7 +69,15 @@ class BackgroundSyncProvider : public blink::WebSyncProvider { |
| const BackgroundSyncService::DuplicateRegistrationHandleCallback& |
| callback); |
| + // WorkerThread::Observer implementation. |
| + void WillStopCurrentWorkerThread() override; |
|
jkarlin
2015/09/28 20:12:51
I see how worker threads get killed, thanks to thi
michaeln
2015/10/02 00:13:08
For other threadspecific classes like this, the in
|
| + |
| private: |
| + explicit BackgroundSyncProvider( |
| + const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
| + |
| + ~BackgroundSyncProvider() override; |
| + |
| // Callback handlers |
| void RegisterCallback( |
| scoped_ptr<blink::WebSyncRegistrationCallbacks> callbacks, |
| @@ -95,8 +106,8 @@ class BackgroundSyncProvider : public blink::WebSyncProvider { |
| // Helper method that returns an initialized BackgroundSyncServicePtr. |
| BackgroundSyncServicePtr& GetBackgroundSyncServicePtr(); |
| - ServiceRegistry* service_registry_; |
| BackgroundSyncServicePtr background_sync_service_; |
| + scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProvider); |
| }; |