Chromium Code Reviews| Index: chrome/browser/autocomplete/autocomplete.cc |
| =================================================================== |
| --- chrome/browser/autocomplete/autocomplete.cc (revision 107110) |
| +++ chrome/browser/autocomplete/autocomplete.cc (working copy) |
| @@ -652,6 +652,12 @@ |
| } |
| void AutocompleteResult::AppendMatches(const ACMatches& matches) { |
| +#ifndef NDEBUG |
| + for (size_t i = 0; i < matches.size(); i++) { |
|
Peter Kasting
2011/10/25 20:37:07
Nit: This code tries to use iterators (begin() and
Alexei Svitkine (slow)
2011/10/25 21:37:16
Done.
|
| + DCHECK_EQ(AutocompleteMatch::SanitizeString(matches[i].contents), |
|
Peter Kasting
2011/10/25 20:37:07
Nit: Here and below, we should also check the desc
Alexei Svitkine (slow)
2011/10/25 21:37:16
Done.
|
| + matches[i].contents); |
| + } |
| +#endif |
| std::copy(matches.begin(), matches.end(), std::back_inserter(matches_)); |
| default_match_ = end(); |
| alternate_nav_url_ = GURL(); |
| @@ -659,6 +665,8 @@ |
| void AutocompleteResult::AddMatch(const AutocompleteMatch& match) { |
| DCHECK(default_match_ != end()); |
| + // Check that there are no invalid characters in |match.contents|. |
|
Peter Kasting
2011/10/25 20:37:07
Nit: Remove this comment, it's redundant with the
Alexei Svitkine (slow)
2011/10/25 21:37:16
Done.
|
| + DCHECK_EQ(AutocompleteMatch::SanitizeString(match.contents), match.contents); |
| ACMatches::iterator insertion_point = |
| std::upper_bound(begin(), end(), match, &AutocompleteMatch::MoreRelevant); |
| ACMatches::iterator::difference_type default_offset = |