Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: chrome/browser/predictors/predictor_database.cc

Issue 2847183002: predictors: Introduce GlowplugPredictor. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
8 #include <memory> 8 #include <memory>
9 9
10 #include <memory>
11
10 #include "base/bind.h" 12 #include "base/bind.h"
11 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
12 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
13 #include "base/logging.h" 15 #include "base/logging.h"
14 #include "base/macros.h" 16 #include "base/macros.h"
15 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" 17 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h"
18 #include "chrome/browser/predictors/glowplug_config.h"
16 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 19 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
17 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" 20 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h"
18 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
19 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
20 #include "sql/connection.h" 23 #include "sql/connection.h"
21 24
22 using content::BrowserThread; 25 using content::BrowserThread;
23 26
24 namespace { 27 namespace {
25 28
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile) 70 PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile)
68 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)), 71 : db_path_(profile->GetPath().Append(kPredictorDatabaseName)),
69 db_(new sql::Connection()), 72 db_(new sql::Connection()),
70 autocomplete_table_(new AutocompleteActionPredictorTable()), 73 autocomplete_table_(new AutocompleteActionPredictorTable()),
71 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { 74 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) {
72 db_->set_histogram_tag("Predictor"); 75 db_->set_histogram_tag("Predictor");
73 76
74 // This db does not use [meta] table, store mmap status data elsewhere. 77 // This db does not use [meta] table, store mmap status data elsewhere.
75 db_->set_mmap_alt_status(); 78 db_->set_mmap_alt_status();
76 79
77 ResourcePrefetchPredictorConfig config;
78 is_resource_prefetch_predictor_enabled_ = 80 is_resource_prefetch_predictor_enabled_ =
79 IsSpeculativeResourcePrefetchingEnabled(profile, &config); 81 IsSpeculativeResourcePrefetchingEnabled(profile, nullptr);
80 } 82 }
81 83
82 PredictorDatabaseInternal::~PredictorDatabaseInternal() { 84 PredictorDatabaseInternal::~PredictorDatabaseInternal() {
83 // The connection pointer needs to be deleted on the DB thread since there 85 // 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. 86 // might be a task in progress on the DB thread which uses this connection.
85 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) 87 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB))
86 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release()); 88 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release());
87 } 89 }
88 90
89 void PredictorDatabaseInternal::Initialize() { 91 void PredictorDatabaseInternal::Initialize() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 scoped_refptr<ResourcePrefetchPredictorTables> 147 scoped_refptr<ResourcePrefetchPredictorTables>
146 PredictorDatabase::resource_prefetch_tables() { 148 PredictorDatabase::resource_prefetch_tables() {
147 return db_->resource_prefetch_tables_; 149 return db_->resource_prefetch_tables_;
148 } 150 }
149 151
150 sql::Connection* PredictorDatabase::GetDatabase() { 152 sql::Connection* PredictorDatabase::GetDatabase() {
151 return db_->db_.get(); 153 return db_->db_.get();
152 } 154 }
153 155
154 } // namespace predictors 156 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698