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(
provider1->set_listener(controller_.get());
provider2->set_listener(controller_.get());
client_->set_closure(base::Bind(&AutocompleteProviderTest::CopyResults,
base::Unretained(this)));
client_->set_closure(base::BindRepeating(
&AutocompleteProviderTest::CopyResults, base::Unretained(this)));
if (provider1_ptr)
*provider1_ptr = provider1;
......
......@@ -213,8 +213,8 @@ void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) {
if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) {
deletion_handlers_.push_back(std::make_unique<SuggestionDeletionHandler>(
client(), match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey),
base::Bind(&BaseSearchProvider::OnDeletionComplete,
base::Unretained(this))));
base::BindRepeating(&BaseSearchProvider::OnDeletionComplete,
base::Unretained(this))));
}
const TemplateURL* template_url =
......
......@@ -582,7 +582,7 @@ void HistoryURLProvider::Start(const AutocompleteInput& input,
params_ = params.release(); // This object will be destroyed in
// QueryComplete() once we're done with it.
history_service->ScheduleAutocomplete(
base::Bind(&HistoryURLProvider::ExecuteWithDB, this, params_));
base::BindRepeating(&HistoryURLProvider::ExecuteWithDB, this, params_));
}
}
......
......@@ -248,10 +248,9 @@ void InMemoryURLIndex::PostRestoreFromCacheFileTask() {
}
base::PostTaskAndReplyWithResult(
task_runner_.get(),
FROM_HERE,
base::Bind(&URLIndexPrivateData::RestoreFromFile, path),
base::Bind(&InMemoryURLIndex::OnCacheLoadDone, AsWeakPtr()));
task_runner_.get(), FROM_HERE,
base::BindOnce(&URLIndexPrivateData::RestoreFromFile, path),
base::BindOnce(&InMemoryURLIndex::OnCacheLoadDone, AsWeakPtr()));
}
void InMemoryURLIndex::OnCacheLoadDone(
......@@ -352,11 +351,10 @@ void InMemoryURLIndex::PostSaveToCacheFileTask() {
scoped_refptr<URLIndexPrivateData> private_data_copy =
private_data_->Duplicate();
base::PostTaskAndReplyWithResult(
task_runner_.get(),
FROM_HERE,
base::Bind(&URLIndexPrivateData::WritePrivateDataToCacheFileTask,
private_data_copy, path),
base::Bind(&InMemoryURLIndex::OnCacheSaveDone, AsWeakPtr()));
task_runner_.get(), FROM_HERE,
base::BindOnce(&URLIndexPrivateData::WritePrivateDataToCacheFileTask,
private_data_copy, path),
base::BindOnce(&InMemoryURLIndex::OnCacheSaveDone, AsWeakPtr()));
} else {
// If there is no data in our index then delete any existing cache file.
task_runner_->PostTask(
......
......@@ -77,8 +77,8 @@ void OmniboxController::OnResultChanged(bool default_match_changed) {
// passed in to eliminate the potential for crashes on shutdown.
client_->OnResultChanged(
result(), default_match_changed,
base::Bind(&OmniboxController::SetRichSuggestionBitmap,
weak_ptr_factory_.GetWeakPtr()));
base::BindRepeating(&OmniboxController::SetRichSuggestionBitmap,
weak_ptr_factory_.GetWeakPtr()));
}
void OmniboxController::InvalidateCurrentMatch() {
......
......@@ -100,8 +100,8 @@ OmniboxMetricsProvider::~OmniboxMetricsProvider() {
void OmniboxMetricsProvider::OnRecordingEnabled() {
subscription_ = OmniboxEventGlobalTracker::GetInstance()->RegisterCallback(
base::Bind(&OmniboxMetricsProvider::OnURLOpenedFromOmnibox,
base::Unretained(this)));
base::BindRepeating(&OmniboxMetricsProvider::OnURLOpenedFromOmnibox,
base::Unretained(this)));
}
void OmniboxMetricsProvider::OnRecordingDisabled() {
......
......@@ -153,7 +153,7 @@ bool ShortcutsDatabase::Init() {
// To recover from corruption.
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
// better performance (we're typically seek rather than bandwidth limited).
......
......@@ -172,9 +172,9 @@ void ZeroSuggestProvider::Start(const AutocompleteInput& input,
return;
}
ts->GetMostVisitedURLs(
base::Bind(&ZeroSuggestProvider::OnMostVisitedUrlsAvailable,
weak_ptr_factory_.GetWeakPtr(), most_visited_request_num_));
ts->GetMostVisitedURLs(base::BindRepeating(
&ZeroSuggestProvider::OnMostVisitedUrlsAvailable,
weak_ptr_factory_.GetWeakPtr(), most_visited_request_num_));
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