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); |
} |