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,12 +305,11 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl {
// file), move to IO thread to obtian metadata for the non-native file.
if (need_fill_metadata) {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
base::Bind(&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
BrowserThread::IO, FROM_HERE,
base::BindOnce(
&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
FillMetadataOnIOThread,
base::Unretained(this),
base::Passed(&lifetime),
base::Unretained(this), base::Passed(&lifetime),
chooser_info_list_->begin()));
return;
}
......@@ -338,12 +337,11 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl {
if (it == chooser_info_list_->end()) {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
BrowserThread::UI, FROM_HERE,
base::BindOnce(
&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
NotifyComplete,
base::Unretained(this),
base::Passed(&lifetime)));
base::Unretained(this), base::Passed(&lifetime)));
return;
}
......@@ -371,12 +369,11 @@ class ConvertSelectedFileInfoListToFileChooserFileInfoListImpl {
if (result != base::File::FILE_OK) {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
BrowserThread::UI, FROM_HERE,
base::BindOnce(
&ConvertSelectedFileInfoListToFileChooserFileInfoListImpl::
NotifyError,
base::Unretained(this),
base::Passed(&lifetime)));
base::Unretained(this), base::Passed(&lifetime)));
return;
}
......@@ -553,7 +550,7 @@ void CheckIfDirectoryExists(
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(base::IgnoreResult(
base::BindOnce(base::IgnoreResult(
&storage::FileSystemOperationRunner::DirectoryExists),
file_system_context->operation_runner()->AsWeakPtr(),
internal_url, google_apis::CreateRelayCallback(callback)));
......@@ -574,7 +571,7 @@ void GetMetadataForPath(
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
base::BindOnce(
base::IgnoreResult(&storage::FileSystemOperationRunner::GetMetadata),
file_system_context->operation_runner()->AsWeakPtr(), internal_url,
fields, google_apis::CreateRelayCallback(callback)));
......
......@@ -151,9 +151,8 @@ void GetNonNativeLocalPathMimeType(
drive::util::GetFileSystemByProfile(profile);
if (!file_system) {
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
base::Bind(callback, false, std::string()));
content::BrowserThread::UI, FROM_HERE,
base::BindOnce(callback, false, std::string()));
return;
}
......@@ -168,9 +167,8 @@ void GetNonNativeLocalPathMimeType(
chromeos::file_system_provider::util::LocalPathParser parser(profile, path);
if (!parser.Parse()) {
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
base::Bind(callback, false, std::string()));
content::BrowserThread::UI, FROM_HERE,
base::BindOnce(callback, false, std::string()));
return;
}
......@@ -187,9 +185,8 @@ void GetNonNativeLocalPathMimeType(
// error with empty MIME type, that leads fallback guessing mime type from
// file extensions.
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
base::Bind(callback, false /* failure */, std::string()));
content::BrowserThread::UI, FROM_HERE,
base::BindOnce(callback, false /* failure */, std::string()));
}
void IsNonNativeLocalPathDirectory(
......@@ -216,9 +213,8 @@ void PrepareNonNativeLocalFileForWritableApp(
profile, path, kFileManagerAppId, &url)) {
// Posting to the current thread, so that we always call back asynchronously
// independent from whether or not the operation succeeds.
content::BrowserThread::PostTask(content::BrowserThread::UI,
FROM_HERE,
base::Bind(callback, false));
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
base::BindOnce(callback, false));
return;
}
......@@ -233,7 +229,7 @@ void PrepareNonNativeLocalFileForWritableApp(
content::BrowserThread::PostTask(
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)));
}
......
......@@ -75,9 +75,8 @@ void ComputeSpaceNeedToBeFreed(
const GetNecessaryFreeSpaceCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
base::Bind(&GetMetadataOnIOThread, profile->GetPath(), context, url,
content::BrowserThread::IO, FROM_HERE,
base::BindOnce(&GetMetadataOnIOThread, profile->GetPath(), context, url,
google_apis::CreateRelayCallback(callback)));
}
......@@ -118,9 +117,8 @@ SnapshotManager::SnapshotManager(Profile* profile)
SnapshotManager::~SnapshotManager() {
if (!file_refs_.empty()) {
bool posted = content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
base::Bind(&FreeReferenceOnIOThread, file_refs_));
content::BrowserThread::IO, FROM_HERE,
base::BindOnce(&FreeReferenceOnIOThread, file_refs_));
DCHECK(posted);
}
}
......@@ -169,9 +167,8 @@ void SnapshotManager::CreateManagedSnapshotAfterSpaceComputed(
}
if (!to_free.empty()) {
bool posted = content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
base::Bind(&FreeReferenceOnIOThread, to_free));
content::BrowserThread::IO, FROM_HERE,
base::BindOnce(&FreeReferenceOnIOThread, to_free));
DCHECK(posted);
}
......@@ -183,15 +180,11 @@ void SnapshotManager::CreateManagedSnapshotAfterSpaceComputed(
// Start creating the snapshot.
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
base::Bind(&CreateSnapshotFileOnIOThread,
context,
filesystem_url,
google_apis::CreateRelayCallback(
base::Bind(&SnapshotManager::OnCreateSnapshotFile,
weak_ptr_factory_.GetWeakPtr(),
callback))));
content::BrowserThread::IO, FROM_HERE,
base::BindOnce(&CreateSnapshotFileOnIOThread, context, filesystem_url,
google_apis::CreateRelayCallback(base::Bind(
&SnapshotManager::OnCreateSnapshotFile,
weak_ptr_factory_.GetWeakPtr(), callback))));
}
void SnapshotManager::OnCreateSnapshotFile(
......
......@@ -855,7 +855,7 @@ void VolumeManager::OnRemovableStorageAttached(
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&MTPDeviceMapService::RegisterMTPFileSystem,
base::BindOnce(&MTPDeviceMapService::RegisterMTPFileSystem,
base::Unretained(MTPDeviceMapService::GetInstance()),
info.location(), fsid, read_only));
......@@ -875,8 +875,8 @@ void VolumeManager::OnRemovableStorageDetached(
const std::string fsid = GetMountPointNameForMediaStorage(info);
storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(fsid);
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE, base::Bind(
&MTPDeviceMapService::RevokeMTPFileSystem,
content::BrowserThread::IO, FROM_HERE,
base::BindOnce(&MTPDeviceMapService::RevokeMTPFileSystem,
base::Unretained(MTPDeviceMapService::GetInstance()),
fsid));
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