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

Unified Diff: chrome/browser/extensions/settings/settings_leveldb_storage.cc

Issue 8587025: Extension settings API: force through changes that come from sync (ignoring (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/settings/settings_leveldb_storage.cc
diff --git a/chrome/browser/extensions/settings/settings_leveldb_storage.cc b/chrome/browser/extensions/settings/settings_leveldb_storage.cc
index 77971cabca5e25cdcd65b5d1cf715d25be46675d..581f581c0a67b2b919917615bc0d15d8911b64cc 100644
--- a/chrome/browser/extensions/settings/settings_leveldb_storage.cc
+++ b/chrome/browser/extensions/settings/settings_leveldb_storage.cc
@@ -164,21 +164,20 @@ SettingsStorage::ReadResult SettingsLeveldbStorage::Get() {
}
SettingsStorage::WriteResult SettingsLeveldbStorage::Set(
- const std::string& key, const Value& value) {
+ WriteOptions options, const std::string& key, const Value& value) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
DictionaryValue settings;
settings.SetWithoutPathExpansion(key, value.DeepCopy());
- return Set(settings);
+ return Set(options, settings);
}
SettingsStorage::WriteResult SettingsLeveldbStorage::Set(
- const DictionaryValue& settings) {
+ WriteOptions options, const DictionaryValue& settings) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
std::string value_as_json;
leveldb::WriteBatch batch;
- scoped_ptr<SettingChangeList> changes(
- new SettingChangeList());
+ scoped_ptr<SettingChangeList> changes(new SettingChangeList());
for (DictionaryValue::Iterator it(settings); it.HasNext(); it.Advance()) {
scoped_ptr<Value> old_value;
@@ -205,15 +204,15 @@ SettingsStorage::WriteResult SettingsLeveldbStorage::Set(
}
SettingsStorage::WriteResult SettingsLeveldbStorage::Remove(
- const std::string& key) {
+ WriteOptions options, const std::string& key) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
std::vector<std::string> keys;
keys.push_back(key);
- return Remove(keys);
+ return Remove(options, keys);
}
SettingsStorage::WriteResult SettingsLeveldbStorage::Remove(
- const std::vector<std::string>& keys) {
+ WriteOptions options, const std::vector<std::string>& keys) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
leveldb::WriteBatch batch;
@@ -243,10 +242,11 @@ SettingsStorage::WriteResult SettingsLeveldbStorage::Remove(
return WriteResult(changes.release());
}
-SettingsStorage::WriteResult SettingsLeveldbStorage::Clear() {
+SettingsStorage::WriteResult SettingsLeveldbStorage::Clear(
+ WriteOptions options) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- leveldb::ReadOptions options;
+ leveldb::ReadOptions read_options;
// All interaction with the db is done on the same thread, so snapshotting
// isn't strictly necessary. This is just defensive.
leveldb::WriteBatch batch;
@@ -254,8 +254,8 @@ SettingsStorage::WriteResult SettingsLeveldbStorage::Clear() {
new SettingChangeList());
ScopedSnapshot snapshot(db_.get());
- options.snapshot = snapshot.get();
- scoped_ptr<leveldb::Iterator> it(db_->NewIterator(options));
+ read_options.snapshot = snapshot.get();
+ scoped_ptr<leveldb::Iterator> it(db_->NewIterator(read_options));
for (it->SeekToFirst(); it->Valid(); it->Next()) {
const std::string key = it->key().ToString();
const std::string old_value_json = it->value().ToString();

Powered by Google App Engine
This is Rietveld 408576698