Chromium Code Reviews| Index: chrome/browser/predictors/predictor_database.cc |
| diff --git a/chrome/browser/predictors/predictor_database.cc b/chrome/browser/predictors/predictor_database.cc |
| index dc293e432194b84ba5a036d7cba86c5e5744f5c4..1c95b64e5da59d5afa3e2b765baa8551091ad331 100644 |
| --- a/chrome/browser/predictors/predictor_database.cc |
| +++ b/chrome/browser/predictors/predictor_database.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/stringprintf.h" |
| #include "base/metrics/histogram.h" |
| #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" |
| +#include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "sql/connection.h" |
| @@ -48,7 +49,11 @@ class PredictorDatabaseInternal |
| FilePath db_path_; |
| sql::Connection db_; |
| + |
| + // TODO(shishir): These tables may not need to be refcounted. Maybe move them |
| + // to using a WeakPtr instead. |
| scoped_refptr<AutocompleteActionPredictorTable> autocomplete_table_; |
| + scoped_refptr<ResourcePrefetchPredictorTables> resource_prefetch_tables_; |
| DISALLOW_COPY_AND_ASSIGN(PredictorDatabaseInternal); |
| }; |
| @@ -56,7 +61,8 @@ class PredictorDatabaseInternal |
| PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile) |
| : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), |
| - autocomplete_table_(new AutocompleteActionPredictorTable()) { |
| + autocomplete_table_(new AutocompleteActionPredictorTable()), |
| + resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { |
| } |
| PredictorDatabaseInternal::~PredictorDatabaseInternal() { |
| @@ -72,6 +78,7 @@ void PredictorDatabaseInternal::Initialize() { |
| return; |
| autocomplete_table_->Initialize(&db_); |
| + resource_prefetch_tables_->Initialize(&db_); |
| LogDatabaseStats(); |
| } |
| @@ -80,6 +87,7 @@ void PredictorDatabaseInternal::SetCancelled() { |
| CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| autocomplete_table_->cancelled_.Set(); |
| + resource_prefetch_tables_->cancelled_.Set(); |
|
willchan no longer on Chromium
2012/06/18 20:15:12
Isn't |cancelled_| an internal member variable? Wh
Shishir
2012/06/18 20:38:33
Added an SetCancelled method for this. I had this
|
| } |
| void PredictorDatabaseInternal::LogDatabaseStats() { |
| @@ -92,9 +100,9 @@ void PredictorDatabaseInternal::LogDatabaseStats() { |
| static_cast<int>(db_size / 1024)); |
| autocomplete_table_->LogDatabaseStats(); |
| + resource_prefetch_tables_->LogDatabaseStats(); |
| } |
| - |
| PredictorDatabase::PredictorDatabase(Profile* profile) |
| : db_(new PredictorDatabaseInternal(profile)) { |
| content::BrowserThread::PostTask(content::BrowserThread::DB, FROM_HERE, |
| @@ -113,6 +121,11 @@ scoped_refptr<AutocompleteActionPredictorTable> |
| return db_->autocomplete_table_; |
| } |
| +scoped_refptr<ResourcePrefetchPredictorTables> |
| + PredictorDatabase::resource_prefetch_tables() { |
| + return db_->resource_prefetch_tables_; |
| +} |
| + |
| sql::Connection* PredictorDatabase::GetDatabase() { |
| return &db_->db_; |
| } |