0

Use base::BindOnce for Post[Delayed]TaskWithTraits callbacks.

Post[Delayed]TaskWithTraits() takes a OnceCallback. Replace usage of
base::Bind(), which produces a RepeatingCallback, with base::BindOnce()
when the callback is created as a temporary inside of PostTask(). The
following regex was used to find instances that could be replaced:

(Post(?:Delayed)?TaskWithTraits)\((?:\n\s*)?FROM_HERE,\n?\s*(\{.*?\n?.*?\}),(?:\n)?\s*base::Bind\(

Also replace any usage of base::Passed(&var) with std::move(var) for
variables passed to base::BindOnce(). base::Passed() isn't needed for
move-only types with OnceCallbacks.

This CL was uploaded by git cl split.

R=tapted@chromium.org

Bug: 714018
Change-Id: I875c9d84c41f43fb1032da0fb906a46f544c41e9
Reviewed-on: https://chromium-review.googlesource.com/c/1486153
Auto-Submit: kylechar <kylechar@chromium.org>
Reviewed-by: Trent Apted <tapted@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635321}
This commit is contained in:
kylechar
2019-02-26 00:14:59 +00:00
committed by Commit Bot
parent b840613b8c
commit 6de6f02bb1

@ -160,8 +160,8 @@ class PlatformAppPathLauncher
FROM_HERE,
{base::TaskPriority::USER_VISIBLE, base::MayBlock(),
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::Bind(&PlatformAppPathLauncher::MakePathAbsolute, this,
current_directory));
base::BindOnce(&PlatformAppPathLauncher::MakePathAbsolute, this,
current_directory));
}
private:
@ -184,7 +184,7 @@ class PlatformAppPathLauncher
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::UI},
base::Bind(&PlatformAppPathLauncher::Launch, this));
base::BindOnce(&PlatformAppPathLauncher::Launch, this));
}
void OnFilesValid(std::unique_ptr<std::set<base::FilePath>> directory_paths) {