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

Unified Diff: tools/json_schema_compiler/cpp_type_generator.py

Issue 1853573002: [Extensions] Remove 'use_movable_types' from code generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 24cbf612bc9a42d22717f87b50e35cb710f33403..82113ce94a56e5bc780e69f8b8bf761396fafe66 100644
--- a/tools/json_schema_compiler/cpp_type_generator.py
+++ b/tools/json_schema_compiler/cpp_type_generator.py
@@ -120,13 +120,12 @@ class CppTypeGenerator(object):
# never needs to be wrapped in pointer shenanigans.
# TODO(kalman): change this - but it's an exceedingly far-reaching change.
if not self.FollowRef(type_).property_type == PropertyType.ENUM:
- if is_in_container and (is_ptr or not self.IsCopyable(type_)):
- # Only wrap the object in a linked_ptr if this API isn't using movable
- # types. Since base::Values aren't yet movable, wrap them too.
- # TODO(devlin): Eventually, movable types should be the default.
- if (not 'use_movable_types' in type_.namespace.compiler_options or
- cpp_type == 'base::Value' or cpp_type == 'base::DictionaryValue'):
- cpp_type = 'linked_ptr<%s>' % cpp_util.PadForGenerics(cpp_type)
+ 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:
cpp_type = 'scoped_ptr<%s>' % cpp_util.PadForGenerics(cpp_type)

Powered by Google App Engine
This is Rietveld 408576698