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

Side by Side Diff: content/browser/background_sync/background_sync_manager.h

Issue 2167483002: [CacheStorage] Simpler way to wrap callbacks to run pending operation completions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment clarification Created 4 years, 5 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
« no previous file with comments | « no previous file | content/browser/background_sync/background_sync_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 // OnStorageWiped callbacks 279 // OnStorageWiped callbacks
280 void OnStorageWipedImpl(const base::Closure& callback); 280 void OnStorageWipedImpl(const base::Closure& callback);
281 281
282 void OnNetworkChanged(); 282 void OnNetworkChanged();
283 283
284 // SetMaxSyncAttempts callback 284 // SetMaxSyncAttempts callback
285 void SetMaxSyncAttemptsImpl(int max_sync_attempts, 285 void SetMaxSyncAttemptsImpl(int max_sync_attempts,
286 const base::Closure& callback); 286 const base::Closure& callback);
287 287
288 // Operation Scheduling callback and convenience functions.
289 template <typename CallbackT, typename... Params>
290 void CompleteOperationCallback(const CallbackT& callback,
291 Params... parameters);
292 void CompleteStatusAndRegistrationCallback(
293 StatusAndRegistrationCallback callback,
294 BackgroundSyncStatus status,
295 std::unique_ptr<BackgroundSyncRegistration> registration);
296 void CompleteStatusAndRegistrationsCallback(
297 StatusAndRegistrationsCallback callback,
298 BackgroundSyncStatus status,
299 std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> registrations);
300 base::Closure MakeEmptyCompletion(); 288 base::Closure MakeEmptyCompletion();
301 base::Closure MakeClosureCompletion(const base::Closure& callback);
302 StatusAndRegistrationCallback MakeStatusAndRegistrationCompletion(
303 const StatusAndRegistrationCallback& callback);
304 StatusAndRegistrationsCallback MakeStatusAndRegistrationsCompletion(
305 const StatusAndRegistrationsCallback& callback);
306 BackgroundSyncManager::StatusCallback MakeStatusCompletion(
307 const StatusCallback& callback);
308 289
309 SWIdToRegistrationsMap active_registrations_; 290 SWIdToRegistrationsMap active_registrations_;
310 CacheStorageScheduler op_scheduler_; 291 CacheStorageScheduler op_scheduler_;
311 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; 292 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
312 293
313 std::unique_ptr<BackgroundSyncParameters> parameters_; 294 std::unique_ptr<BackgroundSyncParameters> parameters_;
314 295
315 // True if the manager is disabled and registrations should fail. 296 // True if the manager is disabled and registrations should fail.
316 bool disabled_; 297 bool disabled_;
317 298
318 // The number of registrations currently in the firing state. 299 // The number of registrations currently in the firing state.
319 int num_firing_registrations_; 300 int num_firing_registrations_;
320 301
321 base::CancelableCallback<void()> delayed_sync_task_; 302 base::CancelableCallback<void()> delayed_sync_task_;
322 303
323 std::unique_ptr<BackgroundSyncNetworkObserver> network_observer_; 304 std::unique_ptr<BackgroundSyncNetworkObserver> network_observer_;
324 305
325 std::unique_ptr<base::Clock> clock_; 306 std::unique_ptr<base::Clock> clock_;
326 307
327 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; 308 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_;
328 309
329 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); 310 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager);
330 }; 311 };
331 312
332 } // namespace content 313 } // namespace content
333 314
334 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ 315 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/background_sync/background_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698