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

Unified Diff: tools/json_schema_compiler/cpp_type_generator.py

Issue 1854993002: [Extensions] Remove linked_ptr entirely from extensions generated code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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: tools/json_schema_compiler/cpp_type_generator.py
diff --git a/tools/json_schema_compiler/cpp_type_generator.py b/tools/json_schema_compiler/cpp_type_generator.py
index 82113ce94a56e5bc780e69f8b8bf761396fafe66..23460c63699c6a6a8845a2978794d5103585c475 100644
--- a/tools/json_schema_compiler/cpp_type_generator.py
+++ b/tools/json_schema_compiler/cpp_type_generator.py
@@ -122,11 +122,9 @@ class CppTypeGenerator(object):
if not self.FollowRef(type_).property_type == PropertyType.ENUM:
is_base_value = (cpp_type == 'base::Value' or
cpp_type == 'base::DictionaryValue')
- # Only wrap the object in a linked_ptr if it's a base::Value.
- # TODO(devlin): Change this to scoped_ptr.
- if is_in_container and is_base_value:
- cpp_type = 'linked_ptr<%s>' % cpp_util.PadForGenerics(cpp_type)
- elif is_ptr:
+ # Wrap ptrs and base::Values in containers (which aren't movable) in
+ # scoped_ptrs.
+ if is_ptr or (is_in_container and is_base_value):
cpp_type = 'scoped_ptr<%s>' % cpp_util.PadForGenerics(cpp_type)
return cpp_type
@@ -234,12 +232,9 @@ class CppTypeGenerator(object):
if type_.property_type == PropertyType.REF:
deps.add(_TypeDependency(self._FindType(type_.ref_type), hard=hard))
elif type_.property_type == PropertyType.ARRAY:
- # Non-copyable types are not hard because they are wrapped in linked_ptrs
- # when generated. Otherwise they're typedefs, so they're hard (though we
- # could generate those typedefs in every dependent namespace, but that
- # seems weird).
- deps = self._TypeDependencies(type_.item_type,
- hard=self.IsCopyable(type_.item_type))
+ # Types in containers are hard dependencies because they are stored
+ # directly and use move semantics.
+ deps = self._TypeDependencies(type_.item_type, hard=hard)
elif type_.property_type == PropertyType.CHOICES:
for type_ in type_.choices:
deps |= self._TypeDependencies(type_, hard=self.IsCopyable(type_))
« no previous file with comments | « extensions/common/api/declarative/declarative_manifest_data.cc ('k') | tools/json_schema_compiler/h_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698