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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom/generate/pack.py

Issue 1410053006: Move third_party/mojo/src/mojo/public to mojo/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import module as mojom 5 import module as mojom
6 6
7 # This module provides a mechanism for determining the packed order and offsets 7 # This module provides a mechanism for determining the packed order and offsets
8 # of a mojom.Struct. 8 # of a mojom.Struct.
9 # 9 #
10 # ps = pack.PackedStruct(struct) 10 # ps = pack.PackedStruct(struct)
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 # The fields are iterated in ordinal order here. However, the size of a 241 # The fields are iterated in ordinal order here. However, the size of a
242 # version is determined by the last field of that version in pack order, 242 # version is determined by the last field of that version in pack order,
243 # instead of ordinal order. Therefore, we need to calculate the max value. 243 # instead of ordinal order. Therefore, we need to calculate the max value.
244 last_payload_size = max(GetPayloadSizeUpToField(packed_field), 244 last_payload_size = max(GetPayloadSizeUpToField(packed_field),
245 last_payload_size) 245 last_payload_size)
246 246
247 assert len(versions) == 0 or last_num_fields != versions[-1].num_fields 247 assert len(versions) == 0 or last_num_fields != versions[-1].num_fields
248 versions.append(VersionInfo(last_version, last_num_fields, 248 versions.append(VersionInfo(last_version, last_num_fields,
249 last_payload_size + HEADER_SIZE)) 249 last_payload_size + HEADER_SIZE))
250 return versions 250 return versions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698