| Index: chrome/browser/chromeos/extensions/external_cache.cc
|
| diff --git a/chrome/browser/chromeos/extensions/external_cache.cc b/chrome/browser/chromeos/extensions/external_cache.cc
|
| index dabb3b6b40004cfac6ebc22948e5a76259e4d442..52455ea5ba7af57ca6a90bdae0ca57fdad0618c4 100644
|
| --- a/chrome/browser/chromeos/extensions/external_cache.cc
|
| +++ b/chrome/browser/chromeos/extensions/external_cache.cc
|
| @@ -265,7 +265,8 @@ void ExternalCache::CheckCache() {
|
| std::string hash;
|
| if (local_cache_.GetExtension(it.key(), hash, &file_path, &version)) {
|
| // Copy entry to don't modify it inside extensions_.
|
| - base::DictionaryValue* entry_copy = entry->DeepCopy();
|
| + std::unique_ptr<base::DictionaryValue> entry_copy =
|
| + entry->CreateDeepCopy();
|
|
|
| if (extension_urls::IsWebstoreUpdateUrl(GURL(external_update_url))) {
|
| entry_copy->SetBoolean(
|
| @@ -277,7 +278,7 @@ void ExternalCache::CheckCache() {
|
| version);
|
| entry_copy->SetString(extensions::ExternalProviderImpl::kExternalCrx,
|
| file_path.value());
|
| - cached_extensions_->Set(it.key(), entry_copy);
|
| + cached_extensions_->Set(it.key(), std::move(entry_copy));
|
| } else {
|
| bool has_external_crx = entry->HasKey(
|
| extensions::ExternalProviderImpl::kExternalCrx);
|
| @@ -285,7 +286,7 @@ void ExternalCache::CheckCache() {
|
| !delegate_->GetInstalledExtensionVersion(it.key()).empty();
|
| if (keep_if_present || has_external_crx || is_already_installed) {
|
| // Copy entry to don't modify it inside extensions_.
|
| - cached_extensions_->Set(it.key(), entry->DeepCopy());
|
| + cached_extensions_->Set(it.key(), entry->CreateDeepCopy());
|
| }
|
| }
|
| }
|
| @@ -310,14 +311,15 @@ void ExternalCache::OnPutExtension(const std::string& id,
|
|
|
| VLOG(1) << "ExternalCache installed a new extension in the cache " << id;
|
|
|
| - base::DictionaryValue* entry = NULL;
|
| - if (!extensions_->GetDictionary(id, &entry)) {
|
| + base::DictionaryValue* original_entry = NULL;
|
| + if (!extensions_->GetDictionary(id, &original_entry)) {
|
| LOG(ERROR) << "ExternalCache cannot find entry for extension " << id;
|
| return;
|
| }
|
|
|
| - // Copy entry to don't modify it inside extensions_.
|
| - entry = entry->DeepCopy();
|
| + // Copy original_entry to avoid modifying it inside extensions_.
|
| + std::unique_ptr<base::DictionaryValue> entry =
|
| + original_entry->CreateDeepCopy();
|
|
|
| std::string version;
|
| std::string hash;
|
| @@ -343,7 +345,7 @@ void ExternalCache::OnPutExtension(const std::string& id,
|
| entry->SetString(extensions::ExternalProviderImpl::kExternalCrx,
|
| file_path.value());
|
|
|
| - cached_extensions_->Set(id, entry);
|
| + cached_extensions_->Set(id, std::move(entry));
|
| if (delegate_)
|
| delegate_->OnExtensionLoadedInCache(id);
|
| UpdateExtensionLoader();
|
|
|