Chromium Code Reviews| Index: chrome/browser/ui/webui/history_ui.cc |
| diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc |
| index fc18ebabb398254c7e422c91f8e28783be3ea7ee..85f5457985ba2cf8e033221c0eaa3076a34c6fa5 100644 |
| --- a/chrome/browser/ui/webui/history_ui.cc |
| +++ b/chrome/browser/ui/webui/history_ui.cc |
| @@ -821,29 +821,29 @@ void BrowsingHistoryHandler::ReturnResultsToFrontEnd() { |
| // Combine the local and remote results into |query_results_|, and remove |
| // any duplicates. |
| - if (query_results_.size() && web_history_query_results_.size()) { |
| - // Each result set covers a particular time range. Determine the |
| - // intersection of the two time ranges, discard any entries from either |
| - // set the are older than that, and then combine the results. |
| - base::Time cutoff_time = std::max(query_results_.back().time, |
| - web_history_query_results_.back().time); |
| - RemoveOlderEntries(&query_results_, cutoff_time); |
| - RemoveOlderEntries(&web_history_query_results_, cutoff_time); |
| - |
| - int local_result_count = query_results_.size(); |
|
Dan Beam
2013/03/25 21:38:58
^ it seems like this is the right logic, right? d
Patrick Dubroy
2013/03/25 21:46:29
Damn, you're right. Fixed.
|
| + if (!web_history_query_results_.empty()) { |
| + if (!query_results_.empty()) { |
| + // Each result set covers a particular time range. Determine the |
| + // intersection of the two time ranges, discard any entries from either |
| + // set that are older than that, and then combine the results. |
| + base::Time cutoff_time = std::max( |
| + query_results_.back().time, |
| + web_history_query_results_.back().time); |
| + RemoveOlderEntries(&query_results_, cutoff_time); |
| + RemoveOlderEntries(&web_history_query_results_, cutoff_time); |
| + } |
|
Dan Beam
2013/03/25 21:40:44
nit: \n after conditionals (from C++ style guide)
Patrick Dubroy
2013/03/25 21:46:29
Done.
|
| query_results_.insert(query_results_.end(), |
| web_history_query_results_.begin(), |
| web_history_query_results_.end()); |
| + |
| RemoveDuplicateResults(&query_results_); |
| - // In the best case, we expect that all local results are duplicated on the |
| - // server. Keep track of how many are missing. |
| - if (local_result_count) { |
| - int missing_count = std::count_if( |
| - query_results_.begin(), query_results_.end(), IsLocalOnlyResult); |
| - UMA_HISTOGRAM_PERCENTAGE("WebHistory.LocalResultMissingOnServer", |
| - missing_count * 100.0 / local_result_count); |
| - } |
| + // In the best case, we expect that all local results are duplicated on |
| + // the server. Keep track of how many are missing. |
| + int missing_count = std::count_if( |
| + query_results_.begin(), query_results_.end(), IsLocalOnlyResult); |
| + UMA_HISTOGRAM_PERCENTAGE("WebHistory.LocalResultMissingOnServer", |
| + missing_count * 100.0 / query_results_.size()); |
| } |
| // Convert the result vector into a ListValue. |