Chromium Code Reviews| 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/predictors/autocomplete_action_predictor_table.h" | 5 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 "CREATE TABLE %s ( " | 236 "CREATE TABLE %s ( " |
| 237 "id TEXT PRIMARY KEY, " | 237 "id TEXT PRIMARY KEY, " |
| 238 "user_text TEXT, " | 238 "user_text TEXT, " |
| 239 "url TEXT, " | 239 "url TEXT, " |
| 240 "number_of_hits INTEGER, " | 240 "number_of_hits INTEGER, " |
| 241 "number_of_misses INTEGER)", kAutocompletePredictorTableName).c_str()); | 241 "number_of_misses INTEGER)", kAutocompletePredictorTableName).c_str()); |
| 242 if (!success) | 242 if (!success) |
| 243 ResetDB(); | 243 ResetDB(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void AutocompleteActionPredictorTable::LogDatabaseStats() { | 246 void AutocompleteActionPredictorTable::LogDatabaseStats(Profile* profile) { |
|
dominich
2012/08/29 22:29:29
why are you passing this in?
Shishir
2012/08/29 22:51:06
Used to determine if prefreshing is enabled.
| |
| 247 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::DB)); | 247 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::DB)); |
| 248 if (CantAccessDatabase()) | 248 if (CantAccessDatabase()) |
| 249 return; | 249 return; |
| 250 | 250 |
| 251 sql::Statement count_statement(DB()->GetUniqueStatement( | 251 sql::Statement count_statement(DB()->GetUniqueStatement( |
| 252 base::StringPrintf("SELECT count(id) FROM %s", | 252 base::StringPrintf("SELECT count(id) FROM %s", |
| 253 kAutocompletePredictorTableName).c_str())); | 253 kAutocompletePredictorTableName).c_str())); |
| 254 if (!count_statement.is_valid() || !count_statement.Step()) | 254 if (!count_statement.is_valid() || !count_statement.Step()) |
| 255 return; | 255 return; |
| 256 UMA_HISTOGRAM_COUNTS("AutocompleteActionPredictor.DatabaseRowCount", | 256 UMA_HISTOGRAM_COUNTS("AutocompleteActionPredictor.DatabaseRowCount", |
| 257 count_statement.ColumnInt(0)); | 257 count_statement.ColumnInt(0)); |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace predictors | 260 } // namespace predictors |
| OLD | NEW |