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 <stdint.h> | 7 #include <stdint.h> |
alexilin
2017/05/12 14:26:46
nit:
/stdint.h/cstdint
and get rid of empty line?
Benoit L
2017/05/12 15:13:12
Done.
| |
8 | |
8 #include <memory> | 9 #include <memory> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" | 16 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" |
17 #include "chrome/browser/predictors/glowplug_config.h" | |
16 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 18 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
17 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" | 19 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" |
18 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
19 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
20 #include "sql/connection.h" | 22 #include "sql/connection.h" |
21 | 23 |
22 using content::BrowserThread; | 24 using content::BrowserThread; |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile) | 69 PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile) |
68 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), | 70 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), |
69 db_(new sql::Connection()), | 71 db_(new sql::Connection()), |
70 autocomplete_table_(new AutocompleteActionPredictorTable()), | 72 autocomplete_table_(new AutocompleteActionPredictorTable()), |
71 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { | 73 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { |
72 db_->set_histogram_tag("Predictor"); | 74 db_->set_histogram_tag("Predictor"); |
73 | 75 |
74 // This db does not use [meta] table, store mmap status data elsewhere. | 76 // This db does not use [meta] table, store mmap status data elsewhere. |
75 db_->set_mmap_alt_status(); | 77 db_->set_mmap_alt_status(); |
76 | 78 |
77 ResourcePrefetchPredictorConfig config; | |
78 is_resource_prefetch_predictor_enabled_ = | 79 is_resource_prefetch_predictor_enabled_ = |
79 IsSpeculativeResourcePrefetchingEnabled(profile, &config); | 80 IsSpeculativeResourcePrefetchingEnabled(profile, nullptr); |
80 } | 81 } |
81 | 82 |
82 PredictorDatabaseInternal::~PredictorDatabaseInternal() { | 83 PredictorDatabaseInternal::~PredictorDatabaseInternal() { |
83 // The connection pointer needs to be deleted on the DB thread since there | 84 // The connection pointer needs to be deleted on the DB thread since there |
84 // might be a task in progress on the DB thread which uses this connection. | 85 // might be a task in progress on the DB thread which uses this connection. |
85 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) | 86 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) |
86 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release()); | 87 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release()); |
87 } | 88 } |
88 | 89 |
89 void PredictorDatabaseInternal::Initialize() { | 90 void PredictorDatabaseInternal::Initialize() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 scoped_refptr<ResourcePrefetchPredictorTables> | 146 scoped_refptr<ResourcePrefetchPredictorTables> |
146 PredictorDatabase::resource_prefetch_tables() { | 147 PredictorDatabase::resource_prefetch_tables() { |
147 return db_->resource_prefetch_tables_; | 148 return db_->resource_prefetch_tables_; |
148 } | 149 } |
149 | 150 |
150 sql::Connection* PredictorDatabase::GetDatabase() { | 151 sql::Connection* PredictorDatabase::GetDatabase() { |
151 return db_->db_.get(); | 152 return db_->db_.get(); |
152 } | 153 } |
153 | 154 |
154 } // namespace predictors | 155 } // namespace predictors |
OLD | NEW |