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

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

Issue 460063002: Refactor JavaScript support for packed boolean arrays (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
« mojo/public/js/bindings/codec.js ('K') | « 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 15881cd090315fedf62c376b2e0fb67fc50297b1..5b3e7c8160c1db9190021b38b0846c9d5cc15b4d 100644
--- a/mojo/public/tools/bindings/generators/mojom_js_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_js_generator.py
@@ -86,7 +86,7 @@ def CodecType(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()"
+ return "new codec.ArrayOf(new codec.ArrayOf(codec.PackedBool))"
if isinstance(kind, mojom.Array):
return "new codec.ArrayOf(%s)" % CodecType(kind.kind)
if isinstance(kind, mojom.Interface) or \
@@ -103,7 +103,7 @@ def JavaScriptDecodeSnippet(kind):
if isinstance(kind, mojom.Struct):
return "decodeStructPointer(%s)" % CodecType(kind.name)
if isinstance(kind, mojom.Array) and kind.kind == mojom.BOOL:
- return "decodeBoolArrayPointer()"
+ return "decodeArrayPointer(new codec.ArrayOf(codec.PackedBool))"
if isinstance(kind, mojom.Array):
return "decodeArrayPointer(%s)" % CodecType(kind.kind)
if isinstance(kind, mojom.Interface) or \
@@ -118,8 +118,9 @@ 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, mojom.FixedArray)) and \
+ kind.kind == mojom.BOOL:
+ return "encodeArrayPointer(new codec.ArrayOf(codec.PackedBool), ";
if isinstance(kind, (mojom.Array, mojom.FixedArray)):
return "encodeArrayPointer(%s, " % CodecType(kind.kind)
if isinstance(kind, mojom.Interface) or \
« mojo/public/js/bindings/codec.js ('K') | « mojo/public/js/bindings/codec.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698