Chromium Code Reviews| Index: third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h |
| diff --git a/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h b/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1016bc9d175355619999351b4c12e0ce7f78d5ca |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2016 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 BackgroundSyncProvider_h |
| +#define BackgroundSyncProvider_h |
| + |
| +#include "modules/background_sync/SyncCallbacks.h" |
| +#include "public/platform/modules/background_sync/background_sync.mojom-blink.h" |
| +#include "wtf/Noncopyable.h" |
| + |
| +namespace blink { |
| + |
| +class WebServiceWorkerRegistration; |
| + |
| +// The BackgroundSyncProvider is called by the SyncManager and SyncRegistration |
| +// objects and communicates with the BackgroundSyncManager object in the browser |
| +// process. Each thread will have its own instance (e.g. main thread, worker |
| +// threads), instantiated as needed by SyncManager. Each instance of |
| +// the provider creates a new mojo connection to a new |
| +// BackgroundSyncManagerImpl, which then talks to the BackgroundSyncManager |
| +// object. |
|
iclelland
2016/11/14 18:43:07
Nit: re-wrap the paragraph
adithyas
2016/11/14 19:51:49
Done.
|
| +class BackgroundSyncProvider { |
| + WTF_MAKE_NONCOPYABLE(BackgroundSyncProvider); |
| + |
| + public: |
| + BackgroundSyncProvider() = default; |
| + |
| + void registerBackgroundSync(mojom::blink::SyncRegistrationPtr options, |
| + WebServiceWorkerRegistration*, |
| + std::unique_ptr<SyncRegistrationCallbacks>); |
|
iclelland
2016/11/14 18:43:07
I think you need to #include <memory> to get std::
adithyas
2016/11/14 19:51:49
Done.
|
| + void getRegistrations(WebServiceWorkerRegistration*, |
| + std::unique_ptr<SyncGetRegistrationsCallbacks>); |
| + |
| + private: |
| + // Callback handlers |
| + static void registerCallback( |
| + std::unique_ptr<blink::SyncRegistrationCallbacks>, |
| + mojom::blink::BackgroundSyncError, |
| + mojom::blink::SyncRegistrationPtr options); |
| + static void getRegistrationsCallback( |
| + std::unique_ptr<SyncGetRegistrationsCallbacks>, |
| + mojom::blink::BackgroundSyncError, |
| + mojo::WTFArray<mojom::blink::SyncRegistrationPtr> registrations); |
| + |
| + // Helper method that returns an initialized BackgroundSyncServicePtr. |
|
iclelland
2016/11/14 18:43:07
Can you mention here that it will connect to the b
adithyas
2016/11/14 19:51:49
Done.
|
| + mojom::blink::BackgroundSyncServicePtr& GetBackgroundSyncServicePtr(); |
| + |
| + mojom::blink::BackgroundSyncServicePtr m_backgroundSyncService; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // BackgroundSyncProvider_h |