Commit a9657429 authored by Shubham Aggarwal's avatar Shubham Aggarwal Committed by Commit Bot

Migrate web_database to use the new sql::Database constructor

Migrate uses of the relevant set_* functions on the sql::Database object
to use the new DatabaseOptions constructor instead.

This change should have no intended behavioral effect.

Bug: 1126968
Change-Id: I6418c277524475d7f3f2bae2a09d988e309e40c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533406
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826810}
parent abc5b03a
...@@ -48,7 +48,18 @@ sql::InitStatus FailedMigrationTo(int version_num) { ...@@ -48,7 +48,18 @@ sql::InitStatus FailedMigrationTo(int version_num) {
} // namespace } // namespace
WebDatabase::WebDatabase() {} WebDatabase::WebDatabase()
: db_({// Run the database in exclusive mode. Nobody else should be
// accessing the database while we're running, and this will give
// somewhat improved perf.
.exclusive_locking = true,
// We don't store that much data in the tables so use a small page
// size. This provides a large benefit for empty tables (which is
// very likely with the tables we create).
.page_size = 2048,
// We shouldn't have much data and what access we currently have is
// quite infrequent. So we go with a small cache size.
.cache_size = 32}) {}
WebDatabase::~WebDatabase() {} WebDatabase::~WebDatabase() {}
...@@ -80,19 +91,6 @@ sql::Database* WebDatabase::GetSQLConnection() { ...@@ -80,19 +91,6 @@ sql::Database* WebDatabase::GetSQLConnection() {
sql::InitStatus WebDatabase::Init(const base::FilePath& db_name) { sql::InitStatus WebDatabase::Init(const base::FilePath& db_name) {
db_.set_histogram_tag("Web"); db_.set_histogram_tag("Web");
// We don't store that much data in the tables so use a small page size.
// This provides a large benefit for empty tables (which is very likely with
// the tables we create).
db_.set_page_size(2048);
// We shouldn't have much data and what access we currently have is quite
// infrequent. So we go with a small cache size.
db_.set_cache_size(32);
// Run the database in exclusive mode. Nobody else should be accessing the
// database while we're running, and this will give somewhat improved perf.
db_.set_exclusive_locking();
if ((db_name.value() == kInMemoryPath) ? !db_.OpenInMemory() if ((db_name.value() == kInMemoryPath) ? !db_.OpenInMemory()
: !db_.Open(db_name)) { : !db_.Open(db_name)) {
return sql::INIT_FAILURE; return sql::INIT_FAILURE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment