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

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

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "chrome/browser/autocomplete/autocomplete_match.h" 6 #include "chrome/browser/autocomplete/autocomplete_match.h"
7 #include "grit/theme_resources.h" 7 #include "grit/theme_resources.h"
8 8
9 // AutocompleteMatch ---------------------------------------------------------- 9 // AutocompleteMatch ----------------------------------------------------------
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 void AutocompleteMatch::ValidateClassifications( 160 void AutocompleteMatch::ValidateClassifications(
161 const string16& text, 161 const string16& text,
162 const ACMatchClassifications& classifications) const { 162 const ACMatchClassifications& classifications) const {
163 if (text.empty()) { 163 if (text.empty()) {
164 DCHECK(classifications.size() == 0); 164 DCHECK(classifications.size() == 0);
165 return; 165 return;
166 } 166 }
167 167
168 // The classifications should always cover the whole string. 168 // The classifications should always cover the whole string.
169 DCHECK(classifications.size() > 0) << "No classification for text"; 169 DCHECK(!classifications.empty()) << "No classification for text";
170 DCHECK(classifications[0].offset == 0) << "Classification misses beginning"; 170 DCHECK(classifications[0].offset == 0) << "Classification misses beginning";
171 if (classifications.size() == 1) 171 if (classifications.size() == 1)
172 return; 172 return;
173 173
174 // The classifications should always be sorted. 174 // The classifications should always be sorted.
175 size_t last_offset = classifications[0].offset; 175 size_t last_offset = classifications[0].offset;
176 for (ACMatchClassifications::const_iterator i(classifications.begin() + 1); 176 for (ACMatchClassifications::const_iterator i(classifications.begin() + 1);
177 i != classifications.end(); ++i) { 177 i != classifications.end(); ++i) {
178 DCHECK(i->offset > last_offset) << "Classification unsorted"; 178 DCHECK(i->offset > last_offset) << "Classification unsorted";
179 DCHECK(i->offset < text.length()) << "Classification out of bounds"; 179 DCHECK(i->offset < text.length()) << "Classification out of bounds";
180 last_offset = i->offset; 180 last_offset = i->offset;
181 } 181 }
182 } 182 }
183 #endif 183 #endif
OLDNEW
« no previous file with comments | « chrome/browser/accessibility/browser_accessibility_win.cc ('k') | chrome/browser/autocomplete/history_contents_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698