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

Side by Side Diff: content/child/background_sync/background_sync_provider.h

Issue 1614063002: [BackgroundSync Cleanup] Remove periodic sync code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@purge_power
Patch Set: Address comments from PS3 Created 4 years, 11 months 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_ 5 #ifndef CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
6 #define CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_ 6 #define CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "content/common/background_sync_service.mojom.h" 14 #include "content/common/background_sync_service.mojom.h"
15 #include "content/public/child/worker_thread.h" 15 #include "content/public/child/worker_thread.h"
16 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProv ider.h" 16 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProv ider.h"
17 17
18 namespace base { 18 namespace base {
19 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
20 } 20 }
21 21
22 namespace content { 22 namespace content {
23 23
24 // The BackgroundSyncProvider is called by the SyncManager and SyncRegistration 24 // The BackgroundSyncProvider is called by the SyncManager and SyncRegistration
25 // objects (and their Periodic counterparts) and communicates with the 25 // objects and communicates with the BackgroundSyncManager object in the browser
26 // BackgroundSyncManager object in the browser process. Each thread will have 26 // process. Each thread will have its own instance (e.g. main thread, worker
27 // its own instance (e.g. main thread, worker threads), instantiated as needed 27 // threads), instantiated as needed by BlinkPlatformImpl. Each instance of
28 // by BlinkPlatformImpl. Each instance of the provider creates a new mojo 28 // the provider creates a new mojo connection to a new
29 // connection to a new BackgroundSyncManagerImpl, which then talks to the 29 // BackgroundSyncManagerImpl, which then talks to the BackgroundSyncManager
30 // BackgroundSyncManager object. 30 // object.
31 class BackgroundSyncProvider : public blink::WebSyncProvider, 31 class BackgroundSyncProvider : public blink::WebSyncProvider,
32 public WorkerThread::Observer { 32 public WorkerThread::Observer {
33 public: 33 public:
34 // Constructor made public to allow BlinkPlatformImpl to own a copy for the 34 // Constructor made public to allow BlinkPlatformImpl to own a copy for the
35 // main thread. Everyone else should use GetOrCreateThreadSpecificInstance(). 35 // main thread. Everyone else should use GetOrCreateThreadSpecificInstance().
36 explicit BackgroundSyncProvider( 36 explicit BackgroundSyncProvider(
37 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); 37 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner);
38 38
39 ~BackgroundSyncProvider() override; 39 ~BackgroundSyncProvider() override;
40 40
41 // Returns thread-specific instance (if exists). Otherwise, a new instance 41 // Returns thread-specific instance (if exists). Otherwise, a new instance
42 // will be created for the thread, except when called for a worker thread that 42 // will be created for the thread, except when called for a worker thread that
43 // has already been stopped. 43 // has already been stopped.
44 static BackgroundSyncProvider* GetOrCreateThreadSpecificInstance( 44 static BackgroundSyncProvider* GetOrCreateThreadSpecificInstance(
45 base::SingleThreadTaskRunner* main_thread_task_runner); 45 base::SingleThreadTaskRunner* main_thread_task_runner);
46 46
47 // blink::WebSyncProvider implementation 47 // blink::WebSyncProvider implementation
48 void registerBackgroundSync( 48 void registerBackgroundSync(
49 const blink::WebSyncRegistration* options, 49 const blink::WebSyncRegistration* options,
50 blink::WebServiceWorkerRegistration* service_worker_registration, 50 blink::WebServiceWorkerRegistration* service_worker_registration,
51 bool requested_from_service_worker, 51 bool requested_from_service_worker,
52 blink::WebSyncRegistrationCallbacks* callbacks) override; 52 blink::WebSyncRegistrationCallbacks* callbacks) override;
53 void unregisterBackgroundSync( 53 void unregisterBackgroundSync(
54 int64_t handle_id, 54 int64_t handle_id,
55 blink::WebServiceWorkerRegistration* service_worker_registration, 55 blink::WebServiceWorkerRegistration* service_worker_registration,
56 blink::WebSyncUnregistrationCallbacks* callbacks) override; 56 blink::WebSyncUnregistrationCallbacks* callbacks) override;
57 void getRegistration( 57 void getRegistration(
58 blink::WebSyncRegistration::Periodicity,
59 const blink::WebString& tag, 58 const blink::WebString& tag,
60 blink::WebServiceWorkerRegistration* service_worker_registration, 59 blink::WebServiceWorkerRegistration* service_worker_registration,
61 blink::WebSyncRegistrationCallbacks* callbacks) override; 60 blink::WebSyncRegistrationCallbacks* callbacks) override;
62 void getRegistrations( 61 void getRegistrations(
63 blink::WebSyncRegistration::Periodicity periodicity,
64 blink::WebServiceWorkerRegistration* service_worker_registration, 62 blink::WebServiceWorkerRegistration* service_worker_registration,
65 blink::WebSyncGetRegistrationsCallbacks* callbacks) override; 63 blink::WebSyncGetRegistrationsCallbacks* callbacks) override;
66 void getPermissionStatus( 64 void getPermissionStatus(
67 blink::WebSyncRegistration::Periodicity periodicity,
68 blink::WebServiceWorkerRegistration* service_worker_registration, 65 blink::WebServiceWorkerRegistration* service_worker_registration,
69 blink::WebSyncGetPermissionStatusCallbacks* callbacks) override; 66 blink::WebSyncGetPermissionStatusCallbacks* callbacks) override;
70 // TODO(jkarlin): Rename to releaseRegistrationHandle. 67 // TODO(jkarlin): Rename to releaseRegistrationHandle.
71 void releaseRegistration(int64_t handle_id) override; 68 void releaseRegistration(int64_t handle_id) override;
72 void notifyWhenFinished( 69 void notifyWhenFinished(
73 int64_t handle_id, 70 int64_t handle_id,
74 blink::WebSyncNotifyWhenFinishedCallbacks* callbacks) override; 71 blink::WebSyncNotifyWhenFinishedCallbacks* callbacks) override;
75 72
76 void DuplicateRegistrationHandle( 73 void DuplicateRegistrationHandle(
77 int64_t handle_id, 74 int64_t handle_id,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 109
113 BackgroundSyncServicePtr background_sync_service_; 110 BackgroundSyncServicePtr background_sync_service_;
114 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 111 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
115 112
116 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProvider); 113 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProvider);
117 }; 114 };
118 115
119 } // namespace content 116 } // namespace content
120 117
121 #endif // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_ 118 #endif // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698