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

Unified Diff: content/browser/cache_storage/cache_storage_scheduler.h

Issue 2954433002: BackgroundSync: Convert to base::BindOnce/OnceCallback/OnceClosure (Closed)
Patch Set: rename local variable Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/cache_storage/cache_storage_scheduler.h
diff --git a/content/browser/cache_storage/cache_storage_scheduler.h b/content/browser/cache_storage/cache_storage_scheduler.h
index fdf668134c888f41a8449ef8b8f1654d4897faa2..85e173cbaa25afdca601d164e6f6163e9cd35d6f 100644
--- a/content/browser/cache_storage/cache_storage_scheduler.h
+++ b/content/browser/cache_storage/cache_storage_scheduler.h
@@ -47,24 +47,16 @@ class CONTENT_EXPORT CacheStorageScheduler {
template <typename... Args>
base::OnceCallback<void(Args...)> WrapCallbackToRunNext(
base::OnceCallback<void(Args...)> callback) {
- return base::BindOnce(
- &CacheStorageScheduler::RunNextOnceContinuation<Args...>,
- weak_ptr_factory_.GetWeakPtr(), std::move(callback));
- }
- template <typename... Args>
- base::RepeatingCallback<void(Args...)> WrapCallbackToRunNext(
- const base::RepeatingCallback<void(Args...)>& callback) {
- return base::BindRepeating(
- &CacheStorageScheduler::RunNextRepeatingContinuation<Args...>,
- weak_ptr_factory_.GetWeakPtr(), callback);
+ return base::BindOnce(&CacheStorageScheduler::RunNextContinuation<Args...>,
+ weak_ptr_factory_.GetWeakPtr(), std::move(callback));
}
private:
void RunOperationIfIdle();
template <typename... Args>
- void RunNextOnceContinuation(base::OnceCallback<void(Args...)> callback,
- Args... args) {
+ void RunNextContinuation(base::OnceCallback<void(Args...)> callback,
+ Args... args) {
// Grab a weak ptr to guard against the scheduler being deleted during the
// callback.
base::WeakPtr<CacheStorageScheduler> scheduler =
@@ -74,19 +66,6 @@ class CONTENT_EXPORT CacheStorageScheduler {
if (scheduler)
CompleteOperationAndRunNext();
}
- template <typename... Args>
- void RunNextRepeatingContinuation(
- const base::RepeatingCallback<void(Args...)>& callback,
- Args... args) {
- // Grab a weak ptr to guard against the scheduler being deleted during the
- // callback.
- base::WeakPtr<CacheStorageScheduler> scheduler =
- weak_ptr_factory_.GetWeakPtr();
-
- callback.Run(std::forward<Args>(args)...);
- if (scheduler)
- CompleteOperationAndRunNext();
- }
std::list<std::unique_ptr<CacheStorageOperation>> pending_operations_;
std::unique_ptr<CacheStorageOperation> running_operation_;
« no previous file with comments | « content/browser/background_sync/background_sync_service_impl_unittest.cc ('k') | content/test/test_background_sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698