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 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <functional> | 9 #include <functional> |
10 #include <map> | 10 #include <map> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // A map from word_id to history item. | 114 // A map from word_id to history item. |
115 // TODO(mrossetti): URLID is 64 bit: a memory bloat and performance hit. | 115 // TODO(mrossetti): URLID is 64 bit: a memory bloat and performance hit. |
116 // Consider using a smaller type. | 116 // Consider using a smaller type. |
117 typedef URLID HistoryID; | 117 typedef URLID HistoryID; |
118 typedef std::set<HistoryID> HistoryIDSet; | 118 typedef std::set<HistoryID> HistoryIDSet; |
119 typedef std::map<WordID, HistoryIDSet> WordIDHistoryMap; | 119 typedef std::map<WordID, HistoryIDSet> WordIDHistoryMap; |
120 | 120 |
121 // Support caching of term character intersections so that we can optimize | 121 // Support caching of term character intersections so that we can optimize |
122 // searches which build upon a previous search. | 122 // searches which build upon a previous search. |
123 struct TermCharWordSet { | 123 struct TermCharWordSet; |
124 TermCharWordSet(Char16Set char_set, WordIDSet word_id_set, bool used) | |
125 : char_set_(char_set), | |
126 word_id_set_(word_id_set), | |
127 used_(used) {} | |
128 | |
129 bool IsNotUsed() const { return !used_; } | |
130 | |
131 Char16Set char_set_; | |
132 WordIDSet word_id_set_; | |
133 bool used_; // true if this set has been used for the current term search. | |
134 }; | |
135 typedef std::vector<TermCharWordSet> TermCharWordSetVector; | 124 typedef std::vector<TermCharWordSet> TermCharWordSetVector; |
136 | 125 |
137 // TODO(rohitrao): Probably replace this with QueryResults. | 126 // TODO(rohitrao): Probably replace this with QueryResults. |
138 typedef std::vector<URLRow> URLRowVector; | 127 typedef std::vector<URLRow> URLRowVector; |
139 | 128 |
140 // A map from history_id to the history's URL and title. | 129 // A map from history_id to the history's URL and title. |
141 typedef std::map<HistoryID, URLRow> HistoryInfoMap; | 130 typedef std::map<HistoryID, URLRow> HistoryInfoMap; |
142 | 131 |
143 // A helper class which performs the final filter on each candidate | 132 // A helper class which performs the final filter on each candidate |
144 // history URL match, inserting accepted matches into |scored_matches_| | 133 // history URL match, inserting accepted matches into |scored_matches_| |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 TermCharWordSetVector term_char_word_set_cache_; | 226 TermCharWordSetVector term_char_word_set_cache_; |
238 HistoryInfoMap history_info_map_; | 227 HistoryInfoMap history_info_map_; |
239 std::string languages_; | 228 std::string languages_; |
240 | 229 |
241 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); | 230 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); |
242 }; | 231 }; |
243 | 232 |
244 } // namespace history | 233 } // namespace history |
245 | 234 |
246 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 235 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
OLD | NEW |