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

Side by Side Diff: third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h

Issue 2473483012: Move content/child/background_sync to Blink. (Closed)
Patch Set: Code review changes 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 unified diff | Download patch
OLDNEW
(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 "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h"
Peter Beverloo 2016/11/08 16:45:11 micro nit: you can forward declare WebServiceWorke
adithyas 2016/11/08 18:26:19 Done.
11 #include "wtf/Noncopyable.h"
12 #include <memory>
13 #include <stdint.h>
14 #include <string>
Peter Beverloo 2016/11/08 16:45:11 nit: these three includes are unused.
adithyas 2016/11/08 18:26:19 Done.
15
16 namespace blink {
17
18 // The BackgroundSyncProvider is called by the SyncManager and SyncRegistration
19 // objects and communicates with the BackgroundSyncManager object in the browser
20 // process. Each thread will have its own instance (e.g. main thread, worker
21 // threads), instantiated as needed by SyncManager. Each instance of
22 // the provider creates a new mojo connection to a new
23 // BackgroundSyncManagerImpl, which then talks to the BackgroundSyncManager
24 // object.
25 class BackgroundSyncProvider {
Peter Beverloo 2016/11/08 16:45:11 BackgroundSyncProvider used to observe the WorkerT
jbroman 2016/11/08 17:39:32 WTF::ThreadSpecific dies when the thread dies.
adithyas 2016/11/08 18:26:19 My initial implementation did have one instance of
26 WTF_MAKE_NONCOPYABLE(BackgroundSyncProvider);
27
28 public:
29 BackgroundSyncProvider() = default;
30
31 void registerBackgroundSync(mojom::blink::SyncRegistrationPtr options,
32 WebServiceWorkerRegistration*,
33 std::unique_ptr<SyncRegistrationCallbacks>);
34 void getRegistrations(WebServiceWorkerRegistration*,
35 std::unique_ptr<SyncGetRegistrationsCallbacks>);
36
37 private:
38 // Callback handlers
39 static void registerCallback(
40 std::unique_ptr<blink::SyncRegistrationCallbacks>,
41 mojom::blink::BackgroundSyncError,
42 mojom::blink::SyncRegistrationPtr options);
43 static void getRegistrationsCallback(
44 std::unique_ptr<SyncGetRegistrationsCallbacks>,
45 mojom::blink::BackgroundSyncError,
46 mojo::WTFArray<mojom::blink::SyncRegistrationPtr> registrations);
47
48 // Helper method that returns an initialized BackgroundSyncServicePtr.
49 mojom::blink::BackgroundSyncServicePtr& GetBackgroundSyncServicePtr();
50
51 mojom::blink::BackgroundSyncServicePtr m_backgroundSyncService;
52 };
53
54 } // namespace blink
55
56 #endif // BackgroundSyncProvider_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698