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( ...@@ -613,12 +613,12 @@ void ChromeCleanerControllerImpl::OnChromeCleanerFetchedAndVerified(
ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode( ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode(
extension_service_, extension_registry_, executable_path, extension_service_, extension_registry_, executable_path,
*reporter_invocation_, metrics_status, *reporter_invocation_, metrics_status,
base::Bind(&ChromeCleanerControllerImpl::WeakOnPromptUser, base::BindOnce(&ChromeCleanerControllerImpl::WeakOnPromptUser,
weak_factory_.GetWeakPtr()), weak_factory_.GetWeakPtr()),
base::Bind(&ChromeCleanerControllerImpl::OnConnectionClosed, base::BindOnce(&ChromeCleanerControllerImpl::OnConnectionClosed,
weak_factory_.GetWeakPtr()), weak_factory_.GetWeakPtr()),
base::Bind(&ChromeCleanerControllerImpl::OnCleanerProcessDone, base::BindOnce(&ChromeCleanerControllerImpl::OnCleanerProcessDone,
weak_factory_.GetWeakPtr()), weak_factory_.GetWeakPtr()),
// Our callbacks should be dispatched to the UI thread only. // Our callbacks should be dispatched to the UI thread only.
base::ThreadTaskRunnerHandle::Get()); base::ThreadTaskRunnerHandle::Get());
......
...@@ -140,9 +140,9 @@ void DownloadFeedbackService::BeginFeedbackForDownload( ...@@ -140,9 +140,9 @@ void DownloadFeedbackService::BeginFeedbackForDownload(
download->StealDangerousDownload( download->StealDangerousDownload(
download_command == DownloadCommands::DISCARD, download_command == DownloadCommands::DISCARD,
base::Bind(&DownloadFeedbackService::BeginFeedbackOrDeleteFile, base::BindOnce(&DownloadFeedbackService::BeginFeedbackOrDeleteFile,
file_task_runner_, weak_ptr_factory_.GetWeakPtr(), file_task_runner_, weak_ptr_factory_.GetWeakPtr(),
pings->ping_request(), pings->ping_response())); pings->ping_request(), pings->ping_response()));
if (download_command == DownloadCommands::KEEP) { if (download_command == DownloadCommands::KEEP) {
DownloadItemModel model(download); DownloadItemModel model(download);
DownloadCommands(&model).ExecuteCommand(download_command); DownloadCommands(&model).ExecuteCommand(download_command);
......
...@@ -141,8 +141,8 @@ void FileAnalyzer::StartExtractZipFeatures() { ...@@ -141,8 +141,8 @@ void FileAnalyzer::StartExtractZipFeatures() {
// analyzer is refcounted, it might outlive the request. // analyzer is refcounted, it might outlive the request.
zip_analyzer_ = new SandboxedZipAnalyzer( zip_analyzer_ = new SandboxedZipAnalyzer(
tmp_path_, tmp_path_,
base::BindRepeating(&FileAnalyzer::OnZipAnalysisFinished, base::BindOnce(&FileAnalyzer::OnZipAnalysisFinished,
weakptr_factory_.GetWeakPtr()), weakptr_factory_.GetWeakPtr()),
LaunchFileUtilService()); LaunchFileUtilService());
zip_analyzer_->Start(); zip_analyzer_->Start();
} }
...@@ -204,8 +204,8 @@ void FileAnalyzer::StartExtractRarFeatures() { ...@@ -204,8 +204,8 @@ void FileAnalyzer::StartExtractRarFeatures() {
// analyzer is refcounted, it might outlive the request. // analyzer is refcounted, it might outlive the request.
rar_analyzer_ = new SandboxedRarAnalyzer( rar_analyzer_ = new SandboxedRarAnalyzer(
tmp_path_, tmp_path_,
base::BindRepeating(&FileAnalyzer::OnRarAnalysisFinished, base::BindOnce(&FileAnalyzer::OnRarAnalysisFinished,
weakptr_factory_.GetWeakPtr()), weakptr_factory_.GetWeakPtr()),
LaunchFileUtilService()); LaunchFileUtilService());
rar_analyzer_->Start(); rar_analyzer_->Start();
} }
......
...@@ -126,8 +126,8 @@ class LastDownloadFinderTest : public testing::Test { ...@@ -126,8 +126,8 @@ class LastDownloadFinderTest : public testing::Test {
profile, ServiceAccessType::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
history_service->CreateDownload( history_service->CreateDownload(
CreateTestDownloadRow(kBinaryFileName), CreateTestDownloadRow(kBinaryFileName),
base::Bind(&LastDownloadFinderTest::OnDownloadCreated, base::BindOnce(&LastDownloadFinderTest::OnDownloadCreated,
base::Unretained(this))); base::Unretained(this)));
} }
// LastDownloadFinder::LastDownloadCallback implementation that // LastDownloadFinder::LastDownloadCallback implementation that
...@@ -213,9 +213,8 @@ class LastDownloadFinderTest : public testing::Test { ...@@ -213,9 +213,8 @@ class LastDownloadFinderTest : public testing::Test {
profile, ServiceAccessType::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
history_service->CreateDownload( history_service->CreateDownload(
download, download,
base::Bind(&LastDownloadFinderTest::ContinueOnDownloadCreated, base::BindOnce(&LastDownloadFinderTest::ContinueOnDownloadCreated,
base::Unretained(this), base::Unretained(this), run_loop.QuitClosure()));
run_loop.QuitClosure()));
run_loop.Run(); 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