summaryrefslogtreecommitdiffstats
path: root/chrome/service
diff options
context:
space:
mode:
authorraymes <raymes@chromium.org>2015-05-05 20:22:21 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-06 03:22:49 +0000
commit76de1af44ac758e104f2fea2f045f0274aa42221 (patch)
tree8eb169d5cbb849e7fb14de814896dc5720f9b737 /chrome/service
parent3a9179a64eac8c0d606409b2ebdabd60b612151a (diff)
downloadchromium_src-76de1af44ac758e104f2fea2f045f0274aa42221.zip
chromium_src-76de1af44ac758e104f2fea2f045f0274aa42221.tar.gz
chromium_src-76de1af44ac758e104f2fea2f045f0274aa42221.tar.bz2
Add a PrefRegistrationFlags::LOSSY_PREF flag for writing lossy prefs
This adds a registration flag for marking a pref as "lossy". There is no strict time guarantee on when a lossy pref will be persisted to permanent storage when it is modified. WriteablePrefStore::PrefWriteFlags are introduced to be used to change the way that prefs get written into a WriteablePrefStore. The plumbing to pass registration flags down from PrefService into the WriteablePrefStore and convert them into PrefWriteFlags is also added here. The code which actually makes the pref behave in a lossy way has not been added yet. BUG=476800 Review URL: https://codereview.chromium.org/1092223004 Cr-Commit-Position: refs/heads/master@{#328481}
Diffstat (limited to 'chrome/service')
-rw-r--r--chrome/service/service_process_prefs.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/chrome/service/service_process_prefs.cc b/chrome/service/service_process_prefs.cc
index d923185..7f43943 100644
--- a/chrome/service/service_process_prefs.cc
+++ b/chrome/service/service_process_prefs.cc
@@ -39,7 +39,8 @@ std::string ServiceProcessPrefs::GetString(
void ServiceProcessPrefs::SetString(const std::string& key,
const std::string& value) {
- prefs_->SetValue(key, new base::StringValue(value));
+ prefs_->SetValue(key, new base::StringValue(value),
+ WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}
bool ServiceProcessPrefs::GetBoolean(const std::string& key,
@@ -53,7 +54,8 @@ bool ServiceProcessPrefs::GetBoolean(const std::string& key,
}
void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) {
- prefs_->SetValue(key, new base::FundamentalValue(value));
+ prefs_->SetValue(key, new base::FundamentalValue(value),
+ WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}
int ServiceProcessPrefs::GetInt(const std::string& key,
@@ -67,7 +69,8 @@ int ServiceProcessPrefs::GetInt(const std::string& key,
}
void ServiceProcessPrefs::SetInt(const std::string& key, int value) {
- prefs_->SetValue(key, new base::FundamentalValue(value));
+ prefs_->SetValue(key, new base::FundamentalValue(value),
+ WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}
const base::DictionaryValue* ServiceProcessPrefs::GetDictionary(
@@ -91,10 +94,10 @@ const base::ListValue* ServiceProcessPrefs::GetList(
}
void ServiceProcessPrefs::SetValue(const std::string& key, base::Value* value) {
- prefs_->SetValue(key, value);
+ prefs_->SetValue(key, value, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}
void ServiceProcessPrefs::RemovePref(const std::string& key) {
- prefs_->RemoveValue(key);
+ prefs_->RemoveValue(key, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}