Index: mojo/public/bindings/pylib/generate/mojom_generator.py |
diff --git a/mojo/public/bindings/pylib/generate/mojom_generator.py b/mojo/public/bindings/pylib/generate/mojom_generator.py |
index d9d12daeb3781f1c0402638920d261aecf8a7bdb..ebe2ea90396861e18e3b9d62aaddebf08eae8cbb 100644 |
--- a/mojo/public/bindings/pylib/generate/mojom_generator.py |
+++ b/mojo/public/bindings/pylib/generate/mojom_generator.py |
@@ -19,6 +19,15 @@ def GetStructFromMethod(interface, method): |
struct.packed = mojom_pack.PackedStruct(struct) |
return struct |
+def GetResponseStructFromMethod(interface, method): |
+ """Converts a method's response_parameters into the fields of a struct.""" |
+ params_class = "%s_%s_ResponseParams" % (interface.name, method.name) |
+ struct = mojom.Struct(params_class) |
+ for param in method.response_parameters: |
+ struct.AddField(param.name, param.kind, param.ordinal) |
+ struct.packed = mojom_pack.PackedStruct(struct) |
+ return struct |
+ |
def GetStructInfo(exported, struct): |
struct.packed = mojom_pack.PackedStruct(struct) |
struct.bytes = mojom_pack.GetByteLayout(struct.packed) |