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

Unified Diff: mojo/public/bindings/pylib/generate/mojom_generator.py

Issue 198343002: Mojo: request/response bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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: 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)
« no previous file with comments | « mojo/public/bindings/pylib/generate/mojom_data.py ('k') | mojo/public/bindings/tests/request_response_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698