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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 // if the history service is available, or registers for the notification of | 134 // if the history service is available, or registers for the notification of |
135 // it becoming available. | 135 // it becoming available. |
136 void CreateCaches( | 136 void CreateCaches( |
137 std::vector<NetworkActionPredictorDatabase::Row>* row_buffer); | 137 std::vector<NetworkActionPredictorDatabase::Row>* row_buffer); |
138 | 138 |
139 // Attempts to call DeleteOldEntries if the in-memory database has been loaded | 139 // Attempts to call DeleteOldEntries if the in-memory database has been loaded |
140 // by |service|. Returns success as a boolean. | 140 // by |service|. Returns success as a boolean. |
141 bool TryDeleteOldEntries(HistoryService* service); | 141 bool TryDeleteOldEntries(HistoryService* service); |
142 | 142 |
143 // Uses local caches to calculate an exact percentage prediction that the user | 143 // Uses local caches to calculate an exact percentage prediction that the user |
144 // will take a particular match given what they have typed. | 144 // will take a particular match given what they have typed. |is_in_db| is set |
145 double ExactAlgorithm(const string16& user_text, | 145 // to differentiate trivial zero results from actual zero results. |
Peter Kasting
2011/12/08 00:10:24
Nit: You might want to give more detail here on wh
| |
146 const AutocompleteMatch& match) const; | 146 double CalculateConfidence(const string16& user_text, |
147 const AutocompleteMatch& match, | |
148 bool* is_in_db) const; | |
147 | 149 |
148 // Adds a row to the database and caches. | 150 // Adds a row to the database and caches. |
149 void AddRow(const DBCacheKey& key, | 151 void AddRow(const DBCacheKey& key, |
150 const NetworkActionPredictorDatabase::Row& row); | 152 const NetworkActionPredictorDatabase::Row& row); |
151 | 153 |
152 // Updates a row in the database and the caches. | 154 // Updates a row in the database and the caches. |
153 void UpdateRow(DBCacheMap::iterator it, | 155 void UpdateRow(DBCacheMap::iterator it, |
154 const NetworkActionPredictorDatabase::Row& row); | 156 const NetworkActionPredictorDatabase::Row& row); |
155 | 157 |
156 // Removes all rows from the database and caches. | 158 // Removes all rows from the database and caches. |
(...skipping 15 matching lines...) Expand all Loading... | |
172 | 174 |
173 DBCacheMap db_cache_; | 175 DBCacheMap db_cache_; |
174 DBIdCacheMap db_id_cache_; | 176 DBIdCacheMap db_id_cache_; |
175 | 177 |
176 bool initialized_; | 178 bool initialized_; |
177 | 179 |
178 DISALLOW_COPY_AND_ASSIGN(NetworkActionPredictor); | 180 DISALLOW_COPY_AND_ASSIGN(NetworkActionPredictor); |
179 }; | 181 }; |
180 | 182 |
181 #endif // CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ | 183 #endif // CHROME_BROWSER_AUTOCOMPLETE_NETWORK_ACTION_PREDICTOR_H_ |
OLD | NEW |