| 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/in_memory_url_index.h" | 5 #include "chrome/browser/history/in_memory_url_index.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 ScoredHistoryMatch::ScoredHistoryMatch(const URLRow& url_info, | 27 ScoredHistoryMatch::ScoredHistoryMatch(const URLRow& url_info, |
| 28 size_t input_location, | 28 size_t input_location, |
| 29 bool match_in_scheme, | 29 bool match_in_scheme, |
| 30 bool innermost_match, | 30 bool innermost_match, |
| 31 int score) | 31 int score) |
| 32 : HistoryMatch(url_info, input_location, match_in_scheme, innermost_match), | 32 : HistoryMatch(url_info, input_location, match_in_scheme, innermost_match), |
| 33 raw_score(score) { | 33 raw_score(score) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 struct InMemoryURLIndex::TermCharWordSet { |
| 37 TermCharWordSet(Char16Set char_set, WordIDSet word_id_set, bool used) |
| 38 : char_set_(char_set), |
| 39 word_id_set_(word_id_set), |
| 40 used_(used) {} |
| 41 |
| 42 bool IsNotUsed() const { return !used_; } |
| 43 |
| 44 Char16Set char_set_; |
| 45 WordIDSet word_id_set_; |
| 46 bool used_; // true if this set has been used for the current term search. |
| 47 }; |
| 48 |
| 36 InMemoryURLIndex::InMemoryURLIndex() : history_item_count_(0) {} | 49 InMemoryURLIndex::InMemoryURLIndex() : history_item_count_(0) {} |
| 37 | 50 |
| 38 InMemoryURLIndex::~InMemoryURLIndex() {} | 51 InMemoryURLIndex::~InMemoryURLIndex() {} |
| 39 | 52 |
| 40 static const int32_t kURLToLowerBufferSize = 2048; | 53 static const int32_t kURLToLowerBufferSize = 2048; |
| 41 | 54 |
| 42 // Indexing | 55 // Indexing |
| 43 | 56 |
| 44 bool InMemoryURLIndex::Init(history::URLDatabase* history_db, | 57 bool InMemoryURLIndex::Init(history::URLDatabase* history_db, |
| 45 const std::string& languages) { | 58 const std::string& languages) { |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 if (scored_matches_.size() > 10) { | 511 if (scored_matches_.size() > 10) { |
| 499 scored_matches_.erase(scored_matches_.begin() + 10, | 512 scored_matches_.erase(scored_matches_.begin() + 10, |
| 500 scored_matches_.end()); | 513 scored_matches_.end()); |
| 501 } | 514 } |
| 502 } | 515 } |
| 503 } | 516 } |
| 504 } | 517 } |
| 505 } | 518 } |
| 506 | 519 |
| 507 } // namespace history | 520 } // namespace history |
| OLD | NEW |