Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: ui/app_list/views/search_result_container_view.cc

Issue 2609843004: Fix the Crash in the launcher's start page (a better approach). (Closed)
Patch Set: Rebase. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/search_result_container_view.h ('k') | ui/app_list/views/search_result_list_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/search_result_container_view.cc
diff --git a/ui/app_list/views/search_result_container_view.cc b/ui/app_list/views/search_result_container_view.cc
index db0da6a4d77243f0ee039fe1d38af0d8b14c479a..d51974f31153b50897781b3f612f8a2c7debdf69 100644
--- a/ui/app_list/views/search_result_container_view.cc
+++ b/ui/app_list/views/search_result_container_view.cc
@@ -33,7 +33,7 @@ void SearchResultContainerView::SetResults(
if (results_)
results_->AddObserver(this);
- DoUpdate();
+ Update();
}
void SearchResultContainerView::SetSelectedIndex(int selected_index) {
@@ -53,14 +53,12 @@ bool SearchResultContainerView::IsValidSelectionIndex(int index) const {
return index >= 0 && index <= num_results() - 1;
}
-void SearchResultContainerView::ScheduleUpdate() {
- // When search results are added one by one, each addition generates an update
- // request. Consolidates those update requests into one Update call.
- if (!update_factory_.HasWeakPtrs()) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&SearchResultContainerView::DoUpdate,
- update_factory_.GetWeakPtr()));
- }
+void SearchResultContainerView::Update() {
+ update_factory_.InvalidateWeakPtrs();
+ num_results_ = DoUpdate();
+ Layout();
+ if (delegate_)
+ delegate_->OnSearchResultContainerResultsChanged();
}
bool SearchResultContainerView::UpdateScheduled() {
@@ -84,12 +82,14 @@ void SearchResultContainerView::ListItemsChanged(size_t start, size_t count) {
ScheduleUpdate();
}
-void SearchResultContainerView::DoUpdate() {
- update_factory_.InvalidateWeakPtrs();
- num_results_ = Update();
- Layout();
- if (delegate_)
- delegate_->OnSearchResultContainerResultsChanged();
+void SearchResultContainerView::ScheduleUpdate() {
+ // When search results are added one by one, each addition generates an update
+ // request. Consolidates those update requests into one Update call.
+ if (!update_factory_.HasWeakPtrs()) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&SearchResultContainerView::Update,
+ update_factory_.GetWeakPtr()));
+ }
}
} // namespace app_list
« no previous file with comments | « ui/app_list/views/search_result_container_view.h ('k') | ui/app_list/views/search_result_list_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698