OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/history/history_types.h" | 5 #include "chrome/browser/history/history_types.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 size_t* num_matches) const { | 167 size_t* num_matches) const { |
168 URLToResultIndices::const_iterator found = url_to_results_.find(url); | 168 URLToResultIndices::const_iterator found = url_to_results_.find(url); |
169 if (found == url_to_results_.end()) { | 169 if (found == url_to_results_.end()) { |
170 if (num_matches) | 170 if (num_matches) |
171 *num_matches = 0; | 171 *num_matches = 0; |
172 return NULL; | 172 return NULL; |
173 } | 173 } |
174 | 174 |
175 // All entries in the map should have at least one index, otherwise it | 175 // All entries in the map should have at least one index, otherwise it |
176 // shouldn't be in the map. | 176 // shouldn't be in the map. |
177 DCHECK(found->second->size() > 0); | 177 DCHECK(!found->second->empty()); |
178 if (num_matches) | 178 if (num_matches) |
179 *num_matches = found->second->size(); | 179 *num_matches = found->second->size(); |
180 return &found->second->front(); | 180 return &found->second->front(); |
181 } | 181 } |
182 | 182 |
183 void QueryResults::Swap(QueryResults* other) { | 183 void QueryResults::Swap(QueryResults* other) { |
184 std::swap(first_time_searched_, other->first_time_searched_); | 184 std::swap(first_time_searched_, other->first_time_searched_); |
185 std::swap(reached_beginning_, other->reached_beginning_); | 185 std::swap(reached_beginning_, other->reached_beginning_); |
186 results_.swap(other->results_); | 186 results_.swap(other->results_); |
187 url_to_results_.swap(other->url_to_results_); | 187 url_to_results_.swap(other->url_to_results_); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 bool RowQualifiesAsSignificant(const URLRow& row, | 397 bool RowQualifiesAsSignificant(const URLRow& row, |
398 const base::Time& threshold) { | 398 const base::Time& threshold) { |
399 const base::Time& real_threshold = | 399 const base::Time& real_threshold = |
400 threshold.is_null() ? AutocompleteAgeThreshold() : threshold; | 400 threshold.is_null() ? AutocompleteAgeThreshold() : threshold; |
401 return (row.typed_count() > kLowQualityMatchTypedLimit) || | 401 return (row.typed_count() > kLowQualityMatchTypedLimit) || |
402 (row.visit_count() > kLowQualityMatchVisitLimit) || | 402 (row.visit_count() > kLowQualityMatchVisitLimit) || |
403 (row.last_visit() >= real_threshold); | 403 (row.last_visit() >= real_threshold); |
404 } | 404 } |
405 | 405 |
406 } // namespace history | 406 } // namespace history |
OLD | NEW |