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

Unified Diff: chrome/browser/extensions/extension_settings_storage_cache.cc

Issue 8361027: Re-commit 106660 with the crashing test disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 2 months 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/extension_settings_storage_cache.cc
diff --git a/chrome/browser/extensions/extension_settings_storage_cache.cc b/chrome/browser/extensions/extension_settings_storage_cache.cc
index f20f068f9b7dfbd1f4bcfa7d65ea74195ef1042a..2df99ed5241c4993126da958423d887f52730cb0 100644
--- a/chrome/browser/extensions/extension_settings_storage_cache.cc
+++ b/chrome/browser/extensions/extension_settings_storage_cache.cc
@@ -15,7 +15,7 @@ ExtensionSettingsStorage::Result ExtensionSettingsStorageCache::Get(
if (GetFromCache(key, &value)) {
DictionaryValue* settings = new DictionaryValue();
settings->SetWithoutPathExpansion(key, value);
- return Result(settings, NULL);
+ return Result(settings, NULL, NULL);
}
Result result = delegate_->Get(key);
@@ -43,7 +43,7 @@ ExtensionSettingsStorage::Result ExtensionSettingsStorageCache::Get(
}
if (missing_keys.empty()) {
- return Result(from_cache.release(), NULL);
+ return Result(from_cache.release(), NULL, NULL);
}
Result result = delegate_->Get(keys);
@@ -52,8 +52,10 @@ ExtensionSettingsStorage::Result ExtensionSettingsStorageCache::Get(
}
cache_.MergeDictionary(result.GetSettings());
- result.GetSettings()->MergeDictionary(from_cache.get());
- return result;
+
+ DictionaryValue* settings_with_cache = result.GetSettings()->DeepCopy();
+ settings_with_cache->MergeDictionary(from_cache.get());
+ return Result(settings_with_cache, NULL, NULL);
}
ExtensionSettingsStorage::Result ExtensionSettingsStorageCache::Get() {
@@ -80,9 +82,9 @@ ExtensionSettingsStorage::Result ExtensionSettingsStorageCache::Set(
return result;
}
- std::set<std::string>* changed_keys = result.GetChangedKeys();
+ const std::set<std::string>* changed_keys = result.GetChangedKeys();
DCHECK(changed_keys);
- for (std::set<std::string>::iterator it = changed_keys->begin();
+ for (std::set<std::string>::const_iterator it = changed_keys->begin();
it != changed_keys->end(); ++it) {
Value* new_value = NULL;
result.GetSettings()->GetWithoutPathExpansion(*it, &new_value);
@@ -108,9 +110,9 @@ ExtensionSettingsStorage::Result ExtensionSettingsStorageCache::Remove(
return result;
}
- std::set<std::string>* changed_keys = result.GetChangedKeys();
+ const std::set<std::string>* changed_keys = result.GetChangedKeys();
DCHECK(changed_keys);
- for (std::set<std::string>::iterator it = changed_keys->begin();
+ for (std::set<std::string>::const_iterator it = changed_keys->begin();
it != changed_keys->end(); ++it) {
cache_.RemoveWithoutPathExpansion(*it, NULL);
}

Powered by Google App Engine
This is Rietveld 408576698