summaryrefslogtreecommitdiffstats
path: root/mojo/public/tools
diff options
context:
space:
mode:
authordarin <darin@chromium.org>2016-03-08 00:40:08 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-08 08:41:13 +0000
commit6de36cc8c2260493d0775c57ef4d591d309d33f1 (patch)
tree8f698fbccf36eb4279ad560f9507f68466233695 /mojo/public/tools
parent3678f555e75e38af67f19717d927ffee064cca47 (diff)
downloadchromium_src-6de36cc8c2260493d0775c57ef4d591d309d33f1.zip
chromium_src-6de36cc8c2260493d0775c57ef4d591d309d33f1.tar.gz
chromium_src-6de36cc8c2260493d0775c57ef4d591d309d33f1.tar.bz2
Treat typemapped kinds as un-cloneable
BUG=592883 Review URL: https://codereview.chromium.org/1768373003 Cr-Commit-Position: refs/heads/master@{#379789}
Diffstat (limited to 'mojo/public/tools')
-rw-r--r--mojo/public/tools/bindings/generators/mojom_cpp_generator.py5
-rw-r--r--mojo/public/tools/bindings/pylib/mojom/generate/module.py4
2 files changed, 6 insertions, 3 deletions
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
index 22e089c..c2d3a1c 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -105,6 +105,9 @@ def IsTypemappedKind(kind):
return hasattr(kind, "name") and \
GetFullMojomNameForKind(kind) in _current_typemap
+def IsCloneableKind(kind):
+ return mojom.IsCloneableKind(kind, IsTypemappedKind)
+
def IsNativeOnlyKind(kind):
return mojom.IsStructKind(kind) and kind.native_only
@@ -477,7 +480,7 @@ class Generator(generator.Generator):
"should_inline": ShouldInlineStruct,
"should_inline_union": ShouldInlineUnion,
"is_array_kind": mojom.IsArrayKind,
- "is_cloneable_kind": mojom.IsCloneableKind,
+ "is_cloneable_kind": IsCloneableKind,
"is_enum_kind": mojom.IsEnumKind,
"is_integral_kind": mojom.IsIntegralKind,
"is_move_only_kind": mojom.IsMoveOnlyKind,
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/module.py b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
index 6a86f16..a673d8e 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/module.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
@@ -607,7 +607,7 @@ def IsMoveOnlyKind(kind):
IsAnyHandleKind(kind) or IsInterfaceKind(kind) or IsAssociatedKind(kind)
-def IsCloneableKind(kind):
+def IsCloneableKind(kind, filter):
def _IsCloneable(kind, visited_kinds):
if kind in visited_kinds:
# No need to examine the kind again.
@@ -618,7 +618,7 @@ def IsCloneableKind(kind):
if IsArrayKind(kind):
return _IsCloneable(kind.kind, visited_kinds)
if IsStructKind(kind) or IsUnionKind(kind):
- if IsStructKind(kind) and kind.native_only:
+ if IsStructKind(kind) and (kind.native_only or filter(kind)):
return False
for field in kind.fields:
if not _IsCloneable(field.kind, visited_kinds):