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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_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
« no previous file with comments | « no previous file | chrome/browser/predictors/predictor_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/activity_log/activity_database.h" 5 #include "chrome/browser/extensions/activity_log/activity_database.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 did_init_ = true; 59 did_init_ = true;
60 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) 60 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB))
61 DCHECK_CURRENTLY_ON(BrowserThread::DB); 61 DCHECK_CURRENTLY_ON(BrowserThread::DB);
62 db_.set_histogram_tag("Activity"); 62 db_.set_histogram_tag("Activity");
63 db_.set_error_callback( 63 db_.set_error_callback(
64 base::Bind(&ActivityDatabase::DatabaseErrorCallback, 64 base::Bind(&ActivityDatabase::DatabaseErrorCallback,
65 base::Unretained(this))); 65 base::Unretained(this)));
66 db_.set_page_size(4096); 66 db_.set_page_size(4096);
67 db_.set_cache_size(32); 67 db_.set_cache_size(32);
68 68
69 // TODO(shess): The current mitigation for http://crbug.com/537742 stores
70 // state in the meta table, which this database does not use.
71 db_.set_mmap_disabled();
72
69 if (!db_.Open(db_name)) { 73 if (!db_.Open(db_name)) {
70 LOG(ERROR) << db_.GetErrorMessage(); 74 LOG(ERROR) << db_.GetErrorMessage();
71 return LogInitFailure(); 75 return LogInitFailure();
72 } 76 }
73 77
74 // Wrap the initialization in a transaction so that the db doesn't 78 // Wrap the initialization in a transaction so that the db doesn't
75 // get corrupted if init fails/crashes. 79 // get corrupted if init fails/crashes.
76 sql::Transaction committer(&db_); 80 sql::Transaction committer(&db_);
77 if (!committer.Begin()) 81 if (!committer.Begin())
78 return LogInitFailure(); 82 return LogInitFailure();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 field_types[i]); 234 field_types[i]);
231 if (!db->Execute(table_updater.c_str())) 235 if (!db->Execute(table_updater.c_str()))
232 return false; 236 return false;
233 } 237 }
234 } 238 }
235 } 239 }
236 return true; 240 return true;
237 } 241 }
238 242
239 } // namespace extensions 243 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/predictors/predictor_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698