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

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

Issue 1533703002: [sql] Consider fresh databases suitable for memory-mapped I/O. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eyeroll and 0UL Created 5 years 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/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
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 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) { 71 resource_prefetch_tables_(new ResourcePrefetchPredictorTables()) {
72 db_->set_histogram_tag("Predictor"); 72 db_->set_histogram_tag("Predictor");
73
74 // TODO(shess): The current mitigation for http://crbug.com/537742 stores
75 // state in the meta table, which this database does not use.
76 db_->set_mmap_disabled();
77
73 ResourcePrefetchPredictorConfig config; 78 ResourcePrefetchPredictorConfig config;
74 is_resource_prefetch_predictor_enabled_ = 79 is_resource_prefetch_predictor_enabled_ =
75 IsSpeculativeResourcePrefetchingEnabled(profile, &config); 80 IsSpeculativeResourcePrefetchingEnabled(profile, &config);
76 } 81 }
77 82
78 PredictorDatabaseInternal::~PredictorDatabaseInternal() { 83 PredictorDatabaseInternal::~PredictorDatabaseInternal() {
79 // 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
80 // 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.
81 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) 86 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB))
82 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release()); 87 BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 scoped_refptr<ResourcePrefetchPredictorTables> 151 scoped_refptr<ResourcePrefetchPredictorTables>
147 PredictorDatabase::resource_prefetch_tables() { 152 PredictorDatabase::resource_prefetch_tables() {
148 return db_->resource_prefetch_tables_; 153 return db_->resource_prefetch_tables_;
149 } 154 }
150 155
151 sql::Connection* PredictorDatabase::GetDatabase() { 156 sql::Connection* PredictorDatabase::GetDatabase() {
152 return db_->db_.get(); 157 return db_->db_.get();
153 } 158 }
154 159
155 } // namespace predictors 160 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/extensions/activity_log/activity_database.cc ('k') | content/browser/dom_storage/dom_storage_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698