OLD | NEW |
---|---|
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_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "content/browser/background_sync/background_sync.pb.h" | 16 #include "content/browser/background_sync/background_sync.pb.h" |
17 #include "content/browser/background_sync/background_sync_registration.h" | 17 #include "content/browser/background_sync/background_sync_registration.h" |
18 #include "content/browser/background_sync/background_sync_status.h" | 18 #include "content/browser/background_sync/background_sync_status.h" |
19 #include "content/browser/cache_storage/cache_storage_scheduler.h" | 19 #include "content/browser/cache_storage/cache_storage_scheduler.h" |
20 #include "content/browser/service_worker/service_worker_context_observer.h" | 20 #include "content/browser/service_worker/service_worker_context_observer.h" |
21 #include "content/browser/service_worker/service_worker_storage.h" | 21 #include "content/browser/service_worker/service_worker_storage.h" |
22 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
23 #include "content/common/service_worker/service_worker_status_code.h" | 23 #include "content/common/service_worker/service_worker_status_code.h" |
24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 class BackgroundSyncNetworkObserver; | 28 class BackgroundSyncNetworkObserver; |
29 class BackgroundSyncPowerObserver; | 29 class BackgroundSyncPowerObserver; |
30 class ClientBackgroundSyncRegistration; | |
30 class ServiceWorkerContextWrapper; | 31 class ServiceWorkerContextWrapper; |
31 | 32 |
32 // BackgroundSyncManager manages and stores the set of background sync | 33 // BackgroundSyncManager manages and stores the set of background sync |
33 // registrations across all registered service workers for a profile. | 34 // registrations across all registered service workers for a profile. |
34 // Registrations are stored along with their associated Service Worker | 35 // Registrations are stored along with their associated Service Worker |
35 // registration in ServiceWorkerStorage. If the ServiceWorker is unregistered, | 36 // registration in ServiceWorkerStorage. If the ServiceWorker is unregistered, |
36 // the sync registrations are removed. This class expects to be run on the IO | 37 // the sync registrations are removed. This class expects to be run on the IO |
37 // thread. The asynchronous methods are executed sequentially. | 38 // thread. The asynchronous methods are executed sequentially. |
38 | 39 |
39 // TODO(jkarlin): Check permissions when registering, scheduling, and firing | 40 // TODO(jkarlin): Check permissions when registering, scheduling, and firing |
40 // background sync. In the meantime, --enable-service-worker-sync is required to | 41 // background sync. In the meantime, --enable-service-worker-sync is required to |
41 // fire a sync event. | 42 // fire a sync event. |
42 // TODO(jkarlin): Unregister syncs when permission is revoked. | 43 // TODO(jkarlin): Unregister syncs when permission is revoked. |
43 // TODO(jkarlin): Create a background sync scheduler to actually run the | 44 // TODO(jkarlin): Create a background sync scheduler to actually run the |
44 // registered events. | 45 // registered events. |
45 // TODO(jkarlin): Keep the browser alive if "Let Google Chrome Run in the | 46 // TODO(jkarlin): Keep the browser alive if "Let Google Chrome Run in the |
46 // Background" is true and a sync is registered. | 47 // Background" is true and a sync is registered. |
47 class CONTENT_EXPORT BackgroundSyncManager | 48 class CONTENT_EXPORT BackgroundSyncManager |
48 : NON_EXPORTED_BASE(public ServiceWorkerContextObserver) { | 49 : NON_EXPORTED_BASE(public ServiceWorkerContextObserver) { |
49 public: | 50 public: |
50 using StatusCallback = base::Callback<void(BackgroundSyncStatus)>; | 51 using StatusCallback = base::Callback<void(BackgroundSyncStatus)>; |
51 using StatusAndRegistrationCallback = | 52 using StatusAndRegistrationCallback = |
52 base::Callback<void(BackgroundSyncStatus, | 53 base::Callback<void(BackgroundSyncStatus, |
53 const BackgroundSyncRegistration&)>; | 54 scoped_ptr<ClientBackgroundSyncRegistration>)>; |
54 using StatusAndRegistrationsCallback = | 55 using StatusAndRegistrationsCallback = base::Callback<void( |
55 base::Callback<void(BackgroundSyncStatus, | 56 BackgroundSyncStatus, |
56 const std::vector<BackgroundSyncRegistration>&)>; | 57 scoped_ptr<ScopedVector<ClientBackgroundSyncRegistration>>)>; |
57 | 58 |
58 static scoped_ptr<BackgroundSyncManager> Create( | 59 static scoped_ptr<BackgroundSyncManager> Create( |
59 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context); | 60 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context); |
60 ~BackgroundSyncManager() override; | 61 ~BackgroundSyncManager() override; |
61 | 62 |
62 // Stores the given background sync registration and adds it to the scheduling | 63 // Stores the given background sync registration and adds it to the scheduling |
63 // queue. It will overwrite an existing registration with the same tag and | 64 // queue. It will overwrite an existing registration with the same tag and |
64 // periodicity unless they're identical (save for the id). Calls |callback| | 65 // periodicity unless they're identical (save for the id). Calls |callback| |
65 // with BACKGROUND_SYNC_STATUS_OK and the accepted registration on success. | 66 // with BACKGROUND_SYNC_STATUS_OK and the accepted registration on success. |
66 // The accepted registration will have a unique id. It may also have altered | 67 // The accepted registration will have a unique id. It may also have altered |
67 // parameters if the user or UA chose different parameters than those | 68 // parameters if the user or UA chose different parameters than those |
68 // supplied. | 69 // supplied. |
69 void Register(int64 sw_registration_id, | 70 void Register(int64 sw_registration_id, |
70 const BackgroundSyncRegistrationOptions& options, | 71 const BackgroundSyncRegistrationOptions& options, |
71 const StatusAndRegistrationCallback& callback); | 72 const StatusAndRegistrationCallback& callback); |
72 | 73 |
73 // Removes the background sync with tag |sync_registration_tag|, periodicity | |
74 // |periodicity|, and id |sync_registration_id|. Calls |callback| with | |
75 // BACKGROUND_SYNC_STATUS_NOT_FOUND if no match is found. Calls |callback| | |
76 // with BACKGROUND_SYNC_STATUS_OK on success. | |
77 void Unregister( | |
78 int64 sw_registration_id, | |
79 const std::string& sync_registration_tag, | |
80 SyncPeriodicity periodicity, | |
81 BackgroundSyncRegistration::RegistrationId sync_registration_id, | |
82 const StatusCallback& callback); | |
83 | |
84 // Finds the background sync registration associated with | 74 // Finds the background sync registration associated with |
85 // |sw_registration_id| with periodicity |periodicity|. Calls | 75 // |sw_registration_id| with periodicity |periodicity|. Calls |
86 // |callback| with BACKGROUND_SYNC_STATUS_NOT_FOUND if it doesn't exist. Calls | 76 // |callback| with BACKGROUND_SYNC_STATUS_NOT_FOUND if it doesn't exist. Calls |
87 // |callback| with BACKGROUND_SYNC_STATUS_OK on success. | 77 // |callback| with BACKGROUND_SYNC_STATUS_OK on success. |
88 void GetRegistration(int64 sw_registration_id, | 78 void GetRegistration(int64 sw_registration_id, |
89 const std::string& sync_registration_tag, | 79 const std::string& sync_registration_tag, |
90 SyncPeriodicity periodicity, | 80 SyncPeriodicity periodicity, |
91 const StatusAndRegistrationCallback& callback); | 81 const StatusAndRegistrationCallback& callback); |
92 | 82 |
93 void GetRegistrations(int64 sw_registration_id, | 83 void GetRegistrations(int64 sw_registration_id, |
94 SyncPeriodicity periodicity, | 84 SyncPeriodicity periodicity, |
95 const StatusAndRegistrationsCallback& callback); | 85 const StatusAndRegistrationsCallback& callback); |
96 | 86 |
97 // ServiceWorkerContextObserver overrides. | 87 // ServiceWorkerContextObserver overrides. |
98 void OnRegistrationDeleted(int64 registration_id, | 88 void OnRegistrationDeleted(int64 registration_id, |
99 const GURL& pattern) override; | 89 const GURL& pattern) override; |
100 void OnStorageWiped() override; | 90 void OnStorageWiped() override; |
101 | 91 |
102 protected: | 92 protected: |
93 // A registration might be referenced by the client longer than | |
94 // the BackgroundSyncManager needs to keep track of it (e.g., the event has | |
95 // finished firing). The BackgroundSyncManager reference counts its | |
96 // registrations internally and every ClientBackgroundSyncRegistration has a | |
97 // unique registration id which maps to a locally maintained (in | |
98 // client_registration_ids_) scoped_refptr. | |
99 class RefCountedRegistration | |
100 : public base::RefCounted<RefCountedRegistration> { | |
101 public: | |
102 BackgroundSyncRegistration* value() { return ®istration_; } | |
103 const BackgroundSyncRegistration* value() const { return ®istration_; } | |
104 | |
105 private: | |
106 friend class base::RefCounted<RefCountedRegistration>; | |
107 virtual ~RefCountedRegistration() {} | |
108 | |
109 BackgroundSyncRegistration registration_; | |
110 }; | |
111 | |
103 explicit BackgroundSyncManager( | 112 explicit BackgroundSyncManager( |
104 const scoped_refptr<ServiceWorkerContextWrapper>& context); | 113 const scoped_refptr<ServiceWorkerContextWrapper>& context); |
105 | 114 |
106 // Init must be called before any public member function. Only call it once. | 115 // Init must be called before any public member function. Only call it once. |
107 void Init(); | 116 void Init(); |
108 | 117 |
109 // The following methods are virtual for testing. | 118 // The following methods are virtual for testing. |
110 virtual void StoreDataInBackend( | 119 virtual void StoreDataInBackend( |
111 int64 sw_registration_id, | 120 int64 sw_registration_id, |
112 const GURL& origin, | 121 const GURL& origin, |
113 const std::string& backend_key, | 122 const std::string& backend_key, |
114 const std::string& data, | 123 const std::string& data, |
115 const ServiceWorkerStorage::StatusCallback& callback); | 124 const ServiceWorkerStorage::StatusCallback& callback); |
116 virtual void GetDataFromBackend( | 125 virtual void GetDataFromBackend( |
117 const std::string& backend_key, | 126 const std::string& backend_key, |
118 const ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback& | 127 const ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback& |
119 callback); | 128 callback); |
120 virtual void FireOneShotSync( | 129 virtual void FireOneShotSync( |
121 const BackgroundSyncRegistration& registration, | 130 RefCountedRegistration* registration, |
122 const scoped_refptr<ServiceWorkerVersion>& active_version, | 131 const scoped_refptr<ServiceWorkerVersion>& active_version, |
123 const ServiceWorkerVersion::StatusCallback& callback); | 132 const ServiceWorkerVersion::StatusCallback& callback); |
124 | 133 |
125 private: | 134 private: |
135 friend class ClientBackgroundSyncRegistration; | |
136 | |
126 class RegistrationKey { | 137 class RegistrationKey { |
127 public: | 138 public: |
128 explicit RegistrationKey(const BackgroundSyncRegistration& registration); | 139 explicit RegistrationKey(const BackgroundSyncRegistration& registration); |
129 explicit RegistrationKey(const BackgroundSyncRegistrationOptions& options); | 140 explicit RegistrationKey(const BackgroundSyncRegistrationOptions& options); |
130 RegistrationKey(const std::string& tag, SyncPeriodicity periodicity); | 141 RegistrationKey(const std::string& tag, SyncPeriodicity periodicity); |
131 RegistrationKey(const RegistrationKey& other) = default; | 142 RegistrationKey(const RegistrationKey& other) = default; |
132 RegistrationKey& operator=(const RegistrationKey& other) = default; | 143 RegistrationKey& operator=(const RegistrationKey& other) = default; |
133 | 144 |
134 bool operator<(const RegistrationKey& rhs) const { | 145 bool operator<(const RegistrationKey& rhs) const { |
135 return value_ < rhs.value_; | 146 return value_ < rhs.value_; |
136 } | 147 } |
137 | 148 |
138 private: | 149 private: |
139 std::string value_; | 150 std::string value_; |
140 }; | 151 }; |
141 | 152 |
142 struct BackgroundSyncRegistrations { | 153 struct BackgroundSyncRegistrations { |
143 using RegistrationMap = | 154 using RegistrationMap = |
144 std::map<RegistrationKey, BackgroundSyncRegistration>; | 155 std::map<RegistrationKey, scoped_refptr<RefCountedRegistration>>; |
145 | 156 |
146 BackgroundSyncRegistrations(); | 157 BackgroundSyncRegistrations(); |
147 ~BackgroundSyncRegistrations(); | 158 ~BackgroundSyncRegistrations(); |
148 | 159 |
149 RegistrationMap registration_map; | 160 RegistrationMap registration_map; |
150 BackgroundSyncRegistration::RegistrationId next_id; | 161 BackgroundSyncRegistration::RegistrationId next_id; |
151 GURL origin; | 162 GURL origin; |
152 }; | 163 }; |
153 | 164 |
154 using PermissionStatusCallback = base::Callback<void(bool)>; | 165 using PermissionStatusCallback = base::Callback<void(bool)>; |
155 using SWIdToRegistrationsMap = std::map<int64, BackgroundSyncRegistrations>; | 166 using SWIdToRegistrationsMap = std::map<int64, BackgroundSyncRegistrations>; |
156 | 167 |
168 // Removes the background sync with tag |sync_registration_tag|, periodicity | |
iclelland
2015/08/14 14:44:18
|sync_registration_tag| isn't a parameter here any
jkarlin
2015/08/17 17:14:49
Done.
| |
169 // |periodicity|, and id |sync_registration_id|. Calls |callback| with | |
170 // BACKGROUND_SYNC_STATUS_NOT_FOUND if no match is found. Calls |callback| | |
171 // with BACKGROUND_SYNC_STATUS_OK on success. | |
172 void Unregister( | |
173 int64 sw_registration_id, | |
174 SyncPeriodicity periodicity, | |
175 BackgroundSyncRegistration::RegistrationId sync_registration_id, | |
176 const StatusCallback& callback); | |
177 | |
178 // The BackgroundSyncManager holds references to registrations that have | |
179 // active ClientBackgroundSyncRegistrations. ClientBackgroundSyncRegistrations | |
180 // call this function on deletion so that the manager can free up old | |
181 // registrations. | |
182 void ReleaseRegistration(BackgroundSyncRegistration::RegistrationId sync_id); | |
183 | |
157 // Disable the manager. Already queued operations will abort once they start | 184 // Disable the manager. Already queued operations will abort once they start |
158 // to run (in their impl methods). Future operations will not queue. Any | 185 // to run (in their impl methods). Future operations will not queue. Any |
159 // registrations are cleared from memory and the backend (if it's still | 186 // registrations are cleared from memory and the backend (if it's still |
160 // functioning). The manager will reenable itself once it receives the | 187 // functioning). The manager will reenable itself once it receives the |
161 // OnStorageWiped message or on browser restart. | 188 // OnStorageWiped message or on browser restart. |
162 void DisableAndClearManager(const base::Closure& callback); | 189 void DisableAndClearManager(const base::Closure& callback); |
163 void DisableAndClearDidGetRegistrations( | 190 void DisableAndClearDidGetRegistrations( |
164 const base::Closure& callback, | 191 const base::Closure& callback, |
165 const std::vector<std::pair<int64, std::string>>& user_data, | 192 const std::vector<std::pair<int64, std::string>>& user_data, |
166 ServiceWorkerStatusCode status); | 193 ServiceWorkerStatusCode status); |
167 void DisableAndClearManagerClearedOne(const base::Closure& barrier_closure, | 194 void DisableAndClearManagerClearedOne(const base::Closure& barrier_closure, |
168 ServiceWorkerStatusCode status); | 195 ServiceWorkerStatusCode status); |
169 | 196 |
170 // Returns the existing registration in |existing_registration| if it is not | 197 // Returns the existing registration in |existing_registration| if it is not |
171 // null. | 198 // null. |
172 BackgroundSyncRegistration* LookupRegistration( | 199 RefCountedRegistration* LookupRegistration( |
173 int64 sw_registration_id, | 200 int64 sw_registration_id, |
174 const RegistrationKey& registration_key); | 201 const RegistrationKey& registration_key); |
175 | 202 |
176 // Store all registrations for a given |sw_registration_id|. | 203 // Store all registrations for a given |sw_registration_id|. |
177 void StoreRegistrations(int64 sw_registration_id, | 204 void StoreRegistrations(int64 sw_registration_id, |
178 const ServiceWorkerStorage::StatusCallback& callback); | 205 const ServiceWorkerStorage::StatusCallback& callback); |
179 | 206 |
180 // Removes the registration if it is in the map. | 207 // Removes the registration if it is in the map. |
181 void RemoveRegistrationFromMap(int64 sw_registration_id, | 208 void RemoveRegistrationFromMap(int64 sw_registration_id, |
182 const RegistrationKey& registration_key); | 209 const RegistrationKey& registration_key); |
183 | 210 |
184 void AddRegistrationToMap( | 211 void AddRegistrationToMap( |
185 int64 sw_registration_id, | 212 int64 sw_registration_id, |
186 const GURL& origin, | 213 const GURL& origin, |
187 const BackgroundSyncRegistration& sync_registration); | 214 const scoped_refptr<RefCountedRegistration>& sync_registration); |
188 | 215 |
189 void InitImpl(const base::Closure& callback); | 216 void InitImpl(const base::Closure& callback); |
190 void InitDidGetDataFromBackend( | 217 void InitDidGetDataFromBackend( |
191 const base::Closure& callback, | 218 const base::Closure& callback, |
192 const std::vector<std::pair<int64, std::string>>& user_data, | 219 const std::vector<std::pair<int64, std::string>>& user_data, |
193 ServiceWorkerStatusCode status); | 220 ServiceWorkerStatusCode status); |
194 | 221 |
195 // Register callbacks | 222 // Register callbacks |
196 void RegisterImpl(int64 sw_registration_id, | 223 void RegisterImpl(int64 sw_registration_id, |
197 const BackgroundSyncRegistrationOptions& options, | 224 const BackgroundSyncRegistrationOptions& options, |
198 const StatusAndRegistrationCallback& callback); | 225 const StatusAndRegistrationCallback& callback); |
199 void RegisterDidStore(int64 sw_registration_id, | 226 void RegisterDidStore( |
200 const BackgroundSyncRegistration& sync_registration, | 227 int64 sw_registration_id, |
201 const StatusAndRegistrationCallback& callback, | 228 const scoped_refptr<RefCountedRegistration>& new_registration_ref, |
202 ServiceWorkerStatusCode status); | 229 const StatusAndRegistrationCallback& callback, |
230 ServiceWorkerStatusCode status); | |
203 | 231 |
204 // Unregister callbacks | 232 // Unregister callbacks |
205 void UnregisterImpl( | 233 void UnregisterImpl( |
206 int64 sw_registration_id, | 234 int64 sw_registration_id, |
207 const RegistrationKey& registration_key, | 235 SyncPeriodicity periodicity, |
208 BackgroundSyncRegistration::RegistrationId sync_registration_id, | 236 BackgroundSyncRegistration::RegistrationId sync_registration_id, |
209 SyncPeriodicity periodicity, | |
210 const StatusCallback& callback); | 237 const StatusCallback& callback); |
211 void UnregisterDidStore(int64 sw_registration_id, | 238 void UnregisterDidStore(int64 sw_registration_id, |
212 SyncPeriodicity periodicity, | 239 SyncPeriodicity periodicity, |
213 const StatusCallback& callback, | 240 const StatusCallback& callback, |
214 ServiceWorkerStatusCode status); | 241 ServiceWorkerStatusCode status); |
215 | 242 |
216 // GetRegistration callbacks | 243 // GetRegistration callbacks |
217 void GetRegistrationImpl(int64 sw_registration_id, | 244 void GetRegistrationImpl(int64 sw_registration_id, |
218 const RegistrationKey& registration_key, | 245 const RegistrationKey& registration_key, |
219 const StatusAndRegistrationCallback& callback); | 246 const StatusAndRegistrationCallback& callback); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 static void OnAllSyncEventsCompleted(const base::TimeTicks& start_time, | 295 static void OnAllSyncEventsCompleted(const base::TimeTicks& start_time, |
269 int number_of_batched_sync_events); | 296 int number_of_batched_sync_events); |
270 | 297 |
271 // OnRegistrationDeleted callbacks | 298 // OnRegistrationDeleted callbacks |
272 void OnRegistrationDeletedImpl(int64 registration_id, | 299 void OnRegistrationDeletedImpl(int64 registration_id, |
273 const base::Closure& callback); | 300 const base::Closure& callback); |
274 | 301 |
275 // OnStorageWiped callbacks | 302 // OnStorageWiped callbacks |
276 void OnStorageWipedImpl(const base::Closure& callback); | 303 void OnStorageWipedImpl(const base::Closure& callback); |
277 | 304 |
305 scoped_ptr<ClientBackgroundSyncRegistration> CreateClientRegistration( | |
306 RefCountedRegistration* registration); | |
307 | |
278 void OnNetworkChanged(); | 308 void OnNetworkChanged(); |
279 void OnPowerChanged(); | 309 void OnPowerChanged(); |
280 | 310 |
281 // Operation Scheduling callback and convenience functions. | 311 // Operation Scheduling callback and convenience functions. |
282 template <typename CallbackT, typename... Params> | 312 template <typename CallbackT, typename... Params> |
283 void CompleteOperationCallback(const CallbackT& callback, | 313 void CompleteOperationCallback(const CallbackT& callback, |
284 Params... parameters); | 314 Params... parameters); |
315 void CompleteStatusAndRegistrationCallback( | |
316 StatusAndRegistrationCallback callback, | |
317 BackgroundSyncStatus status, | |
318 scoped_ptr<ClientBackgroundSyncRegistration> result); | |
319 void CompleteStatusAndRegistrationsCallback( | |
320 StatusAndRegistrationsCallback callback, | |
321 BackgroundSyncStatus status, | |
322 scoped_ptr<ScopedVector<ClientBackgroundSyncRegistration>> results); | |
285 base::Closure MakeEmptyCompletion(); | 323 base::Closure MakeEmptyCompletion(); |
286 base::Closure MakeClosureCompletion(const base::Closure& callback); | 324 base::Closure MakeClosureCompletion(const base::Closure& callback); |
287 StatusAndRegistrationCallback MakeStatusAndRegistrationCompletion( | 325 StatusAndRegistrationCallback MakeStatusAndRegistrationCompletion( |
288 const StatusAndRegistrationCallback& callback); | 326 const StatusAndRegistrationCallback& callback); |
289 StatusAndRegistrationsCallback MakeStatusAndRegistrationsCompletion( | 327 StatusAndRegistrationsCallback MakeStatusAndRegistrationsCompletion( |
290 const StatusAndRegistrationsCallback& callback); | 328 const StatusAndRegistrationsCallback& callback); |
291 BackgroundSyncManager::StatusCallback MakeStatusCompletion( | 329 BackgroundSyncManager::StatusCallback MakeStatusCompletion( |
292 const StatusCallback& callback); | 330 const StatusCallback& callback); |
293 | 331 |
294 SWIdToRegistrationsMap sw_to_registrations_map_; | 332 SWIdToRegistrationsMap sw_to_registrations_map_; |
295 CacheStorageScheduler op_scheduler_; | 333 CacheStorageScheduler op_scheduler_; |
296 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 334 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
297 bool disabled_; | 335 bool disabled_; |
298 | 336 |
299 scoped_ptr<BackgroundSyncNetworkObserver> network_observer_; | 337 scoped_ptr<BackgroundSyncNetworkObserver> network_observer_; |
300 scoped_ptr<BackgroundSyncPowerObserver> power_observer_; | 338 scoped_ptr<BackgroundSyncPowerObserver> power_observer_; |
301 | 339 |
340 // The registrations that clients might still reference. | |
341 IDMap<scoped_refptr<RefCountedRegistration>, IDMapOwnPointer> | |
342 client_registration_ids_; | |
343 | |
302 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; | 344 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; |
303 | 345 |
304 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); | 346 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); |
305 }; | 347 }; |
306 | 348 |
307 } // namespace content | 349 } // namespace content |
308 | 350 |
309 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 351 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
OLD | NEW |