| 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/predictor_database.h" | 5 #include "chrome/browser/predictors/predictor_database.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 scoped_refptr<ResourcePrefetchPredictorTables> resource_prefetch_tables_; | 63 scoped_refptr<ResourcePrefetchPredictorTables> resource_prefetch_tables_; |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(PredictorDatabaseInternal); | 65 DISALLOW_COPY_AND_ASSIGN(PredictorDatabaseInternal); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 | 68 |
| 69 PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile) | 69 PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile) |
| 70 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), | 70 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), |
| 71 db_(new sql::Connection()), | 71 db_(new sql::Connection()), |
| 72 autocomplete_table_(new AutocompleteActionPredictorTable()), | 72 autocomplete_table_(new AutocompleteActionPredictorTable()), |
| 73 logged_in_table_(new LoggedInPredictorTable()), | 73 // TODO(tburkard): initialize logged_in_table_ |
| 74 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { | 74 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { |
| 75 ResourcePrefetchPredictorConfig config; | 75 ResourcePrefetchPredictorConfig config; |
| 76 is_resource_prefetch_predictor_enabled_ = | 76 is_resource_prefetch_predictor_enabled_ = |
| 77 IsSpeculativeResourcePrefetchingEnabled(profile, &config); | 77 IsSpeculativeResourcePrefetchingEnabled(profile, &config); |
| 78 } | 78 } |
| 79 | 79 |
| 80 PredictorDatabaseInternal::~PredictorDatabaseInternal() { | 80 PredictorDatabaseInternal::~PredictorDatabaseInternal() { |
| 81 // The connection pointer needs to be deleted on the DB thread since there | 81 // The connection pointer needs to be deleted on the DB thread since there |
| 82 // might be a task in progress on the DB thread which uses this connection. | 82 // might be a task in progress on the DB thread which uses this connection. |
| 83 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release()); | 83 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 scoped_refptr<ResourcePrefetchPredictorTables> | 147 scoped_refptr<ResourcePrefetchPredictorTables> |
| 148 PredictorDatabase::resource_prefetch_tables() { | 148 PredictorDatabase::resource_prefetch_tables() { |
| 149 return db_->resource_prefetch_tables_; | 149 return db_->resource_prefetch_tables_; |
| 150 } | 150 } |
| 151 | 151 |
| 152 sql::Connection* PredictorDatabase::GetDatabase() { | 152 sql::Connection* PredictorDatabase::GetDatabase() { |
| 153 return db_->db_.get(); | 153 return db_->db_.get(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace predictors | 156 } // namespace predictors |
| OLD | NEW |