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

Side by Side Diff: mojo/public/python/mojo/bindings/descriptor.py

Issue 728133002: Update mojo sdk to rev e01f9a49449381a5eb430c1fd88bf2cae73ec35a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android + ios gyp fixes Created 6 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
« no previous file with comments | « mojo/public/mojo_public.gyp ('k') | mojo/public/python/mojo/bindings/messaging.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """ 5 """
6 The descriptors used to define generated elements of the mojo python bindings. 6 The descriptors used to define generated elements of the mojo python bindings.
7 """ 7 """
8 8
9 import array 9 import array
10 import itertools 10 import itertools
(...skipping 23 matching lines...) Expand all
34 """ 34 """
35 return self.Convert(value) 35 return self.Convert(value)
36 36
37 37
38 class SerializableType(Type): 38 class SerializableType(Type):
39 """Describe a type that can be serialized by itself.""" 39 """Describe a type that can be serialized by itself."""
40 40
41 def __init__(self, typecode): 41 def __init__(self, typecode):
42 Type.__init__(self) 42 Type.__init__(self)
43 self.typecode = typecode 43 self.typecode = typecode
44 self.byte_size = struct.calcsize('=%s' % self.GetTypeCode()) 44 self.byte_size = struct.calcsize('<%s' % self.GetTypeCode())
45 45
46 def GetTypeCode(self): 46 def GetTypeCode(self):
47 """ 47 """
48 Returns the type code (as defined by the struct module) used to encode 48 Returns the type code (as defined by the struct module) used to encode
49 this type. 49 this type.
50 """ 50 """
51 return self.typecode 51 return self.typecode
52 52
53 def GetByteSize(self): 53 def GetByteSize(self):
54 """ 54 """
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 663
664 664
665 def _ConvertByteToBooleans(value, min_size=0): 665 def _ConvertByteToBooleans(value, min_size=0):
666 "Unpack an integer into a list of booleans.""" 666 "Unpack an integer into a list of booleans."""
667 res = [] 667 res = []
668 while value: 668 while value:
669 res.append(bool(value&1)) 669 res.append(bool(value&1))
670 value = value / 2 670 value = value / 2
671 res.extend([False] * (min_size - len(res))) 671 res.extend([False] * (min_size - len(res)))
672 return res 672 return res
OLDNEW
« no previous file with comments | « mojo/public/mojo_public.gyp ('k') | mojo/public/python/mojo/bindings/messaging.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698