OLD | NEW |
---|---|
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 # pylint: disable=F0401 | 5 # pylint: disable=F0401 |
6 | 6 |
7 import interface_dsl | 7 import interface_dsl |
8 | 8 |
9 def MakeInterface(): | 9 def MakeInterface(): |
10 mojo = interface_dsl.Interface() | 10 mojo = interface_dsl.Interface() |
11 | 11 |
12 f = mojo.Func('MojoCreateSharedBuffer', 'MojoResult') | 12 # This function is not provided by the Mojo system APIs, but instead allows |
viettrungluu
2016/03/09 00:51:04
I reordered these into a more sensible order, whic
| |
13 # trusted code to provide a handle for use by untrusted code. See the | |
14 # implementation in mojo_syscall.cc.tmpl. | |
15 f = mojo.Func('_MojoGetInitialHandle', 'MojoResult') | |
16 f.Param('handle').Out('MojoHandle') | |
17 | |
18 f = mojo.Func('MojoGetTimeTicksNow', 'MojoTimeTicks') | |
19 | |
20 f = mojo.Func('MojoClose', 'MojoResult') | |
21 f.Param('handle').In('MojoHandle') | |
22 | |
23 f = mojo.Func('MojoWait', 'MojoResult') | |
24 f.Param('handle').In('MojoHandle') | |
25 f.Param('signals').In('MojoHandleSignals') | |
26 f.Param('deadline').In('MojoDeadline') | |
27 f.Param('signals_state').OutFixedStruct('MojoHandleSignalsState').Optional() | |
28 | |
29 f = mojo.Func('MojoWaitMany', 'MojoResult') | |
30 f.Param('handles').InArray('MojoHandle', 'num_handles') | |
31 f.Param('signals').InArray('MojoHandleSignals', 'num_handles') | |
32 f.Param('num_handles').In('uint32_t') | |
33 f.Param('deadline').In('MojoDeadline') | |
34 f.Param('result_index').Out('uint32_t').Optional() | |
35 p = f.Param('signals_states') | |
36 p.OutFixedStructArray('MojoHandleSignalsState', 'num_handles').Optional() | |
37 | |
38 f = mojo.Func('MojoCreateMessagePipe', 'MojoResult') | |
13 p = f.Param('options') | 39 p = f.Param('options') |
14 p.InExtensibleStruct('MojoCreateSharedBufferOptions').Optional() | 40 p.InExtensibleStruct('MojoCreateMessagePipeOptions').Optional() |
15 f.Param('num_bytes').In('uint64_t') | 41 f.Param('message_pipe_handle0').Out('MojoHandle') |
16 f.Param('shared_buffer_handle').Out('MojoHandle') | 42 f.Param('message_pipe_handle1').Out('MojoHandle') |
17 | 43 |
18 f = mojo.Func('MojoDuplicateBufferHandle', 'MojoResult') | 44 f = mojo.Func('MojoWriteMessage', 'MojoResult') |
19 f.Param('buffer_handle').In('MojoHandle') | 45 f.Param('message_pipe_handle').In('MojoHandle') |
20 p = f.Param('options') | 46 f.Param('bytes').InArray('void', 'num_bytes').Optional() |
21 p.InExtensibleStruct('MojoDuplicateBufferHandleOptions').Optional() | 47 f.Param('num_bytes').In('uint32_t') |
22 f.Param('new_buffer_handle').Out('MojoHandle') | 48 f.Param('handles').InArray('MojoHandle', 'num_handles').Optional() |
49 f.Param('num_handles').In('uint32_t') | |
50 f.Param('flags').In('MojoWriteMessageFlags') | |
23 | 51 |
24 f = mojo.Func('MojoMapBuffer', 'MojoResult') | 52 f = mojo.Func('MojoReadMessage', 'MojoResult') |
25 f.Param('buffer_handle').In('MojoHandle') | 53 f.Param('message_pipe_handle').In('MojoHandle') |
26 f.Param('offset').In('uint64_t') | 54 f.Param('bytes').OutArray('void', 'num_bytes').Optional() |
27 f.Param('num_bytes').In('uint64_t') | 55 f.Param('num_bytes').InOut('uint32_t').Optional() |
28 f.Param('buffer').Out('void*') | 56 f.Param('handles').OutArray('MojoHandle', 'num_handles').Optional() |
29 f.Param('flags').In('MojoMapBufferFlags') | 57 f.Param('num_handles').InOut('uint32_t').Optional() |
30 # TODO(ncbray): support mmaping. | 58 f.Param('flags').In('MojoReadMessageFlags') |
31 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
32 f.IsBrokenInNaCl() | |
33 | |
34 f = mojo.Func('MojoUnmapBuffer', 'MojoResult') | |
35 f.Param('buffer').In('void*') | |
36 # TODO(ncbray): support mmaping. | |
37 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
38 f.IsBrokenInNaCl() | |
39 | 59 |
40 f = mojo.Func('MojoCreateDataPipe', 'MojoResult') | 60 f = mojo.Func('MojoCreateDataPipe', 'MojoResult') |
41 p = f.Param('options') | 61 p = f.Param('options') |
42 p.InExtensibleStruct('MojoCreateDataPipeOptions').Optional() | 62 p.InExtensibleStruct('MojoCreateDataPipeOptions').Optional() |
43 f.Param('data_pipe_producer_handle').Out('MojoHandle') | 63 f.Param('data_pipe_producer_handle').Out('MojoHandle') |
44 f.Param('data_pipe_consumer_handle').Out('MojoHandle') | 64 f.Param('data_pipe_consumer_handle').Out('MojoHandle') |
45 | 65 |
46 f = mojo.Func('MojoWriteData', 'MojoResult') | 66 f = mojo.Func('MojoWriteData', 'MojoResult') |
47 f.Param('data_pipe_producer_handle').In('MojoHandle') | 67 f.Param('data_pipe_producer_handle').In('MojoHandle') |
48 f.Param('elements').InArray('void', 'num_bytes') | 68 f.Param('elements').InArray('void', 'num_bytes') |
(...skipping 25 matching lines...) Expand all Loading... | |
74 f.Param('buffer_num_bytes').InOut('uint32_t') | 94 f.Param('buffer_num_bytes').InOut('uint32_t') |
75 f.Param('flags').In('MojoReadDataFlags') | 95 f.Param('flags').In('MojoReadDataFlags') |
76 # TODO(ncbray): support two-stage reads and writes. | 96 # TODO(ncbray): support two-stage reads and writes. |
77 # https://code.google.com/p/chromium/issues/detail?id=401761 | 97 # https://code.google.com/p/chromium/issues/detail?id=401761 |
78 f.IsBrokenInNaCl() | 98 f.IsBrokenInNaCl() |
79 | 99 |
80 f = mojo.Func('MojoEndReadData', 'MojoResult') | 100 f = mojo.Func('MojoEndReadData', 'MojoResult') |
81 f.Param('data_pipe_consumer_handle').In('MojoHandle') | 101 f.Param('data_pipe_consumer_handle').In('MojoHandle') |
82 f.Param('num_bytes_read').In('uint32_t') | 102 f.Param('num_bytes_read').In('uint32_t') |
83 | 103 |
84 f = mojo.Func('MojoGetTimeTicksNow', 'MojoTimeTicks') | 104 f = mojo.Func('MojoCreateSharedBuffer', 'MojoResult') |
105 p = f.Param('options') | |
106 p.InExtensibleStruct('MojoCreateSharedBufferOptions').Optional() | |
107 f.Param('num_bytes').In('uint64_t') | |
108 f.Param('shared_buffer_handle').Out('MojoHandle') | |
85 | 109 |
86 f = mojo.Func('MojoClose', 'MojoResult') | 110 f = mojo.Func('MojoDuplicateBufferHandle', 'MojoResult') |
87 f.Param('handle').In('MojoHandle') | 111 f.Param('buffer_handle').In('MojoHandle') |
112 p = f.Param('options') | |
113 p.InExtensibleStruct('MojoDuplicateBufferHandleOptions').Optional() | |
114 f.Param('new_buffer_handle').Out('MojoHandle') | |
88 | 115 |
89 f = mojo.Func('MojoWait', 'MojoResult') | 116 f = mojo.Func('MojoGetBufferInformation', 'MojoResult') |
viettrungluu
2016/03/09 00:51:04
Other than reordering, this is the only change (ad
| |
90 f.Param('handle').In('MojoHandle') | 117 f.Param('buffer_handle').In('MojoHandle') |
91 f.Param('signals').In('MojoHandleSignals') | 118 p = f.Param('info') |
92 f.Param('deadline').In('MojoDeadline') | 119 p.OutExtensibleStruct('MojoBufferInformation', 'info_num_bytes') |
93 f.Param('signals_state').OutFixedStruct('MojoHandleSignalsState').Optional() | 120 f.Param('info_num_bytes').In('uint32_t') |
94 | 121 |
95 f = mojo.Func('MojoWaitMany', 'MojoResult') | 122 f = mojo.Func('MojoMapBuffer', 'MojoResult') |
96 f.Param('handles').InArray('MojoHandle', 'num_handles') | 123 f.Param('buffer_handle').In('MojoHandle') |
97 f.Param('signals').InArray('MojoHandleSignals', 'num_handles') | 124 f.Param('offset').In('uint64_t') |
98 f.Param('num_handles').In('uint32_t') | 125 f.Param('num_bytes').In('uint64_t') |
99 f.Param('deadline').In('MojoDeadline') | 126 f.Param('buffer').Out('void*') |
100 f.Param('result_index').Out('uint32_t').Optional() | 127 f.Param('flags').In('MojoMapBufferFlags') |
101 p = f.Param('signals_states') | 128 # TODO(ncbray): support mmaping. |
102 p.OutFixedStructArray('MojoHandleSignalsState', 'num_handles').Optional() | 129 # https://code.google.com/p/chromium/issues/detail?id=401761 |
130 f.IsBrokenInNaCl() | |
103 | 131 |
104 f = mojo.Func('MojoCreateMessagePipe', 'MojoResult') | 132 f = mojo.Func('MojoUnmapBuffer', 'MojoResult') |
105 p = f.Param('options') | 133 f.Param('buffer').In('void*') |
106 p.InExtensibleStruct('MojoCreateMessagePipeOptions').Optional() | 134 # TODO(ncbray): support mmaping. |
107 f.Param('message_pipe_handle0').Out('MojoHandle') | 135 # https://code.google.com/p/chromium/issues/detail?id=401761 |
108 f.Param('message_pipe_handle1').Out('MojoHandle') | 136 f.IsBrokenInNaCl() |
109 | |
110 f = mojo.Func('MojoWriteMessage', 'MojoResult') | |
111 f.Param('message_pipe_handle').In('MojoHandle') | |
112 f.Param('bytes').InArray('void', 'num_bytes').Optional() | |
113 f.Param('num_bytes').In('uint32_t') | |
114 f.Param('handles').InArray('MojoHandle', 'num_handles').Optional() | |
115 f.Param('num_handles').In('uint32_t') | |
116 f.Param('flags').In('MojoWriteMessageFlags') | |
117 | |
118 f = mojo.Func('MojoReadMessage', 'MojoResult') | |
119 f.Param('message_pipe_handle').In('MojoHandle') | |
120 f.Param('bytes').OutArray('void', 'num_bytes').Optional() | |
121 f.Param('num_bytes').InOut('uint32_t').Optional() | |
122 f.Param('handles').OutArray('MojoHandle', 'num_handles').Optional() | |
123 f.Param('num_handles').InOut('uint32_t').Optional() | |
124 f.Param('flags').In('MojoReadMessageFlags') | |
125 | |
126 # This function is not provided by the Mojo system APIs, but instead allows | |
127 # trusted code to provide a handle for use by untrusted code. See the | |
128 # implementation in mojo_syscall.cc.tmpl. | |
129 f = mojo.Func('_MojoGetInitialHandle', 'MojoResult') | |
130 f.Param('handle').Out('MojoHandle') | |
131 | 137 |
132 mojo.Finalize() | 138 mojo.Finalize() |
133 | 139 |
134 return mojo | 140 return mojo |
OLD | NEW |