Skip to content

Commit

Permalink
Convert LocalToRemoteSyncer::Continuation to OnceCallback
Browse files Browse the repository at this point in the history
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 <tguilbert@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Auto-Submit: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840307}
  • Loading branch information
tguilbert-google authored and Chromium LUCI CQ committed Jan 5, 2021
1 parent 00b1b27 commit 77f760b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void LocalToRemoteSyncer::RunPreflight(std::unique_ptr<SyncTaskToken> token) {
}

void LocalToRemoteSyncer::MoveToBackground(
const Continuation& continuation,
Continuation continuation,
std::unique_ptr<SyncTaskToken> token) {
std::unique_ptr<TaskBlocker> blocker(new TaskBlocker);
blocker->app_id = url_.origin().host();
Expand All @@ -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<SyncTaskToken> token) {
// The SyncTask runs as a background task beyond this point.
// Note that any task can run between MoveToBackground() and
Expand Down Expand Up @@ -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<SyncTaskToken> token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SyncEngineContext;

class LocalToRemoteSyncer : public SyncTask {
public:
typedef base::Callback<void(std::unique_ptr<SyncTaskToken>)> Continuation;
typedef base::OnceCallback<void(std::unique_ptr<SyncTaskToken>)> Continuation;

LocalToRemoteSyncer(SyncEngineContext* sync_context,
const SyncFileMetadata& local_metadata,
Expand All @@ -58,9 +58,9 @@ class LocalToRemoteSyncer : public SyncTask {
}

private:
void MoveToBackground(const Continuation& continuation,
void MoveToBackground(Continuation continuation,
std::unique_ptr<SyncTaskToken> token);
void ContinueAsBackgroundTask(const Continuation& continuation,
void ContinueAsBackgroundTask(Continuation continuation,
std::unique_ptr<SyncTaskToken> token);
void SyncCompleted(std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class SyncEngineInitializer : public SyncTask {
std::unique_ptr<MetadataDatabase> PassMetadataDatabase();

private:
typedef base::Callback<void(SyncStatusCallback callback)> Task;

void GetAboutResource(std::unique_ptr<SyncTaskToken> token);
void DidGetAboutResource(
std::unique_ptr<SyncTaskToken> token,
Expand Down

0 comments on commit 77f760b

Please sign in to comment.