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

Unified Diff: third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator.py

Issue 1101303002: Update mojo sdk to rev e7270700d671fa8e458b4d8c9e47f7bcfb65da0b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actualy provide a default TaskTracker impl Created 5 years, 8 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: third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator.py b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
index 9c2763ddd10d3d12884261b08590cb78b01f817f..666ef439fa52eb8a1365121008270d16092f2a88 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
@@ -56,6 +56,9 @@ class Generator(object):
def GetStructs(self):
return map(partial(self._AddStructComputedData, True), self.module.structs)
+ def GetUnions(self):
+ return map(self._AddUnionComputedData, self.module.unions)
+
def GetInterfaces(self):
return map(self._AddInterfaceComputedData, self.module.interfaces)
@@ -91,6 +94,17 @@ class Generator(object):
struct.exported = exported
return struct
+ def _AddUnionComputedData(self, union):
+ """Adds computed data to the given union. The data is computed once and
+ used repeatedly in the generation process."""
+ ordinal = 0
+ for field in union.fields:
+ if field.ordinal is not None:
+ ordinal = field.ordinal
+ field.ordinal = ordinal
+ ordinal += 1
+ return union
+
def _AddInterfaceComputedData(self, interface):
"""Adds computed data to the given interface. The data is computed once and
used repeatedly in the generation process."""

Powered by Google App Engine
This is Rietveld 408576698