From 77f760b5176be8295c3fffa42278df47082311ae Mon Sep 17 00:00:00 2001 From: Thomas Guilbert Date: Tue, 5 Jan 2021 21:18:38 +0000 Subject: [PATCH] Convert LocalToRemoteSyncer::Continuation to OnceCallback This CL changes LocalToRemoteSyncer::Continuation from Callback to OnceCallback. Bug: 1152272 Change-Id: Ie839b5982775429332c48d9c3930151a74f42423 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2604677 Commit-Queue: Thomas Guilbert Commit-Queue: Victor Costan Auto-Submit: Thomas Guilbert Reviewed-by: Victor Costan Cr-Commit-Position: refs/heads/master@{#840307} --- .../drive_backend/local_to_remote_syncer.cc | 8 ++++---- .../drive_backend/local_to_remote_syncer.h | 6 +++--- .../drive_backend/sync_engine_initializer.h | 2 -- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc index fc735e4c8b4d8d..9e187eeb083612 100644 --- a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc +++ b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc @@ -253,7 +253,7 @@ void LocalToRemoteSyncer::RunPreflight(std::unique_ptr token) { } void LocalToRemoteSyncer::MoveToBackground( - const Continuation& continuation, + Continuation continuation, std::unique_ptr token) { std::unique_ptr blocker(new TaskBlocker); blocker->app_id = url_.origin().host(); @@ -277,11 +277,11 @@ void LocalToRemoteSyncer::MoveToBackground( SyncTaskManager::UpdateTaskBlocker( std::move(token), std::move(blocker), base::BindOnce(&LocalToRemoteSyncer::ContinueAsBackgroundTask, - weak_ptr_factory_.GetWeakPtr(), continuation)); + weak_ptr_factory_.GetWeakPtr(), std::move(continuation))); } void LocalToRemoteSyncer::ContinueAsBackgroundTask( - const Continuation& continuation, + Continuation continuation, std::unique_ptr token) { // The SyncTask runs as a background task beyond this point. // Note that any task can run between MoveToBackground() and @@ -315,7 +315,7 @@ void LocalToRemoteSyncer::ContinueAsBackgroundTask( } } - continuation.Run(std::move(token)); + std::move(continuation).Run(std::move(token)); } void LocalToRemoteSyncer::SyncCompleted(std::unique_ptr token, diff --git a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h index 83f3413fbd88f3..e54ab0cfd6272f 100644 --- a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h +++ b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h @@ -39,7 +39,7 @@ class SyncEngineContext; class LocalToRemoteSyncer : public SyncTask { public: - typedef base::Callback)> Continuation; + typedef base::OnceCallback)> Continuation; LocalToRemoteSyncer(SyncEngineContext* sync_context, const SyncFileMetadata& local_metadata, @@ -58,9 +58,9 @@ class LocalToRemoteSyncer : public SyncTask { } private: - void MoveToBackground(const Continuation& continuation, + void MoveToBackground(Continuation continuation, std::unique_ptr token); - void ContinueAsBackgroundTask(const Continuation& continuation, + void ContinueAsBackgroundTask(Continuation continuation, std::unique_ptr token); void SyncCompleted(std::unique_ptr token, SyncStatusCode status); diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h b/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h index 1e2bc254259acb..3726ace931213b 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h @@ -72,8 +72,6 @@ class SyncEngineInitializer : public SyncTask { std::unique_ptr PassMetadataDatabase(); private: - typedef base::Callback Task; - void GetAboutResource(std::unique_ptr token); void DidGetAboutResource( std::unique_ptr token,