Chromium Code Reviews| Index: content/child/background_sync/background_sync_provider_thread_proxy.h |
| diff --git a/content/child/background_sync/background_sync_provider_thread_proxy.h b/content/child/background_sync/background_sync_provider_thread_proxy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9388d42c5cc4b5b6c2074c5ec44dc13f84c2cc79 |
| --- /dev/null |
| +++ b/content/child/background_sync/background_sync_provider_thread_proxy.h |
| @@ -0,0 +1,71 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_THREAD_PROXY_H_ |
| +#define CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_THREAD_PROXY_H_ |
| + |
| +#include "base/id_map.h" |
|
jkarlin
2015/05/01 16:13:52
remove
iclelland
2015/05/07 06:03:50
Done.
|
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "content/child/worker_task_runner.h" |
| +#include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProvider.h" |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} |
| + |
| +namespace content { |
| + |
| +class BackgroundSyncProvider; |
| + |
| +// BackgroundSyncProviderThreadProxy is a a proxy to the BackgroundSyncProvider |
| +// for callers running on a different thread than the main thread. There is one |
| +// instance of that class per thread. |
| +class BackgroundSyncProviderThreadProxy : |
| + public blink::WebSyncProvider, |
| + public WorkerTaskRunner::Observer { |
| + public: |
| + static BackgroundSyncProviderThreadProxy* GetThreadInstance( |
| + base::SingleThreadTaskRunner* main_thread_task_runner, |
| + BackgroundSyncProvider* permissions_dispatcher); |
| + |
| + // blink::WebSyncProvider implementation |
| + void registerBackgroundSync( |
| + const blink::WebSyncRegistration* options, |
| + blink::WebServiceWorkerRegistration* service_worker_registration, |
| + blink::WebSyncRegistrationCallbacks* callbacks); |
| + void unregisterBackgroundSync( |
| + blink::WebSyncRegistration::Periodicity periodicity, |
| + int64_t id, const blink::WebString& tag, |
| + blink::WebServiceWorkerRegistration* service_worker_registration, |
| + blink::WebSyncUnregistrationCallbacks* callbacks); |
| + void getRegistration( |
| + blink::WebSyncRegistration::Periodicity, |
| + const blink::WebString& tag, |
| + blink::WebServiceWorkerRegistration* service_worker_registration, |
| + blink::WebSyncRegistrationCallbacks* callbacks); |
| + void getRegistrations( |
| + blink::WebSyncRegistration::Periodicity periodicity, |
| + blink::WebServiceWorkerRegistration* service_worker_registration, |
| + blink::WebSyncGetRegistrationsCallbacks* callbacks); |
| + |
| + // WorkerTaskRunner::Observer implementation. |
| + void OnWorkerRunLoopStopped() override; |
| + |
| + private: |
| + BackgroundSyncProviderThreadProxy( |
| + base::SingleThreadTaskRunner* main_thread_task_runner, |
| + BackgroundSyncProvider* sync_provider); |
| + |
| + virtual ~BackgroundSyncProviderThreadProxy(); |
| + |
| + scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| + BackgroundSyncProvider* sync_provider_; |
|
jkarlin
2015/05/01 16:13:52
Document why sync_provider_ will outlive this obje
iclelland
2015/05/07 06:03:50
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProviderThreadProxy); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_THREAD_PROXY_H_ |