chore: remove last instances of base::Bind (#18178)

* chore: remove last instances of base::Bind

* MessageBoxCallback is a OnceCallback

* convert permission helepr cbs to Once

* convert ResponseCallback to Once
This commit is contained in:
Shelley Vohr 2019-05-29 13:02:15 -07:00 committed by GitHub
parent 96371b6d75
commit 9af5072115
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 122 additions and 109 deletions

View file

@ -482,8 +482,8 @@ class ProcessSingleton::LinuxWatcher
DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Wait for reads.
fd_watch_controller_ = base::FileDescriptorWatcher::WatchReadable(
fd, base::Bind(&SocketReader::OnSocketCanReadWithoutBlocking,
base::Unretained(this)));
fd, base::BindRepeating(&SocketReader::OnSocketCanReadWithoutBlocking,
base::Unretained(this)));
// If we haven't completed in a reasonable amount of time, give up.
timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kTimeoutInSeconds),
this, &SocketReader::CleanupAndDeleteSelf);
@ -592,8 +592,8 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Watch for client connections on this socket.
socket_watcher_ = base::FileDescriptorWatcher::WatchReadable(
socket, base::Bind(&LinuxWatcher::OnSocketCanReadWithoutBlocking,
base::Unretained(this), socket));
socket, base::BindRepeating(&LinuxWatcher::OnSocketCanReadWithoutBlocking,
base::Unretained(this), socket));
}
void ProcessSingleton::LinuxWatcher::HandleMessage(
@ -686,8 +686,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
// Return to the UI thread to handle opening a new browser tab.
ui_task_runner_->PostTask(
FROM_HERE, base::Bind(&ProcessSingleton::LinuxWatcher::HandleMessage,
parent_, current_dir, tokens, this));
FROM_HERE, base::BindOnce(&ProcessSingleton::LinuxWatcher::HandleMessage,
parent_, current_dir, tokens, this));
fd_watch_controller_.reset();
// LinuxWatcher::HandleMessage() is in charge of destroying this SocketReader
@ -707,8 +707,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
base::Bind(&ProcessSingleton::LinuxWatcher::RemoveSocketReader, parent_,
this));
base::BindOnce(&ProcessSingleton::LinuxWatcher::RemoveSocketReader,
parent_, this));
// We will be deleted once the posted RemoveSocketReader task runs.
}
@ -728,8 +728,8 @@ ProcessSingleton::ProcessSingleton(
lock_path_ = user_data_dir.Append(kSingletonLockFilename);
cookie_path_ = user_data_dir.Append(kSingletonCookieFilename);
kill_callback_ =
base::Bind(&ProcessSingleton::KillProcess, base::Unretained(this));
kill_callback_ = base::BindRepeating(&ProcessSingleton::KillProcess,
base::Unretained(this));
}
ProcessSingleton::~ProcessSingleton() {
@ -887,8 +887,8 @@ void ProcessSingleton::StartListeningOnSocket() {
watcher_ = new LinuxWatcher(this);
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
base::Bind(&ProcessSingleton::LinuxWatcher::StartListening, watcher_,
sock_));
base::BindOnce(&ProcessSingleton::LinuxWatcher::StartListening, watcher_,
sock_));
}
void ProcessSingleton::OnBrowserReady() {
@ -950,7 +950,7 @@ void ProcessSingleton::OverrideCurrentPidForTesting(base::ProcessId pid) {
}
void ProcessSingleton::OverrideKillCallbackForTesting(
const base::Callback<void(int)>& callback) {
const base::RepeatingCallback<void(int)>& callback) {
kill_callback_ = callback;
}