Commit 89579b84 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[base] Apply BindOnceRewriter in //chrome/browser/safe_browsing

This change applies the BindOnceRewriter in //chrome/browser/safe_browsing.
This rewriter replaces calls to base::Bind and base::BindRepeating with
calls to base::BindOnce, in case the result is immediately assigned to a
base::OnceCallback. Given that base::RepeatingCallback is implicitly
convertible to base::OnceCallback, there is no change in functionality.

Steps:
  1. run_tool.py --tool base_bind_rewriters \
                 --tool-arg='--rewriter=bind_to_bind_once'
  2. git cl format

This CL was uploaded by git cl split.

R=nparker@chromium.org, proberge@chromium.org

Bug: 714018
Change-Id: I230b3f3bd31dff7513d190f2a54f80ace401cf10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132409Reviewed-by: default avatarNathan Parker <nparker@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760413}
parent 0c06d794
......@@ -613,12 +613,12 @@ void ChromeCleanerControllerImpl::OnChromeCleanerFetchedAndVerified(
ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode(
extension_service_, extension_registry_, executable_path,
*reporter_invocation_, metrics_status,
base::Bind(&ChromeCleanerControllerImpl::WeakOnPromptUser,
weak_factory_.GetWeakPtr()),
base::Bind(&ChromeCleanerControllerImpl::OnConnectionClosed,
weak_factory_.GetWeakPtr()),
base::Bind(&ChromeCleanerControllerImpl::OnCleanerProcessDone,
weak_factory_.GetWeakPtr()),
base::BindOnce(&ChromeCleanerControllerImpl::WeakOnPromptUser,
weak_factory_.GetWeakPtr()),
base::BindOnce(&ChromeCleanerControllerImpl::OnConnectionClosed,
weak_factory_.GetWeakPtr()),
base::BindOnce(&ChromeCleanerControllerImpl::OnCleanerProcessDone,
weak_factory_.GetWeakPtr()),
// Our callbacks should be dispatched to the UI thread only.
base::ThreadTaskRunnerHandle::Get());
......
......@@ -140,9 +140,9 @@ void DownloadFeedbackService::BeginFeedbackForDownload(
download->StealDangerousDownload(
download_command == DownloadCommands::DISCARD,
base::Bind(&DownloadFeedbackService::BeginFeedbackOrDeleteFile,
file_task_runner_, weak_ptr_factory_.GetWeakPtr(),
pings->ping_request(), pings->ping_response()));
base::BindOnce(&DownloadFeedbackService::BeginFeedbackOrDeleteFile,
file_task_runner_, weak_ptr_factory_.GetWeakPtr(),
pings->ping_request(), pings->ping_response()));
if (download_command == DownloadCommands::KEEP) {
DownloadItemModel model(download);
DownloadCommands(&model).ExecuteCommand(download_command);
......
......@@ -141,8 +141,8 @@ void FileAnalyzer::StartExtractZipFeatures() {
// analyzer is refcounted, it might outlive the request.
zip_analyzer_ = new SandboxedZipAnalyzer(
tmp_path_,
base::BindRepeating(&FileAnalyzer::OnZipAnalysisFinished,
weakptr_factory_.GetWeakPtr()),
base::BindOnce(&FileAnalyzer::OnZipAnalysisFinished,
weakptr_factory_.GetWeakPtr()),
LaunchFileUtilService());
zip_analyzer_->Start();
}
......@@ -204,8 +204,8 @@ void FileAnalyzer::StartExtractRarFeatures() {
// analyzer is refcounted, it might outlive the request.
rar_analyzer_ = new SandboxedRarAnalyzer(
tmp_path_,
base::BindRepeating(&FileAnalyzer::OnRarAnalysisFinished,
weakptr_factory_.GetWeakPtr()),
base::BindOnce(&FileAnalyzer::OnRarAnalysisFinished,
weakptr_factory_.GetWeakPtr()),
LaunchFileUtilService());
rar_analyzer_->Start();
}
......
......@@ -126,8 +126,8 @@ class LastDownloadFinderTest : public testing::Test {
profile, ServiceAccessType::EXPLICIT_ACCESS);
history_service->CreateDownload(
CreateTestDownloadRow(kBinaryFileName),
base::Bind(&LastDownloadFinderTest::OnDownloadCreated,
base::Unretained(this)));
base::BindOnce(&LastDownloadFinderTest::OnDownloadCreated,
base::Unretained(this)));
}
// LastDownloadFinder::LastDownloadCallback implementation that
......@@ -213,9 +213,8 @@ class LastDownloadFinderTest : public testing::Test {
profile, ServiceAccessType::EXPLICIT_ACCESS);
history_service->CreateDownload(
download,
base::Bind(&LastDownloadFinderTest::ContinueOnDownloadCreated,
base::Unretained(this),
run_loop.QuitClosure()));
base::BindOnce(&LastDownloadFinderTest::ContinueOnDownloadCreated,
base::Unretained(this), run_loop.QuitClosure()));
run_loop.Run();
}
......
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