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

Unified Diff: extensions/common/extension_api.cc

Issue 2255953002: [Extensions] Make ExtensionAPI use unique_ptrs instead of linked_ptrs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « extensions/common/extension_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/extension_api.cc
diff --git a/extensions/common/extension_api.cc b/extensions/common/extension_api.cc
index 8430a2fb117dead341b92dc8d8790f75196aeffc..4b49a83f8e5f70492f0aee34901739c1b85f1ce7 100644
--- a/extensions/common/extension_api.cc
+++ b/extensions/common/extension_api.cc
@@ -219,16 +219,16 @@ void ExtensionAPI::LoadSchema(const std::string& name,
extensions::ExtensionsClient::Get();
DCHECK(extensions_client);
while (!schema_list->empty()) {
- base::DictionaryValue* schema = NULL;
+ std::unique_ptr<base::DictionaryValue> schema;
{
- std::unique_ptr<base::Value> value;
- schema_list->Remove(schema_list->GetSize() - 1, &value);
- CHECK(value.release()->GetAsDictionary(&schema));
+ std::unique_ptr<base::Value> val;
+ schema_list->Erase(schema_list->begin(), &val);
+ schema = base::DictionaryValue::From(std::move(val));
+ CHECK(schema);
}
-
CHECK(schema->GetString("namespace", &schema_namespace));
- PrefixWithNamespace(schema_namespace, schema);
- schemas_[schema_namespace] = make_linked_ptr(schema);
+ PrefixWithNamespace(schema_namespace, schema.get());
+ schemas_[schema_namespace] = std::move(schema);
if (!extensions_client->IsAPISchemaGenerated(schema_namespace))
CHECK_EQ(1u, unloaded_schemas_.erase(schema_namespace));
}
« no previous file with comments | « extensions/common/extension_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698