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

Unified Diff: mojo/public/tools/bindings/generators/mojom_js_generator.py

Issue 377713004: Support packed arrays of booleans in Mojo messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplified Decoder.prototype.decodeBoolArray() Created 6 years, 5 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
« no previous file with comments | « mojo/public/js/bindings/codec.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/mojom_js_generator.py
diff --git a/mojo/public/tools/bindings/generators/mojom_js_generator.py b/mojo/public/tools/bindings/generators/mojom_js_generator.py
index 68f790861225be5f63b70c59e2289af215b83e53..59208328e54b4d44c410d3f29c881cb9cec020c0 100644
--- a/mojo/public/tools/bindings/generators/mojom_js_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_js_generator.py
@@ -85,6 +85,8 @@ def CodecType(kind):
return _kind_to_codec_type[kind]
if isinstance(kind, mojom.Struct):
return "new codec.PointerTo(%s)" % CodecType(kind.name)
+ if isinstance(kind, mojom.Array) and kind.kind == mojom.BOOL:
+ return "new codec.ArrayOfBoolArrayPointers()"
if isinstance(kind, mojom.Array):
return "new codec.ArrayOf(%s)" % CodecType(kind.kind)
if isinstance(kind, mojom.Interface) or \
@@ -100,6 +102,8 @@ def JavaScriptDecodeSnippet(kind):
return "decodeStruct(%s)" % CodecType(kind)
if isinstance(kind, mojom.Struct):
return "decodeStructPointer(%s)" % CodecType(kind.name)
+ if isinstance(kind, mojom.Array) and kind.kind == mojom.BOOL:
+ return "decodeBoolArrayPointer()"
if isinstance(kind, mojom.Array):
return "decodeArrayPointer(%s)" % CodecType(kind.kind)
if isinstance(kind, mojom.Interface) or \
@@ -114,6 +118,8 @@ def JavaScriptEncodeSnippet(kind):
return "encodeStruct(%s, " % CodecType(kind)
if isinstance(kind, mojom.Struct):
return "encodeStructPointer(%s, " % CodecType(kind.name)
+ if isinstance(kind, mojom.Array) and kind.kind == mojom.BOOL:
+ return "encodeBoolArrayPointer(";
if isinstance(kind, mojom.Array):
return "encodeArrayPointer(%s, " % CodecType(kind.kind)
if isinstance(kind, mojom.Interface) or \
« no previous file with comments | « mojo/public/js/bindings/codec.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698