Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_THREAD_PROXY_H_ | |
| 6 #define CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_THREAD_PROXY_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "content/child/worker_task_runner.h" | |
| 11 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProv ider.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class SingleThreadTaskRunner; | |
| 15 } | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 class BackgroundSyncProvider; | |
| 20 | |
| 21 // BackgroundSyncProviderThreadProxy is a a proxy to the BackgroundSyncProvider | |
|
jkarlin
2015/05/07 11:51:53
"is a a proxy" -> "is a proxy"
iclelland
2015/05/09 06:41:17
Done.
| |
| 22 // for callers running on a different thread than the main thread. There is one | |
| 23 // instance of that class per thread. | |
| 24 class BackgroundSyncProviderThreadProxy : | |
| 25 public blink::WebSyncProvider, | |
| 26 public WorkerTaskRunner::Observer { | |
| 27 public: | |
| 28 static BackgroundSyncProviderThreadProxy* GetThreadInstance( | |
| 29 base::SingleThreadTaskRunner* main_thread_task_runner, | |
| 30 BackgroundSyncProvider* permissions_dispatcher); | |
| 31 | |
| 32 // blink::WebSyncProvider implementation | |
| 33 void registerBackgroundSync( | |
| 34 const blink::WebSyncRegistration* options, | |
| 35 blink::WebServiceWorkerRegistration* service_worker_registration, | |
| 36 blink::WebSyncRegistrationCallbacks* callbacks); | |
| 37 void unregisterBackgroundSync( | |
| 38 blink::WebSyncRegistration::Periodicity periodicity, | |
| 39 int64_t id, const blink::WebString& tag, | |
| 40 blink::WebServiceWorkerRegistration* service_worker_registration, | |
| 41 blink::WebSyncUnregistrationCallbacks* callbacks); | |
| 42 void getRegistration( | |
| 43 blink::WebSyncRegistration::Periodicity, | |
| 44 const blink::WebString& tag, | |
| 45 blink::WebServiceWorkerRegistration* service_worker_registration, | |
| 46 blink::WebSyncRegistrationCallbacks* callbacks); | |
| 47 void getRegistrations( | |
| 48 blink::WebSyncRegistration::Periodicity periodicity, | |
| 49 blink::WebServiceWorkerRegistration* service_worker_registration, | |
| 50 blink::WebSyncGetRegistrationsCallbacks* callbacks); | |
| 51 | |
| 52 // WorkerTaskRunner::Observer implementation. | |
| 53 void OnWorkerRunLoopStopped() override; | |
| 54 | |
| 55 private: | |
| 56 BackgroundSyncProviderThreadProxy( | |
| 57 base::SingleThreadTaskRunner* main_thread_task_runner, | |
| 58 BackgroundSyncProvider* sync_provider); | |
| 59 | |
| 60 virtual ~BackgroundSyncProviderThreadProxy(); | |
| 61 | |
| 62 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | |
| 63 // This belongs to the renderer main thread, (created by BlinkPlatformImpl) | |
| 64 // and so should outlive the BackgroundSyncProviderThreadProxy, which is | |
| 65 // created for a worker thread. | |
| 66 BackgroundSyncProvider* sync_provider_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProviderThreadProxy); | |
| 69 }; | |
| 70 | |
| 71 } // namespace content | |
| 72 | |
| 73 #endif // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_THREAD_PROXY_H_ | |
| OLD | NEW |