Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 BackgroundSyncProvider_h | |
| 6 #define BackgroundSyncProvider_h | |
| 7 | |
| 8 #include "modules/background_sync/SyncCallbacks.h" | |
| 9 #include "public/platform/modules/background_sync/background_sync.mojom-blink.h" | |
| 10 #include "wtf/Noncopyable.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class WebServiceWorkerRegistration; | |
| 15 | |
| 16 // The BackgroundSyncProvider is called by the SyncManager and SyncRegistration | |
| 17 // objects and communicates with the BackgroundSyncManager object in the browser | |
| 18 // process. Each thread will have its own instance (e.g. main thread, worker | |
| 19 // threads), instantiated as needed by SyncManager. Each instance of | |
| 20 // the provider creates a new mojo connection to a new | |
| 21 // BackgroundSyncManagerImpl, which then talks to the BackgroundSyncManager | |
| 22 // object. | |
|
iclelland
2016/11/14 18:43:07
Nit: re-wrap the paragraph
adithyas
2016/11/14 19:51:49
Done.
| |
| 23 class BackgroundSyncProvider { | |
| 24 WTF_MAKE_NONCOPYABLE(BackgroundSyncProvider); | |
| 25 | |
| 26 public: | |
| 27 BackgroundSyncProvider() = default; | |
| 28 | |
| 29 void registerBackgroundSync(mojom::blink::SyncRegistrationPtr options, | |
| 30 WebServiceWorkerRegistration*, | |
| 31 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.
| |
| 32 void getRegistrations(WebServiceWorkerRegistration*, | |
| 33 std::unique_ptr<SyncGetRegistrationsCallbacks>); | |
| 34 | |
| 35 private: | |
| 36 // Callback handlers | |
| 37 static void registerCallback( | |
| 38 std::unique_ptr<blink::SyncRegistrationCallbacks>, | |
| 39 mojom::blink::BackgroundSyncError, | |
| 40 mojom::blink::SyncRegistrationPtr options); | |
| 41 static void getRegistrationsCallback( | |
| 42 std::unique_ptr<SyncGetRegistrationsCallbacks>, | |
| 43 mojom::blink::BackgroundSyncError, | |
| 44 mojo::WTFArray<mojom::blink::SyncRegistrationPtr> registrations); | |
| 45 | |
| 46 // 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.
| |
| 47 mojom::blink::BackgroundSyncServicePtr& GetBackgroundSyncServicePtr(); | |
| 48 | |
| 49 mojom::blink::BackgroundSyncServicePtr m_backgroundSyncService; | |
| 50 }; | |
| 51 | |
| 52 } // namespace blink | |
| 53 | |
| 54 #endif // BackgroundSyncProvider_h | |
| OLD | NEW |