Commit acbc9aef authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Remove unnecessary base::Passed() with base::BindOnce()

The documentation on base::Callback<...> (src/docs/callback.md)
recommends against using base::Passed(...) with base::BindOnce.

> Avoid using `base::Passed()` with `base::BindOnce()`, as `std::move()`
> does the same thing and is more familiar.

Also convert uses of base::Bind() that can be trivially converted to
use base::BindOnce() so that the base::Passed() can be removed from
the binding.

This CL was uploaded by git cl split.

Bug: 812523
Change-Id: I575592bb0d3d316f47c4e654f800ee51f66f2538
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611883
Commit-Queue: Satoru Takabayashi <satorux@chromium.org>
Reviewed-by: default avatarSatoru Takabayashi <satorux@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660735}
parent 90f424b4
...@@ -102,10 +102,9 @@ void KioskAppDataBase::SaveIcon(const SkBitmap& icon, ...@@ -102,10 +102,9 @@ void KioskAppDataBase::SaveIcon(const SkBitmap& icon,
const base::FilePath icon_path = const base::FilePath icon_path =
cache_dir.AppendASCII(app_id_).AddExtension(kIconFileExtension); cache_dir.AppendASCII(app_id_).AddExtension(kIconFileExtension);
base::PostTaskWithTraits( base::PostTaskWithTraits(FROM_HERE, {base::MayBlock()},
FROM_HERE, {base::MayBlock()}, base::BindOnce(&SaveIconToLocalOnBlockingPool,
base::BindOnce(&SaveIconToLocalOnBlockingPool, icon_path, icon_path, std::move(image_data)));
base::Passed(std::move(image_data))));
icon_path_ = icon_path; icon_path_ = icon_path;
} }
......
...@@ -869,17 +869,16 @@ void ServicesCustomizationDocument::CheckAndApplyWallpaper() { ...@@ -869,17 +869,16 @@ void ServicesCustomizationDocument::CheckAndApplyWallpaper() {
std::unique_ptr<bool> exists(new bool(false)); std::unique_ptr<bool> exists(new bool(false));
base::Closure check_file_exists = base::OnceClosure check_file_exists = base::BindOnce(
base::Bind(&CheckWallpaperCacheExists, &CheckWallpaperCacheExists, GetCustomizedWallpaperDownloadedFileName(),
GetCustomizedWallpaperDownloadedFileName(), base::Unretained(exists.get()));
base::Unretained(exists.get())); base::OnceClosure on_checked_closure = base::BindOnce(
base::Closure on_checked_closure = base::Bind(
&ServicesCustomizationDocument::OnCheckedWallpaperCacheExists, &ServicesCustomizationDocument::OnCheckedWallpaperCacheExists,
weak_ptr_factory_.GetWeakPtr(), base::Passed(std::move(exists)), weak_ptr_factory_.GetWeakPtr(), base::Passed(std::move(exists)),
base::Passed(std::move(applying))); std::move(applying));
base::PostTaskWithTraitsAndReply( base::PostTaskWithTraitsAndReply(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
check_file_exists, on_checked_closure); std::move(check_file_exists), std::move(on_checked_closure));
} }
void ServicesCustomizationDocument::OnCheckedWallpaperCacheExists( void ServicesCustomizationDocument::OnCheckedWallpaperCacheExists(
......
...@@ -135,7 +135,7 @@ void CustomizationWallpaperDownloader::Start() { ...@@ -135,7 +135,7 @@ void CustomizationWallpaperDownloader::Start() {
base::Unretained(success.get())); base::Unretained(success.get()));
base::OnceClosure on_created_closure = base::BindOnce( base::OnceClosure on_created_closure = base::BindOnce(
&CustomizationWallpaperDownloader::OnWallpaperDirectoryCreated, &CustomizationWallpaperDownloader::OnWallpaperDirectoryCreated,
weak_factory_.GetWeakPtr(), base::Passed(std::move(success))); weak_factory_.GetWeakPtr(), std::move(success));
base::PostTaskWithTraitsAndReply( base::PostTaskWithTraitsAndReply(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
std::move(mkdir_closure), std::move(on_created_closure)); std::move(mkdir_closure), std::move(on_created_closure));
...@@ -169,9 +169,9 @@ void CustomizationWallpaperDownloader::OnSimpleLoaderComplete( ...@@ -169,9 +169,9 @@ void CustomizationWallpaperDownloader::OnSimpleLoaderComplete(
base::OnceClosure rename_closure = base::BindOnce( base::OnceClosure rename_closure = base::BindOnce(
&RenameTemporaryFile, response_path, wallpaper_downloaded_file_, &RenameTemporaryFile, response_path, wallpaper_downloaded_file_,
base::Unretained(success.get())); base::Unretained(success.get()));
base::OnceClosure on_rename_closure = base::BindOnce( base::OnceClosure on_rename_closure =
&CustomizationWallpaperDownloader::OnTemporaryFileRenamed, base::BindOnce(&CustomizationWallpaperDownloader::OnTemporaryFileRenamed,
weak_factory_.GetWeakPtr(), base::Passed(std::move(success))); weak_factory_.GetWeakPtr(), std::move(success));
base::PostTaskWithTraitsAndReply( base::PostTaskWithTraitsAndReply(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
std::move(rename_closure), std::move(on_rename_closure)); std::move(rename_closure), std::move(on_rename_closure));
......
...@@ -124,10 +124,9 @@ void ContinueLoadPrivateKeyOnIOThread( ...@@ -124,10 +124,9 @@ void ContinueLoadPrivateKeyOnIOThread(
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
task_runner->PostTask( task_runner->PostTask(
FROM_HERE, FROM_HERE,
base::BindOnce( base::BindOnce(&LoadPrivateKeyByPublicKeyOnWorkerThread, owner_key_util,
&LoadPrivateKeyByPublicKeyOnWorkerThread, owner_key_util, crypto::GetPublicSlotForChromeOSUser(username_hash),
base::Passed(crypto::GetPublicSlotForChromeOSUser(username_hash)), std::move(private_slot), callback));
base::Passed(std::move(private_slot)), callback));
} }
void LoadPrivateKeyOnIOThread(const scoped_refptr<OwnerKeyUtil>& owner_key_util, void LoadPrivateKeyOnIOThread(const scoped_refptr<OwnerKeyUtil>& owner_key_util,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment