OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <functional> | 8 #include <functional> |
9 #include <iterator> | 9 #include <iterator> |
10 #include <limits> | 10 #include <limits> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 score += (value - value_ranks[i]) * | 108 score += (value - value_ranks[i]) * |
109 (kScoreRank[i - 1] - kScoreRank[i]) / | 109 (kScoreRank[i - 1] - kScoreRank[i]) / |
110 (value_ranks[i - 1] - value_ranks[i]); | 110 (value_ranks[i - 1] - value_ranks[i]); |
111 } | 111 } |
112 return score; | 112 return score; |
113 } | 113 } |
114 | 114 |
115 InMemoryURLIndex::InMemoryURLIndex(const FilePath& history_dir) | 115 InMemoryURLIndex::InMemoryURLIndex(const FilePath& history_dir) |
116 : history_dir_(history_dir), | 116 : history_dir_(history_dir), |
117 private_data_(new URLIndexPrivateData), | 117 private_data_(new URLIndexPrivateData), |
118 cached_at_shutdown_(false) { | 118 cached_at_shutdown_(false), |
| 119 pre_filter_item_count(0), |
| 120 post_filter_item_count(0), |
| 121 post_scoring_item_count(0) { |
119 InMemoryURLIndex::InitializeSchemeWhitelist(&scheme_whitelist_); | 122 InMemoryURLIndex::InitializeSchemeWhitelist(&scheme_whitelist_); |
120 } | 123 } |
121 | 124 |
122 // Called only by unit tests. | 125 // Called only by unit tests. |
123 InMemoryURLIndex::InMemoryURLIndex() | 126 InMemoryURLIndex::InMemoryURLIndex() |
124 : private_data_(new URLIndexPrivateData), | 127 : private_data_(new URLIndexPrivateData), |
125 cached_at_shutdown_(false) { | 128 cached_at_shutdown_(false), |
| 129 pre_filter_item_count(0), |
| 130 post_filter_item_count(0), |
| 131 post_scoring_item_count(0) { |
126 InMemoryURLIndex::InitializeSchemeWhitelist(&scheme_whitelist_); | 132 InMemoryURLIndex::InitializeSchemeWhitelist(&scheme_whitelist_); |
127 } | 133 } |
128 | 134 |
129 InMemoryURLIndex::~InMemoryURLIndex() { | 135 InMemoryURLIndex::~InMemoryURLIndex() { |
130 // If there was a history directory (which there won't be for some unit tests) | 136 // If there was a history directory (which there won't be for some unit tests) |
131 // then insure that the cache has already been saved. | 137 // then insure that the cache has already been saved. |
132 DCHECK(history_dir_.empty() || cached_at_shutdown_); | 138 DCHECK(history_dir_.empty() || cached_at_shutdown_); |
133 } | 139 } |
134 | 140 |
135 // static | 141 // static |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 if (iter->has_title()) { | 1140 if (iter->has_title()) { |
1135 string16 title(UTF8ToUTF16(iter->title())); | 1141 string16 title(UTF8ToUTF16(iter->title())); |
1136 url_row.set_title(title); | 1142 url_row.set_title(title); |
1137 } | 1143 } |
1138 private_data_->history_info_map_[history_id] = url_row; | 1144 private_data_->history_info_map_[history_id] = url_row; |
1139 } | 1145 } |
1140 return true; | 1146 return true; |
1141 } | 1147 } |
1142 | 1148 |
1143 } // namespace history | 1149 } // namespace history |
OLD | NEW |