Commit 647564e8 authored by tzik's avatar tzik Committed by Commit Bot

Rewrite base::Bind to base::BindOnce with base_bind_rewriters in...

Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/chromeos/file_manager

This is a generated CL by a clang refactoring tool at //tools/clang/base_bind_rewriters.
It rewrites base::Bind to base::BindOnce where the resulting Callback is converted to
OnceCallback immediately.
E.g.:
  base::PostTask(FROM_HERE, base::Bind(&Foo));
is rewritten to:
  base::PostTask(FROM_HERE, base::BindOnce(&Foo));

In terms of the behavior change after the rewrite, the OnceCallback
implementation moves out the bound argument to the target function, unlike
Callback.

Bug: 554299
Change-Id: I54220a53ba53141700cecbbeed585a8c1627e0a8
Reviewed-on: https://chromium-review.googlesource.com/517466Reviewed-by: default avatarNaoki Fukino <fukino@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#475861}
parent 767e6fb1
...@@ -305,13 +305,12 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl { ...@@ -305,13 +305,12 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl {
// file), move to IO thread to obtian metadata for the non-native file. // file), move to IO thread to obtian metadata for the non-native file.
if (need_fill_metadata) { if (need_fill_metadata) {
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::IO, BrowserThread::IO, FROM_HERE,
FROM_HERE, base::BindOnce(
base::Bind(&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl:: &ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
FillMetadataOnIOThread, FillMetadataOnIOThread,
base::Unretained(this), base::Unretained(this), base::Passed(&lifetime),
base::Passed(&lifetime), chooser_info_list_->begin()));
chooser_info_list_->begin()));
return; return;
} }
...@@ -338,12 +337,11 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl { ...@@ -338,12 +337,11 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl {
if (it == chooser_info_list_->end()) { if (it == chooser_info_list_->end()) {
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, BrowserThread::UI, FROM_HERE,
FROM_HERE, base::BindOnce(
base::Bind(&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl:: &ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
NotifyComplete, NotifyComplete,
base::Unretained(this), base::Unretained(this), base::Passed(&lifetime)));
base::Passed(&lifetime)));
return; return;
} }
...@@ -371,12 +369,11 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl { ...@@ -371,12 +369,11 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl {
if (result != base::File::FILE_OK) { if (result != base::File::FILE_OK) {
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, BrowserThread::UI, FROM_HERE,
FROM_HERE, base::BindOnce(
base::Bind(&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl:: &ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
NotifyError, NotifyError,
base::Unretained(this), base::Unretained(this), base::Passed(&lifetime)));
base::Passed(&lifetime)));
return; return;
} }
...@@ -553,10 +550,10 @@ void CheckIfDirectoryExists( ...@@ -553,10 +550,10 @@ void CheckIfDirectoryExists(
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, BrowserThread::IO, FROM_HERE,
base::Bind(base::IgnoreResult( base::BindOnce(base::IgnoreResult(
&storage::FileSystemOperationRunner::DirectoryExists), &storage::FileSystemOperationRunner::DirectoryExists),
file_system_context->operation_runner()->AsWeakPtr(), file_system_context->operation_runner()->AsWeakPtr(),
internal_url, google_apis::CreateRelayCallback(callback))); internal_url, google_apis::CreateRelayCallback(callback)));
} }
void GetMetadataForPath( void GetMetadataForPath(
...@@ -574,7 +571,7 @@ void GetMetadataForPath( ...@@ -574,7 +571,7 @@ void GetMetadataForPath(
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, BrowserThread::IO, FROM_HERE,
base::Bind( base::BindOnce(
base::IgnoreResult(&storage::FileSystemOperationRunner::GetMetadata), base::IgnoreResult(&storage::FileSystemOperationRunner::GetMetadata),
file_system_context->operation_runner()->AsWeakPtr(), internal_url, file_system_context->operation_runner()->AsWeakPtr(), internal_url,
fields, google_apis::CreateRelayCallback(callback))); fields, google_apis::CreateRelayCallback(callback)));
......
...@@ -151,9 +151,8 @@ void GetNonNativeLocalPathMimeType( ...@@ -151,9 +151,8 @@ void GetNonNativeLocalPathMimeType(
drive::util::GetFileSystemByProfile(profile); drive::util::GetFileSystemByProfile(profile);
if (!file_system) { if (!file_system) {
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::UI, content::BrowserThread::UI, FROM_HERE,
FROM_HERE, base::BindOnce(callback, false, std::string()));
base::Bind(callback, false, std::string()));
return; return;
} }
...@@ -168,9 +167,8 @@ void GetNonNativeLocalPathMimeType( ...@@ -168,9 +167,8 @@ void GetNonNativeLocalPathMimeType(
chromeos::file_system_provider::util::LocalPathParser parser(profile, path); chromeos::file_system_provider::util::LocalPathParser parser(profile, path);
if (!parser.Parse()) { if (!parser.Parse()) {
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::UI, content::BrowserThread::UI, FROM_HERE,
FROM_HERE, base::BindOnce(callback, false, std::string()));
base::Bind(callback, false, std::string()));
return; return;
} }
...@@ -187,9 +185,8 @@ void GetNonNativeLocalPathMimeType( ...@@ -187,9 +185,8 @@ void GetNonNativeLocalPathMimeType(
// error with empty MIME type, that leads fallback guessing mime type from // error with empty MIME type, that leads fallback guessing mime type from
// file extensions. // file extensions.
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::UI, content::BrowserThread::UI, FROM_HERE,
FROM_HERE, base::BindOnce(callback, false /* failure */, std::string()));
base::Bind(callback, false /* failure */, std::string()));
} }
void IsNonNativeLocalPathDirectory( void IsNonNativeLocalPathDirectory(
...@@ -216,9 +213,8 @@ void PrepareNonNativeLocalFileForWritableApp( ...@@ -216,9 +213,8 @@ void PrepareNonNativeLocalFileForWritableApp(
profile, path, kFileManagerAppId, &url)) { profile, path, kFileManagerAppId, &url)) {
// Posting to the current thread, so that we always call back asynchronously // Posting to the current thread, so that we always call back asynchronously
// independent from whether or not the operation succeeds. // independent from whether or not the operation succeeds.
content::BrowserThread::PostTask(content::BrowserThread::UI, content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
FROM_HERE, base::BindOnce(callback, false));
base::Bind(callback, false));
return; return;
} }
...@@ -233,8 +229,8 @@ void PrepareNonNativeLocalFileForWritableApp( ...@@ -233,8 +229,8 @@ void PrepareNonNativeLocalFileForWritableApp(
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE, content::BrowserThread::IO, FROM_HERE,
base::Bind(&PrepareFileOnIOThread, file_system_context, internal_url, base::BindOnce(&PrepareFileOnIOThread, file_system_context, internal_url,
google_apis::CreateRelayCallback(callback))); google_apis::CreateRelayCallback(callback)));
} }
} // namespace util } // namespace util
......
...@@ -75,10 +75,9 @@ void ComputeSpaceNeedToBeFreed( ...@@ -75,10 +75,9 @@ void ComputeSpaceNeedToBeFreed(
const GetNecessaryFreeSpaceCallback& callback) { const GetNecessaryFreeSpaceCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::IO, content::BrowserThread::IO, FROM_HERE,
FROM_HERE, base::BindOnce(&GetMetadataOnIOThread, profile->GetPath(), context, url,
base::Bind(&GetMetadataOnIOThread, profile->GetPath(), context, url, google_apis::CreateRelayCallback(callback)));
google_apis::CreateRelayCallback(callback)));
} }
// Part of CreateManagedSnapshot. Runs CreateSnapshotFile method of fileapi. // Part of CreateManagedSnapshot. Runs CreateSnapshotFile method of fileapi.
...@@ -118,9 +117,8 @@ SnapshotManager::SnapshotManager(Profile* profile) ...@@ -118,9 +117,8 @@ SnapshotManager::SnapshotManager(Profile* profile)
SnapshotManager::~SnapshotManager() { SnapshotManager::~SnapshotManager() {
if (!file_refs_.empty()) { if (!file_refs_.empty()) {
bool posted = content::BrowserThread::PostTask( bool posted = content::BrowserThread::PostTask(
content::BrowserThread::IO, content::BrowserThread::IO, FROM_HERE,
FROM_HERE, base::BindOnce(&FreeReferenceOnIOThread, file_refs_));
base::Bind(&FreeReferenceOnIOThread, file_refs_));
DCHECK(posted); DCHECK(posted);
} }
} }
...@@ -169,9 +167,8 @@ void SnapshotManager::CreateManagedSnapshotAfterSpaceComputed( ...@@ -169,9 +167,8 @@ void SnapshotManager::CreateManagedSnapshotAfterSpaceComputed(
} }
if (!to_free.empty()) { if (!to_free.empty()) {
bool posted = content::BrowserThread::PostTask( bool posted = content::BrowserThread::PostTask(
content::BrowserThread::IO, content::BrowserThread::IO, FROM_HERE,
FROM_HERE, base::BindOnce(&FreeReferenceOnIOThread, to_free));
base::Bind(&FreeReferenceOnIOThread, to_free));
DCHECK(posted); DCHECK(posted);
} }
...@@ -183,15 +180,11 @@ void SnapshotManager::CreateManagedSnapshotAfterSpaceComputed( ...@@ -183,15 +180,11 @@ void SnapshotManager::CreateManagedSnapshotAfterSpaceComputed(
// Start creating the snapshot. // Start creating the snapshot.
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::IO, content::BrowserThread::IO, FROM_HERE,
FROM_HERE, base::BindOnce(&CreateSnapshotFileOnIOThread, context, filesystem_url,
base::Bind(&CreateSnapshotFileOnIOThread, google_apis::CreateRelayCallback(base::Bind(
context, &SnapshotManager::OnCreateSnapshotFile,
filesystem_url, weak_ptr_factory_.GetWeakPtr(), callback))));
google_apis::CreateRelayCallback(
base::Bind(&SnapshotManager::OnCreateSnapshotFile,
weak_ptr_factory_.GetWeakPtr(),
callback))));
} }
void SnapshotManager::OnCreateSnapshotFile( void SnapshotManager::OnCreateSnapshotFile(
......
...@@ -855,9 +855,9 @@ void VolumeManager::OnRemovableStorageAttached( ...@@ -855,9 +855,9 @@ void VolumeManager::OnRemovableStorageAttached(
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE, content::BrowserThread::IO, FROM_HERE,
base::Bind(&MTPDeviceMapService::RegisterMTPFileSystem, base::BindOnce(&MTPDeviceMapService::RegisterMTPFileSystem,
base::Unretained(MTPDeviceMapService::GetInstance()), base::Unretained(MTPDeviceMapService::GetInstance()),
info.location(), fsid, read_only)); info.location(), fsid, read_only));
std::unique_ptr<Volume> volume = Volume::CreateForMTP(path, label, read_only); std::unique_ptr<Volume> volume = Volume::CreateForMTP(path, label, read_only);
DoMountEvent(chromeos::MOUNT_ERROR_NONE, std::move(volume)); DoMountEvent(chromeos::MOUNT_ERROR_NONE, std::move(volume));
...@@ -875,10 +875,10 @@ void VolumeManager::OnRemovableStorageDetached( ...@@ -875,10 +875,10 @@ void VolumeManager::OnRemovableStorageDetached(
const std::string fsid = GetMountPointNameForMediaStorage(info); const std::string fsid = GetMountPointNameForMediaStorage(info);
storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(fsid); storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(fsid);
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE, base::Bind( content::BrowserThread::IO, FROM_HERE,
&MTPDeviceMapService::RevokeMTPFileSystem, base::BindOnce(&MTPDeviceMapService::RevokeMTPFileSystem,
base::Unretained(MTPDeviceMapService::GetInstance()), base::Unretained(MTPDeviceMapService::GetInstance()),
fsid)); fsid));
return; return;
} }
} }
......
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