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

Side by Side Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 6539002: Begun the DCHECK() cleanup. Starting off with /src/chrome/a* and /src/chrome/... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/autocomplete/history_url_provider.h" 5 #include "chrome/browser/autocomplete/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 size_t HistoryURLProvider::RemoveSubsequentMatchesOf( 735 size_t HistoryURLProvider::RemoveSubsequentMatchesOf(
736 HistoryMatches* matches, 736 HistoryMatches* matches,
737 size_t source_index, 737 size_t source_index,
738 const std::vector<GURL>& remove) const { 738 const std::vector<GURL>& remove) const {
739 size_t next_index = source_index + 1; // return value = item after source 739 size_t next_index = source_index + 1; // return value = item after source
740 740
741 // Find the first occurrence of any URL in the redirect chain. We want to 741 // Find the first occurrence of any URL in the redirect chain. We want to
742 // keep this one since it is rated the highest. 742 // keep this one since it is rated the highest.
743 HistoryMatches::iterator first(std::find_first_of( 743 HistoryMatches::iterator first(std::find_first_of(
744 matches->begin(), matches->end(), remove.begin(), remove.end())); 744 matches->begin(), matches->end(), remove.begin(), remove.end()));
745 DCHECK(first != matches->end()) << 745 DCHECK(first == matches->end()) <<
Robert Sesek 2011/02/17 17:17:32 DCHECK_NE?
KushalP 2011/02/17 17:38:11 This uses an iterator and breaks DCHECK_NE and _EQ
746 "We should have always found at least the original URL."; 746 "We should have always found at least the original URL.";
747 747
748 // Find any following occurrences of any URL in the redirect chain, these 748 // Find any following occurrences of any URL in the redirect chain, these
749 // should be deleted. 749 // should be deleted.
750 HistoryMatches::iterator next(first); 750 HistoryMatches::iterator next(first);
751 next++; // Start searching immediately after the one we found already. 751 next++; // Start searching immediately after the one we found already.
752 while (next != matches->end() && 752 while (next != matches->end() &&
753 (next = std::find_first_of(next, matches->end(), remove.begin(), 753 (next = std::find_first_of(next, matches->end(), remove.begin(),
754 remove.end())) != matches->end()) { 754 remove.end())) != matches->end()) {
755 // Remove this item. When we remove an item before the source index, we 755 // Remove this item. When we remove an item before the source index, we
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 &match.contents_class); 805 &match.contents_class);
806 } 806 }
807 match.description = info.title(); 807 match.description = info.title();
808 AutocompleteMatch::ClassifyMatchInString(params->input.text(), 808 AutocompleteMatch::ClassifyMatchInString(params->input.text(),
809 info.title(), 809 info.title(),
810 ACMatchClassification::NONE, 810 ACMatchClassification::NONE,
811 &match.description_class); 811 &match.description_class);
812 812
813 return match; 813 return match;
814 } 814 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698