Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Unified Diff: third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h

Issue 2473483012: Move content/child/background_sync to Blink. (Closed)
Patch Set: Remove background_sync_type_converters_unittest Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698