OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 [JavaPackage="org.chromium.mojo.bindings"] | 5 [JavaPackage="org.chromium.mojo.bindings.interfacecontrol"] |
6 module mojo; | 6 module mojo.interface_control; |
7 | 7 |
8 // For each user-defined interface, some control functions are provided at the | 8 // For each user-defined interface, some control functions are provided at the |
9 // same end of the message pipe as the user-defined interface, providing | 9 // same end of the message pipe as the user-defined interface, providing |
10 // information about the user-defined interface. | 10 // information about the user-defined interface. |
11 | 11 |
12 //////////////////////////////////////////////////////////////////////////////// | 12 //////////////////////////////////////////////////////////////////////////////// |
13 // Run@0xFFFFFFFF(RunInput input) => (RunOutput? output); | 13 // Run@0xFFFFFFFF(RunInput input) => (RunOutput? output); |
14 // | 14 // |
15 // This control function runs the input command. If the command is not | 15 // This control function runs the input command. If the command is not |
16 // supported, |output| is set to null; otherwise |output| stores the result, | 16 // supported, |output| is set to null; otherwise |output| stores the result, |
17 // whose type depends on the input. | 17 // whose type depends on the input. |
18 // | |
19 // TODO(yzshen): Once union support is ready, switch the following definition | |
20 // to: | |
21 // struct RunMessageParams { | |
22 // RunInput input; | |
23 // }; | |
24 // union RunInput { | |
25 // QueryVersion query_version; | |
26 // }; | |
27 // | |
28 // struct RunResponseMessageParams { | |
29 // RunOutput? output; | |
30 // }; | |
31 // union RunOutput { | |
32 // QueryVersionResult query_version_result; | |
33 // }; | |
34 | 18 |
35 const uint32 kRunMessageId = 0xFFFFFFFF; | 19 const uint32 kRunMessageId = 0xFFFFFFFF; |
36 | 20 |
37 struct RunMessageParams { | 21 struct RunMessageParams { |
38 // The reserved fields make the layout compatible with the RunInput union | 22 RunInput input; |
39 // described above. | 23 }; |
40 uint32 reserved0; // Must be set to 16. | 24 union RunInput { |
41 uint32 reserved1; // Must be set to 0; | |
42 QueryVersion query_version; | 25 QueryVersion query_version; |
43 }; | 26 }; |
44 | 27 |
45 struct RunResponseMessageParams { | 28 struct RunResponseMessageParams { |
46 // The reserved fields make the layout compatible with the RunOutput union | 29 RunOutput? output; |
47 // described above. | 30 }; |
48 uint32 reserved0; // Must be set to 16. | 31 union RunOutput { |
49 uint32 reserved1; // Must be set to 0. | |
50 QueryVersionResult query_version_result; | 32 QueryVersionResult query_version_result; |
51 }; | 33 }; |
52 | 34 |
53 // Queries the max supported version of the user-defined interface. | 35 // Queries the max supported version of the user-defined interface. |
54 struct QueryVersion { | 36 struct QueryVersion { |
55 }; | 37 }; |
56 struct QueryVersionResult { | 38 struct QueryVersionResult { |
57 uint32 version; | 39 uint32 version; |
58 }; | 40 }; |
59 | 41 |
60 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
61 // RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); | 43 // RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); |
62 // | 44 // |
63 // This control function runs the input command. If the operation fails or the | 45 // This control function runs the input command. If the operation fails or the |
64 // command is not supported, the message pipe is closed. | 46 // command is not supported, the message pipe is closed. |
65 // | |
66 // TODO(yzshen): Once union support is ready, switch the following definition | |
67 // to: | |
68 // struct RunOrClosePipeMessageParams { | |
69 // RunOrClosePipeInput input; | |
70 // }; | |
71 // union RunOrClosePipeInput { | |
72 // RequireVersion require_version; | |
73 // }; | |
74 | 47 |
75 const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; | 48 const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; |
76 | 49 |
77 struct RunOrClosePipeMessageParams { | 50 struct RunOrClosePipeMessageParams { |
78 // The reserved fields make the layout compatible with the RunOrClosePipeInput | 51 RunOrClosePipeInput input; |
79 // union described above. | 52 }; |
80 uint32 reserved0; // Must be set to 16. | 53 union RunOrClosePipeInput { |
81 uint32 reserved1; // Must be set to 0. | |
82 RequireVersion require_version; | 54 RequireVersion require_version; |
83 }; | 55 }; |
84 | 56 |
85 // If the specified version of the user-defined interface is not supported, the | 57 // If the specified version of the user-defined interface is not supported, the |
86 // function fails and the pipe is closed. | 58 // function fails and the pipe is closed. |
87 struct RequireVersion { | 59 struct RequireVersion { |
88 uint32 version; | 60 uint32 version; |
89 }; | 61 }; |
OLD | NEW |