OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 # pylint: disable=F0401 | |
6 | |
7 import interface_dsl | |
8 | |
9 def MakeInterface(): | |
10 mojo = interface_dsl.Interface() | |
11 | |
12 f = mojo.Func('MojoCreateSharedBuffer', 'MojoResult') | |
13 p = f.Param('options') | |
14 p.InExtensibleStruct('MojoCreateSharedBufferOptions').Optional() | |
15 f.Param('num_bytes').In('uint64_t') | |
16 f.Param('shared_buffer_handle').Out('MojoHandle') | |
17 | |
18 f = mojo.Func('MojoDuplicateBufferHandle', 'MojoResult') | |
19 f.Param('buffer_handle').In('MojoHandle') | |
20 p = f.Param('options') | |
21 p.InExtensibleStruct('MojoDuplicateBufferHandleOptions').Optional() | |
22 f.Param('new_buffer_handle').Out('MojoHandle') | |
23 | |
24 f = mojo.Func('MojoMapBuffer', 'MojoResult') | |
25 f.Param('buffer_handle').In('MojoHandle') | |
26 f.Param('offset').In('uint64_t') | |
27 f.Param('num_bytes').In('uint64_t') | |
28 f.Param('buffer').Out('void*') | |
29 f.Param('flags').In('MojoMapBufferFlags') | |
30 | |
31 f = mojo.Func('MojoUnmapBuffer', 'MojoResult') | |
32 f.Param('buffer').In('void*') | |
33 | |
34 f = mojo.Func('MojoCreateDataPipe', 'MojoResult') | |
35 p = f.Param('options') | |
36 p.InExtensibleStruct('MojoCreateDataPipeOptions').Optional() | |
37 f.Param('data_pipe_producer_handle').Out('MojoHandle') | |
38 f.Param('data_pipe_consumer_handle').Out('MojoHandle') | |
39 | |
40 f = mojo.Func('MojoWriteData', 'MojoResult') | |
41 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
42 f.Param('elements').InArray('void', 'num_bytes') | |
43 f.Param('num_bytes').InOut('uint32_t') | |
44 f.Param('flags').In('MojoWriteDataFlags') | |
45 | |
46 f = mojo.Func('MojoBeginWriteData', 'MojoResult') | |
47 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
48 f.Param('buffer').Out('void*') | |
49 f.Param('buffer_num_bytes').InOut('uint32_t') | |
50 f.Param('flags').In('MojoWriteDataFlags') | |
51 | |
52 f = mojo.Func('MojoEndWriteData', 'MojoResult') | |
53 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
54 f.Param('num_bytes_written').In('uint32_t') | |
55 | |
56 f = mojo.Func('MojoReadData', 'MojoResult') | |
57 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
58 f.Param('elements').OutArray('void', 'num_bytes') | |
59 f.Param('num_bytes').InOut('uint32_t') | |
60 f.Param('flags').In('MojoReadDataFlags') | |
61 | |
62 f = mojo.Func('MojoBeginReadData', 'MojoResult') | |
63 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
64 f.Param('buffer').Out('const void*') | |
65 f.Param('buffer_num_bytes').InOut('uint32_t') | |
66 f.Param('flags').In('MojoReadDataFlags') | |
67 | |
68 f = mojo.Func('MojoEndReadData', 'MojoResult') | |
69 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
70 f.Param('num_bytes_read').In('uint32_t') | |
71 | |
72 f = mojo.Func('MojoGetTimeTicksNow', 'MojoTimeTicks') | |
73 | |
74 f = mojo.Func('MojoClose', 'MojoResult') | |
75 f.Param('handle').In('MojoHandle') | |
76 | |
77 f = mojo.Func('MojoWait', 'MojoResult') | |
78 f.Param('handle').In('MojoHandle') | |
79 f.Param('signals').In('MojoHandleSignals') | |
80 f.Param('deadline').In('MojoDeadline') | |
81 f.Param('signals_state').OutFixedStruct('MojoHandleSignalsState').Optional() | |
82 | |
83 f = mojo.Func('MojoWaitMany', 'MojoResult') | |
84 f.Param('handles').InArray('MojoHandle', 'num_handles') | |
85 f.Param('signals').InArray('MojoHandleSignals', 'num_handles') | |
86 f.Param('num_handles').In('uint32_t') | |
87 f.Param('deadline').In('MojoDeadline') | |
88 f.Param('result_index').Out('uint32_t').Optional() | |
89 p = f.Param('signals_states') | |
90 p.OutFixedStructArray('MojoHandleSignalsState', 'num_handles').Optional() | |
91 | |
92 f = mojo.Func('MojoCreateMessagePipe', 'MojoResult') | |
93 p = f.Param('options') | |
94 p.InExtensibleStruct('MojoCreateMessagePipeOptions').Optional() | |
95 f.Param('message_pipe_handle0').Out('MojoHandle') | |
96 f.Param('message_pipe_handle1').Out('MojoHandle') | |
97 | |
98 f = mojo.Func('MojoWriteMessage', 'MojoResult') | |
99 f.Param('message_pipe_handle').In('MojoHandle') | |
100 f.Param('bytes').InArray('void', 'num_bytes').Optional() | |
101 f.Param('num_bytes').In('uint32_t') | |
102 f.Param('handles').InArray('MojoHandle', 'num_handles').Optional() | |
103 f.Param('num_handles').In('uint32_t') | |
104 f.Param('flags').In('MojoWriteMessageFlags') | |
105 | |
106 f = mojo.Func('MojoReadMessage', 'MojoResult') | |
107 f.Param('message_pipe_handle').In('MojoHandle') | |
108 f.Param('bytes').OutArray('void', 'num_bytes').Optional() | |
109 f.Param('num_bytes').InOut('uint32_t').Optional() | |
110 f.Param('handles').OutArray('MojoHandle', 'num_handles').Optional() | |
111 f.Param('num_handles').InOut('uint32_t').Optional() | |
112 f.Param('flags').In('MojoReadMessageFlags') | |
113 | |
114 # This function is not provided by the Mojo system APIs, but instead allows | |
115 # trusted code to provide a handle for use by untrusted code. See the | |
116 # implementation in mojo_syscall.cc.tmpl. | |
117 f = mojo.Func('_MojoGetInitialHandle', 'MojoResult') | |
118 f.Param('handle').Out('MojoHandle') | |
119 | |
120 mojo.Finalize() | |
121 | |
122 return mojo | |
OLD | NEW |