Commit 40bb0ac5 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox] Convert Bind() to BindOnce() or Repeating()

Style guidelines encourage using either BindOnce() or BindRepeating(),
not Bind(). This CL converts some Bind() calls to their respective
type.

Change-Id: I7e816bfd102f9e28989cff40003fc0f7192458d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1546887
Commit-Queue: Kevin Bailey <krb@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646592}
parent e5babf59
...@@ -396,8 +396,8 @@ void AutocompleteProviderTest::ResetControllerWithTestProviders( ...@@ -396,8 +396,8 @@ void AutocompleteProviderTest::ResetControllerWithTestProviders(
provider1->set_listener(controller_.get()); provider1->set_listener(controller_.get());
provider2->set_listener(controller_.get()); provider2->set_listener(controller_.get());
client_->set_closure(base::Bind(&AutocompleteProviderTest::CopyResults, client_->set_closure(base::BindRepeating(
base::Unretained(this))); &AutocompleteProviderTest::CopyResults, base::Unretained(this)));
if (provider1_ptr) if (provider1_ptr)
*provider1_ptr = provider1; *provider1_ptr = provider1;
......
...@@ -213,8 +213,8 @@ void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { ...@@ -213,8 +213,8 @@ void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) {
if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) { if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) {
deletion_handlers_.push_back(std::make_unique<SuggestionDeletionHandler>( deletion_handlers_.push_back(std::make_unique<SuggestionDeletionHandler>(
client(), match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey), client(), match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey),
base::Bind(&BaseSearchProvider::OnDeletionComplete, base::BindRepeating(&BaseSearchProvider::OnDeletionComplete,
base::Unretained(this)))); base::Unretained(this))));
} }
const TemplateURL* template_url = const TemplateURL* template_url =
......
...@@ -582,7 +582,7 @@ void HistoryURLProvider::Start(const AutocompleteInput& input, ...@@ -582,7 +582,7 @@ void HistoryURLProvider::Start(const AutocompleteInput& input,
params_ = params.release(); // This object will be destroyed in params_ = params.release(); // This object will be destroyed in
// QueryComplete() once we're done with it. // QueryComplete() once we're done with it.
history_service->ScheduleAutocomplete( history_service->ScheduleAutocomplete(
base::Bind(&HistoryURLProvider::ExecuteWithDB, this, params_)); base::BindRepeating(&HistoryURLProvider::ExecuteWithDB, this, params_));
} }
} }
......
...@@ -248,10 +248,9 @@ void InMemoryURLIndex::PostRestoreFromCacheFileTask() { ...@@ -248,10 +248,9 @@ void InMemoryURLIndex::PostRestoreFromCacheFileTask() {
} }
base::PostTaskAndReplyWithResult( base::PostTaskAndReplyWithResult(
task_runner_.get(), task_runner_.get(), FROM_HERE,
FROM_HERE, base::BindOnce(&URLIndexPrivateData::RestoreFromFile, path),
base::Bind(&URLIndexPrivateData::RestoreFromFile, path), base::BindOnce(&InMemoryURLIndex::OnCacheLoadDone, AsWeakPtr()));
base::Bind(&InMemoryURLIndex::OnCacheLoadDone, AsWeakPtr()));
} }
void InMemoryURLIndex::OnCacheLoadDone( void InMemoryURLIndex::OnCacheLoadDone(
...@@ -352,11 +351,10 @@ void InMemoryURLIndex::PostSaveToCacheFileTask() { ...@@ -352,11 +351,10 @@ void InMemoryURLIndex::PostSaveToCacheFileTask() {
scoped_refptr<URLIndexPrivateData> private_data_copy = scoped_refptr<URLIndexPrivateData> private_data_copy =
private_data_->Duplicate(); private_data_->Duplicate();
base::PostTaskAndReplyWithResult( base::PostTaskAndReplyWithResult(
task_runner_.get(), task_runner_.get(), FROM_HERE,
FROM_HERE, base::BindOnce(&URLIndexPrivateData::WritePrivateDataToCacheFileTask,
base::Bind(&URLIndexPrivateData::WritePrivateDataToCacheFileTask, private_data_copy, path),
private_data_copy, path), base::BindOnce(&InMemoryURLIndex::OnCacheSaveDone, AsWeakPtr()));
base::Bind(&InMemoryURLIndex::OnCacheSaveDone, AsWeakPtr()));
} else { } else {
// If there is no data in our index then delete any existing cache file. // If there is no data in our index then delete any existing cache file.
task_runner_->PostTask( task_runner_->PostTask(
......
...@@ -77,8 +77,8 @@ void OmniboxController::OnResultChanged(bool default_match_changed) { ...@@ -77,8 +77,8 @@ void OmniboxController::OnResultChanged(bool default_match_changed) {
// passed in to eliminate the potential for crashes on shutdown. // passed in to eliminate the potential for crashes on shutdown.
client_->OnResultChanged( client_->OnResultChanged(
result(), default_match_changed, result(), default_match_changed,
base::Bind(&OmniboxController::SetRichSuggestionBitmap, base::BindRepeating(&OmniboxController::SetRichSuggestionBitmap,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
void OmniboxController::InvalidateCurrentMatch() { void OmniboxController::InvalidateCurrentMatch() {
......
...@@ -100,8 +100,8 @@ OmniboxMetricsProvider::~OmniboxMetricsProvider() { ...@@ -100,8 +100,8 @@ OmniboxMetricsProvider::~OmniboxMetricsProvider() {
void OmniboxMetricsProvider::OnRecordingEnabled() { void OmniboxMetricsProvider::OnRecordingEnabled() {
subscription_ = OmniboxEventGlobalTracker::GetInstance()->RegisterCallback( subscription_ = OmniboxEventGlobalTracker::GetInstance()->RegisterCallback(
base::Bind(&OmniboxMetricsProvider::OnURLOpenedFromOmnibox, base::BindRepeating(&OmniboxMetricsProvider::OnURLOpenedFromOmnibox,
base::Unretained(this))); base::Unretained(this)));
} }
void OmniboxMetricsProvider::OnRecordingDisabled() { void OmniboxMetricsProvider::OnRecordingDisabled() {
......
...@@ -153,7 +153,7 @@ bool ShortcutsDatabase::Init() { ...@@ -153,7 +153,7 @@ bool ShortcutsDatabase::Init() {
// To recover from corruption. // To recover from corruption.
db_.set_error_callback( db_.set_error_callback(
base::Bind(&DatabaseErrorCallback, &db_, database_path_)); base::BindRepeating(&DatabaseErrorCallback, &db_, database_path_));
// Set the database page size to something a little larger to give us // Set the database page size to something a little larger to give us
// better performance (we're typically seek rather than bandwidth limited). // better performance (we're typically seek rather than bandwidth limited).
......
...@@ -172,9 +172,9 @@ void ZeroSuggestProvider::Start(const AutocompleteInput& input, ...@@ -172,9 +172,9 @@ void ZeroSuggestProvider::Start(const AutocompleteInput& input,
return; return;
} }
ts->GetMostVisitedURLs( ts->GetMostVisitedURLs(base::BindRepeating(
base::Bind(&ZeroSuggestProvider::OnMostVisitedUrlsAvailable, &ZeroSuggestProvider::OnMostVisitedUrlsAvailable,
weak_ptr_factory_.GetWeakPtr(), most_visited_request_num_)); weak_ptr_factory_.GetWeakPtr(), most_visited_request_num_));
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