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

Unified Diff: extensions/common/extension_api.cc

Issue 2275063002: [Extensions] Don't generate a list for each generated schema (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: woot 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 | « no previous file | tools/json_schema_compiler/cpp_bundle_generator.py » ('j') | 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 a86db6d795500075b95a8d745472dab3460736c0..9b3035ef3d53ea2ec3c25724750169221cf3abee 100644
--- a/extensions/common/extension_api.cc
+++ b/extensions/common/extension_api.cc
@@ -38,7 +38,7 @@ const char* kChildKinds[] = {
"events"
};
-std::unique_ptr<base::ListValue> LoadSchemaList(
+std::unique_ptr<base::DictionaryValue> LoadSchemaDictionary(
const std::string& name,
const base::StringPiece& schema) {
std::string error_message;
@@ -56,8 +56,9 @@ std::unique_ptr<base::ListValue> LoadSchemaList(
error_message.c_str());
CHECK(result.get()) << error_message << " for schema " << schema;
- CHECK(result->IsType(base::Value::TYPE_LIST)) << " for schema " << schema;
- return base::ListValue::From(std::move(result));
+ CHECK(result->IsType(base::Value::TYPE_DICTIONARY)) << " for schema "
+ << schema;
+ return base::DictionaryValue::From(std::move(result));
}
const base::DictionaryValue* FindListItem(const base::ListValue* list,
@@ -146,22 +147,11 @@ ExtensionAPI::OverrideSharedInstanceForTest::~OverrideSharedInstanceForTest() {
void ExtensionAPI::LoadSchema(const std::string& name,
const base::StringPiece& schema) {
- std::unique_ptr<base::ListValue> schema_list(LoadSchemaList(name, schema));
+ std::unique_ptr<base::DictionaryValue> schema_dict(
+ LoadSchemaDictionary(name, schema));
std::string schema_namespace;
- extensions::ExtensionsClient* extensions_client =
- extensions::ExtensionsClient::Get();
- DCHECK(extensions_client);
- while (!schema_list->empty()) {
- std::unique_ptr<base::DictionaryValue> 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));
- schemas_[schema_namespace] = std::move(schema);
- }
+ CHECK(schema_dict->GetString("namespace", &schema_namespace));
+ schemas_[schema_namespace] = std::move(schema_dict);
}
ExtensionAPI::ExtensionAPI() : default_configuration_initialized_(false) {
« no previous file with comments | « no previous file | tools/json_schema_compiler/cpp_bundle_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698