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

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

Issue 1019173002: Update mojo sdk to rev 7214b7ec7d27563b2666afad86cf1c5895c56c18 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep permission service alive if embedder drops requests Created 5 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: third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/pack.py
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/pack.py b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/pack.py
index c67488c9a453666fad9cdf414bf928d408100e18..4e522c97450ac06bf1f9bf1fabe13ac1f03896d3 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/pack.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/pack.py
@@ -123,45 +123,14 @@ class PackedStruct(object):
src_fields.sort(key=lambda field: field.ordinal)
# Set |min_version| for each field.
- #
- # TODO(yzshen): We are in the middle of converting the |num_fields| field in
- # encoded structs to |version|. In order to make code using |num_fields| and
- # |version| work together, for structs without any [MinVersion] annotation,
- # each field will be treated as if [MinVersion=ordinal+1] is set:
- #
- # struct Foo {
- # int32 field_0;
- # int32 field_1;
- # }
- #
- # is treated as:
- #
- # struct Foo {
- # [MinVersion=1] int32 field_0;
- # [MinVersion=2] int32 field_1;
- # }
- #
- # This way |num_fields| is the same value as |version|.
- #
- # This trick needs to be removed once the conversion is done.
-
- if any(packed_field.field.min_version is not None
- for packed_field in src_fields):
- # This struct has fields that explicitly set [MinVersion]. Assume that it
- # is only handled by code that understands versioning.
- next_min_version = 0
- for packed_field in src_fields:
- if packed_field.field.min_version is None:
- assert next_min_version == 0
- else:
- assert packed_field.field.min_version >= next_min_version
- next_min_version = packed_field.field.min_version
- packed_field.min_version = next_min_version
- else:
- next_min_version = 1
- for packed_field in src_fields:
- packed_field.min_version = next_min_version
- next_min_version += 1
+ next_min_version = 0
+ for packed_field in src_fields:
+ if packed_field.field.min_version is None:
+ assert next_min_version == 0
+ else:
+ assert packed_field.field.min_version >= next_min_version
+ next_min_version = packed_field.field.min_version
+ packed_field.min_version = next_min_version
src_field = src_fields[0]
src_field.offset = 0

Powered by Google App Engine
This is Rietveld 408576698