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_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.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 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), | 63 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), |
64 autocomplete_table_(new AutocompleteActionPredictorTable()), | 64 autocomplete_table_(new AutocompleteActionPredictorTable()), |
65 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { | 65 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { |
66 } | 66 } |
67 | 67 |
68 PredictorDatabaseInternal::~PredictorDatabaseInternal() { | 68 PredictorDatabaseInternal::~PredictorDatabaseInternal() { |
69 } | 69 } |
70 | 70 |
71 void PredictorDatabaseInternal::Initialize() { | 71 void PredictorDatabaseInternal::Initialize() { |
72 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::DB)); | 72 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::DB)); |
73 | |
74 db_.set_exclusive_locking(); | 73 db_.set_exclusive_locking(); |
75 bool success = db_.Open(db_path_); | 74 bool success = db_.Open(db_path_); |
76 | 75 |
77 if (!success) | 76 if (!success) |
78 return; | 77 return; |
79 | 78 |
80 autocomplete_table_->Initialize(&db_); | 79 autocomplete_table_->Initialize(&db_); |
81 resource_prefetch_tables_->Initialize(&db_); | 80 resource_prefetch_tables_->Initialize(&db_); |
82 | 81 |
83 LogDatabaseStats(); | 82 LogDatabaseStats(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 scoped_refptr<ResourcePrefetchPredictorTables> | 123 scoped_refptr<ResourcePrefetchPredictorTables> |
125 PredictorDatabase::resource_prefetch_tables() { | 124 PredictorDatabase::resource_prefetch_tables() { |
126 return db_->resource_prefetch_tables_; | 125 return db_->resource_prefetch_tables_; |
127 } | 126 } |
128 | 127 |
129 sql::Connection* PredictorDatabase::GetDatabase() { | 128 sql::Connection* PredictorDatabase::GetDatabase() { |
130 return &db_->db_; | 129 return &db_->db_; |
131 } | 130 } |
132 | 131 |
133 } // namespace predictors | 132 } // namespace predictors |
OLD | NEW |