Remove explicit exclusive_locking option
This CL is removing the explicit database option exclusive_locking since it is the default since https://crrev.com/817386. This CL has no behavior changes. R=grt@chromium.org Bug: 1120969 Change-Id: I7d6f415ade90e0161621767a00dadaf9b73b6fe7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5029318 Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: Evan Stade <estade@chromium.org> Commit-Queue: Etienne Bergeron <etienneb@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Cr-Commit-Position: refs/heads/main@{#1225670}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
07ae022a63
commit
8ed80afc33
chrome/browser
components
favicon
history
core
media_device_salt
omnibox
browser
password_manager
core
browser
power_bookmarks
services
storage
shared_storage
user_notes
storage
webdata
common
content/browser
aggregation_service
first_party_sets
database
media
private_aggregation
storage/browser/quota
@ -105,8 +105,7 @@ class SqliteIntegrityTest : public DiagnosticsTest {
|
||||
|
||||
int errors = 0;
|
||||
{ // Scope the statement and database so they close properly.
|
||||
sql::Database database(
|
||||
{.exclusive_locking = true, .page_size = 4096, .cache_size = 500});
|
||||
sql::Database database({.page_size = 4096, .cache_size = 500});
|
||||
scoped_refptr<ErrorRecorder> recorder(new ErrorRecorder);
|
||||
|
||||
// Set the error callback so that we can get useful results in a debug
|
||||
|
@ -76,7 +76,6 @@ PredictorDatabaseInternal::PredictorDatabaseInternal(
|
||||
scoped_refptr<base::SequencedTaskRunner> db_task_runner)
|
||||
: db_path_(profile->GetPath().Append(kPredictorDatabaseName)),
|
||||
db_(std::make_unique<sql::Database>(sql::DatabaseOptions{
|
||||
.exclusive_locking = true,
|
||||
.page_size = 4096,
|
||||
.cache_size = 500,
|
||||
// TODO(pwnall): Add a meta table and remove this option.
|
||||
|
@ -249,11 +249,7 @@ bool FaviconDatabase::IconMappingEnumerator::GetNextIconMapping(
|
||||
}
|
||||
|
||||
FaviconDatabase::FaviconDatabase()
|
||||
: 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,
|
||||
// Favicons db only stores favicons, so we don't need that big a page
|
||||
: db_({// Favicons db only stores favicons, so we don't need that big a page
|
||||
// size or cache.
|
||||
.page_size = 2048,
|
||||
.cache_size = 32}) {}
|
||||
|
@ -180,11 +180,7 @@ bool AndroidCacheDatabase::CreateDatabase(const base::FilePath& db_name) {
|
||||
//
|
||||
// The db doesn't store too much data, so we don't need that big a page
|
||||
// size or cache.
|
||||
//
|
||||
// The database is open in exclusive mode. Nobody else should be accessing the
|
||||
// database while we're running, and this will give somewhat improved perf.
|
||||
sql::Database connection(
|
||||
{.exclusive_locking = true, .page_size = 2048, .cache_size = 32});
|
||||
sql::Database connection({.page_size = 2048, .cache_size = 32});
|
||||
|
||||
if (!connection.Open(db_name_)) {
|
||||
LOG(ERROR) << connection.GetErrorMessage();
|
||||
|
@ -16,7 +16,7 @@
|
||||
namespace history {
|
||||
|
||||
InMemoryDatabase::InMemoryDatabase()
|
||||
: db_({.exclusive_locking = true, .page_size = 4096, .cache_size = 500}) {}
|
||||
: db_({.page_size = 4096, .cache_size = 500}) {}
|
||||
|
||||
InMemoryDatabase::~InMemoryDatabase() = default;
|
||||
|
||||
|
@ -318,8 +318,8 @@ bool TopSitesDatabase::InitImpl(const base::FilePath& db_name) {
|
||||
const bool file_existed = base::PathExists(db_name);
|
||||
|
||||
// Settings copied from FaviconDatabase.
|
||||
db_ = std::make_unique<sql::Database>(sql::DatabaseOptions{
|
||||
.exclusive_locking = true, .page_size = 4096, .cache_size = 32});
|
||||
db_ = std::make_unique<sql::Database>(
|
||||
sql::DatabaseOptions{.page_size = 4096, .cache_size = 32});
|
||||
db_->set_histogram_tag("TopSites");
|
||||
db_->set_error_callback(
|
||||
base::BindRepeating(&TopSitesDatabase::DatabaseErrorCallback,
|
||||
|
@ -37,9 +37,7 @@ std::string CreateRandomSalt() {
|
||||
|
||||
MediaDeviceSaltDatabase::MediaDeviceSaltDatabase(const base::FilePath& db_path)
|
||||
: db_path_(db_path),
|
||||
db_(sql::DatabaseOptions{.exclusive_locking = true,
|
||||
.page_size = 4096,
|
||||
.cache_size = 16}) {}
|
||||
db_(sql::DatabaseOptions{.page_size = 4096, .cache_size = 16}) {}
|
||||
|
||||
absl::optional<std::string> MediaDeviceSaltDatabase::GetOrInsertSalt(
|
||||
const blink::StorageKey& storage_key,
|
||||
|
@ -156,11 +156,7 @@ ShortcutsDatabase::Shortcut::~Shortcut() {
|
||||
// ShortcutsDatabase ----------------------------------------------------------
|
||||
|
||||
ShortcutsDatabase::ShortcutsDatabase(const base::FilePath& database_path)
|
||||
: 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,
|
||||
// Set the database page size to something a little larger to give us
|
||||
: db_({// Set the database page size to something a little larger to give us
|
||||
// better performance (we're typically seek rather than bandwidth
|
||||
// limited). Must be a power of 2 and a max of 65536.
|
||||
.page_size = 4096,
|
||||
|
@ -1064,7 +1064,7 @@ LoginDatabase::LoginDatabase(const base::FilePath& db_path,
|
||||
: db_path_(db_path),
|
||||
is_account_store_(is_account_store),
|
||||
// Set options for a small, private database (based on WebDatabase).
|
||||
db_({.exclusive_locking = true, .page_size = 2048, .cache_size = 32}) {}
|
||||
db_({.page_size = 2048, .cache_size = 32}) {}
|
||||
|
||||
LoginDatabase::~LoginDatabase() = default;
|
||||
|
||||
|
@ -47,8 +47,8 @@ class StatisticsTableTest : public testing::Test {
|
||||
void ReloadDatabase() {
|
||||
base::FilePath file = temp_dir_.GetPath().AppendASCII("TestDatabase");
|
||||
db_ = std::make_unique<StatisticsTable>();
|
||||
connection_ = std::make_unique<sql::Database>(sql::DatabaseOptions{
|
||||
.exclusive_locking = true, .page_size = 4096, .cache_size = 500});
|
||||
connection_ = std::make_unique<sql::Database>(
|
||||
sql::DatabaseOptions{.page_size = 4096, .cache_size = 500});
|
||||
ASSERT_TRUE(connection_->Open(file));
|
||||
db_->Init(connection_.get());
|
||||
ASSERT_TRUE(db_->CreateTableIfNecessary());
|
||||
|
@ -155,9 +155,7 @@ bool SqliteDatabaseTransaction::Commit() {
|
||||
|
||||
PowerBookmarkDatabaseImpl::PowerBookmarkDatabaseImpl(
|
||||
const base::FilePath& database_dir)
|
||||
: db_(sql::DatabaseOptions{.exclusive_locking = true,
|
||||
.page_size = 4096,
|
||||
.cache_size = 128}),
|
||||
: db_(sql::DatabaseOptions{.page_size = 4096, .cache_size = 128}),
|
||||
database_path_(database_dir.Append(kDatabaseName)) {
|
||||
sync_db_ =
|
||||
std::make_unique<PowerBookmarkSyncMetadataDatabase>(&db_, &meta_table_);
|
||||
|
@ -206,11 +206,7 @@ SharedStorageDatabase::SharedStorageDatabase(
|
||||
base::FilePath db_path,
|
||||
scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy,
|
||||
std::unique_ptr<SharedStorageDatabaseOptions> options)
|
||||
: 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 DCHECK that the page size is valid in the constructor for
|
||||
: db_({// We DCHECK that the page size is valid in the constructor for
|
||||
// `SharedStorageOptions`.
|
||||
.page_size = options->max_page_size,
|
||||
.cache_size = options->max_cache_size}),
|
||||
|
@ -25,9 +25,7 @@ const int kCompatibleVersionNumber = 1;
|
||||
} // namespace
|
||||
|
||||
UserNoteDatabase::UserNoteDatabase(const base::FilePath& path_to_database_dir)
|
||||
: db_(sql::DatabaseOptions{.exclusive_locking = true,
|
||||
.page_size = 4096,
|
||||
.cache_size = 128}),
|
||||
: db_(sql::DatabaseOptions{.page_size = 4096, .cache_size = 128}),
|
||||
db_file_path_(path_to_database_dir.Append(kDatabaseName)) {}
|
||||
|
||||
UserNoteDatabase::~UserNoteDatabase() {
|
||||
|
@ -73,11 +73,7 @@ sql::InitStatus FailedMigrationTo(int version_num) {
|
||||
} // namespace
|
||||
|
||||
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
|
||||
: db_({// 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,
|
||||
|
@ -154,9 +154,7 @@ AggregationServiceStorageSql::AggregationServiceStorageSql(
|
||||
clock_(*clock),
|
||||
max_stored_requests_per_reporting_origin_(
|
||||
max_stored_requests_per_reporting_origin),
|
||||
db_(sql::DatabaseOptions{.exclusive_locking = true,
|
||||
.page_size = 4096,
|
||||
.cache_size = 32}) {
|
||||
db_(sql::DatabaseOptions{.page_size = 4096, .cache_size = 32}) {
|
||||
DETACH_FROM_SEQUENCE(sequence_checker_);
|
||||
DCHECK(clock);
|
||||
|
||||
|
@ -700,8 +700,8 @@ bool FirstPartySetsDatabase::LazyInit() {
|
||||
return db_status_ == InitStatus::kSuccess;
|
||||
|
||||
CHECK_EQ(db_.get(), nullptr);
|
||||
db_ = std::make_unique<sql::Database>(sql::DatabaseOptions{
|
||||
.exclusive_locking = true, .page_size = 4096, .cache_size = 32});
|
||||
db_ = std::make_unique<sql::Database>(
|
||||
sql::DatabaseOptions{.page_size = 4096, .cache_size = 32});
|
||||
db_->set_histogram_tag("FirstPartySets");
|
||||
// base::Unretained is safe here because this FirstPartySetsDatabase owns
|
||||
// the sql::Database instance that stores and uses the callback. So,
|
||||
|
@ -31,9 +31,7 @@ CdmStorageDatabase::CdmStorageDatabase(const base::FilePath& path)
|
||||
// bytes) and that we'll typically only be pulling one file at a time
|
||||
// (playback), specify a large page size to allow inner nodes can pack
|
||||
// many keys, to keep the index B-tree flat.
|
||||
db_(sql::DatabaseOptions{.exclusive_locking = true,
|
||||
.page_size = 32768,
|
||||
.cache_size = 8}) {
|
||||
db_(sql::DatabaseOptions{.page_size = 32768, .cache_size = 8}) {
|
||||
// base::Unretained is safe because `db_` is owned by `this`
|
||||
db_.set_error_callback(base::BindRepeating(
|
||||
&CdmStorageDatabase::OnDatabaseError, base::Unretained(this)));
|
||||
|
@ -29,9 +29,7 @@ MediaLicenseDatabase::MediaLicenseDatabase(const base::FilePath& path)
|
||||
// bytes) and that we'll typically only be pulling one file at a time
|
||||
// (playback), specify a large page size to allow inner nodes can pack
|
||||
// many keys, to keep the index B-tree flat.
|
||||
db_(sql::DatabaseOptions{.exclusive_locking = true,
|
||||
.page_size = 32768,
|
||||
.cache_size = 8}) {}
|
||||
db_(sql::DatabaseOptions{.page_size = 32768, .cache_size = 8}) {}
|
||||
|
||||
MediaLicenseStorageHostOpenError MediaLicenseDatabase::OpenFile(
|
||||
const media::CdmType& cdm_type,
|
||||
|
@ -99,9 +99,7 @@ PrivateAggregationBudgetStorage::PrivateAggregationBudgetStorage(
|
||||
kFlushDelay),
|
||||
db_task_runner_(std::move(db_task_runner)),
|
||||
db_(std::make_unique<sql::Database>(
|
||||
sql::DatabaseOptions{.exclusive_locking = true,
|
||||
.page_size = 4096,
|
||||
.cache_size = 32})) {}
|
||||
sql::DatabaseOptions{.page_size = 4096, .cache_size = 32})) {}
|
||||
|
||||
PrivateAggregationBudgetStorage::~PrivateAggregationBudgetStorage() {
|
||||
Shutdown();
|
||||
|
@ -914,7 +914,6 @@ QuotaError QuotaDatabase::EnsureOpened() {
|
||||
}
|
||||
|
||||
sql::DatabaseOptions options{
|
||||
.exclusive_locking = true,
|
||||
// The quota database is a critical storage component. If it's corrupted,
|
||||
// all client-side storage APIs fail, because they don't know where their
|
||||
// data is stored.
|
||||
|
Reference in New Issue
Block a user