| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/autocomplete_match.h" | 5 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 6 | 6 |
| 7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 DCHECK(!classifications.empty()) << "No classification for \"" << text << '"'; | 390 DCHECK(!classifications.empty()) << "No classification for \"" << text << '"'; |
| 391 DCHECK_EQ(0U, classifications[0].offset) | 391 DCHECK_EQ(0U, classifications[0].offset) |
| 392 << "Classification misses beginning for \"" << text << '"'; | 392 << "Classification misses beginning for \"" << text << '"'; |
| 393 if (classifications.size() == 1) | 393 if (classifications.size() == 1) |
| 394 return; | 394 return; |
| 395 | 395 |
| 396 // The classifications should always be sorted. | 396 // The classifications should always be sorted. |
| 397 size_t last_offset = classifications[0].offset; | 397 size_t last_offset = classifications[0].offset; |
| 398 for (ACMatchClassifications::const_iterator i(classifications.begin() + 1); | 398 for (ACMatchClassifications::const_iterator i(classifications.begin() + 1); |
| 399 i != classifications.end(); ++i) { | 399 i != classifications.end(); ++i) { |
| 400 const char* provider_name = provider ? provider->GetName() : "None"; |
| 400 DCHECK_GT(i->offset, last_offset) | 401 DCHECK_GT(i->offset, last_offset) |
| 401 << " Classification for \"" << text << "\" with offset of " << i->offset | 402 << " Classification for \"" << text << "\" with offset of " << i->offset |
| 402 << " is unsorted in relation to last offset of " << last_offset | 403 << " is unsorted in relation to last offset of " << last_offset |
| 403 << ". Provider: " << (provider ? provider->name() : "None") << "."; | 404 << ". Provider: " << provider_name << "."; |
| 404 DCHECK_LT(i->offset, text.length()) | 405 DCHECK_LT(i->offset, text.length()) |
| 405 << " Classification of [" << i->offset << "," << text.length() | 406 << " Classification of [" << i->offset << "," << text.length() |
| 406 << "] is out of bounds for \"" << text << "\". Provider: " | 407 << "] is out of bounds for \"" << text << "\". Provider: " |
| 407 << (provider ? provider->name() : "None") << "."; | 408 << provider_name << "."; |
| 408 last_offset = i->offset; | 409 last_offset = i->offset; |
| 409 } | 410 } |
| 410 } | 411 } |
| 411 #endif | 412 #endif |
| OLD | NEW |