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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 scoped_refptr<ResourcePrefetchPredictorTables> resource_prefetch_tables_; | 61 scoped_refptr<ResourcePrefetchPredictorTables> resource_prefetch_tables_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(PredictorDatabaseInternal); | 63 DISALLOW_COPY_AND_ASSIGN(PredictorDatabaseInternal); |
64 }; | 64 }; |
65 | 65 |
66 | 66 |
67 PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile) | 67 PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile) |
68 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), | 68 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), |
69 db_(new sql::Connection()), | 69 db_(new sql::Connection()), |
70 autocomplete_table_(new AutocompleteActionPredictorTable()), | 70 autocomplete_table_(new AutocompleteActionPredictorTable()), |
71 logged_in_table_(new LoggedInPredictorTable()), | |
72 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { | 71 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { |
| 72 // TODO (tburkard): initialize logged_in_table_ member. |
73 ResourcePrefetchPredictorConfig config; | 73 ResourcePrefetchPredictorConfig config; |
74 is_resource_prefetch_predictor_enabled_ = | 74 is_resource_prefetch_predictor_enabled_ = |
75 IsSpeculativeResourcePrefetchingEnabled(profile, &config); | 75 IsSpeculativeResourcePrefetchingEnabled(profile, &config); |
76 } | 76 } |
77 | 77 |
78 PredictorDatabaseInternal::~PredictorDatabaseInternal() { | 78 PredictorDatabaseInternal::~PredictorDatabaseInternal() { |
79 // The connection pointer needs to be deleted on the DB thread since there | 79 // The connection pointer needs to be deleted on the DB thread since there |
80 // might be a task in progress on the DB thread which uses this connection. | 80 // might be a task in progress on the DB thread which uses this connection. |
81 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release()); | 81 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release()); |
82 } | 82 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 scoped_refptr<ResourcePrefetchPredictorTables> | 137 scoped_refptr<ResourcePrefetchPredictorTables> |
138 PredictorDatabase::resource_prefetch_tables() { | 138 PredictorDatabase::resource_prefetch_tables() { |
139 return db_->resource_prefetch_tables_; | 139 return db_->resource_prefetch_tables_; |
140 } | 140 } |
141 | 141 |
142 sql::Connection* PredictorDatabase::GetDatabase() { | 142 sql::Connection* PredictorDatabase::GetDatabase() { |
143 return db_->db_.get(); | 143 return db_->db_.get(); |
144 } | 144 } |
145 | 145 |
146 } // namespace predictors | 146 } // namespace predictors |
OLD | NEW |