| 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.interfacecontrol"] | 5 [JavaPackage="org.chromium.mojo.bindings.interfacecontrol"] |
| 6 module mojo.interface_control; | 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 by the |
| 9 // same end of the message pipe as the user-defined interface, providing | 9 // interface endpoints at both sides. |
| 10 // information about the user-defined interface. | |
| 11 | 10 |
| 12 //////////////////////////////////////////////////////////////////////////////// | 11 //////////////////////////////////////////////////////////////////////////////// |
| 13 // Run@0xFFFFFFFF(RunInput input) => (RunOutput? output); | 12 // Run@0xFFFFFFFF(RunInput input) => (RunOutput? output); |
| 14 // | 13 // |
| 15 // This control function runs the input command. If the command is not | 14 // This control function runs the input command. If the command is not |
| 16 // supported, |output| is set to null; otherwise |output| stores the result, | 15 // supported, |output| is set to null; otherwise |output| stores the result, |
| 17 // whose type depends on the input. | 16 // whose type depends on the input. |
| 18 | 17 |
| 19 const uint32 kRunMessageId = 0xFFFFFFFF; | 18 const uint32 kRunMessageId = 0xFFFFFFFF; |
| 20 | 19 |
| 21 struct RunMessageParams { | 20 struct RunMessageParams { |
| 22 RunInput input; | 21 RunInput input; |
| 23 }; | 22 }; |
| 24 union RunInput { | 23 union RunInput { |
| 25 QueryVersion query_version; | 24 QueryVersion query_version; |
| 26 FlushForTesting flush_for_testing; | 25 FlushForTesting flush_for_testing; |
| 27 }; | 26 }; |
| 28 | 27 |
| 29 struct RunResponseMessageParams { | 28 struct RunResponseMessageParams { |
| 30 RunOutput? output; | 29 RunOutput? output; |
| 31 }; | 30 }; |
| 32 union RunOutput { | 31 union RunOutput { |
| 33 QueryVersionResult query_version_result; | 32 QueryVersionResult query_version_result; |
| 34 }; | 33 }; |
| 35 | 34 |
| 36 // Queries the max supported version of the user-defined interface. | 35 // Queries the max supported version of the user-defined interface. |
| 36 // Sent by the interface client side. |
| 37 struct QueryVersion { | 37 struct QueryVersion { |
| 38 }; | 38 }; |
| 39 struct QueryVersionResult { | 39 struct QueryVersionResult { |
| 40 uint32 version; | 40 uint32 version; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // Sent by either side of the interface. |
| 43 struct FlushForTesting { | 44 struct FlushForTesting { |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 //////////////////////////////////////////////////////////////////////////////// | 47 //////////////////////////////////////////////////////////////////////////////// |
| 47 // RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); | 48 // RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); |
| 48 // | 49 // |
| 49 // This control function runs the input command. If the operation fails or the | 50 // This control function runs the input command. If the operation fails or the |
| 50 // command is not supported, the message pipe is closed. | 51 // command is not supported, the message pipe is closed. |
| 51 | 52 |
| 52 const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; | 53 const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; |
| 53 | 54 |
| 54 struct RunOrClosePipeMessageParams { | 55 struct RunOrClosePipeMessageParams { |
| 55 RunOrClosePipeInput input; | 56 RunOrClosePipeInput input; |
| 56 }; | 57 }; |
| 57 union RunOrClosePipeInput { | 58 union RunOrClosePipeInput { |
| 58 RequireVersion require_version; | 59 RequireVersion require_version; |
| 60 SendDisconnectReason send_disconnect_reason; |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 // If the specified version of the user-defined interface is not supported, the | 63 // If the specified version of the user-defined interface is not supported, the |
| 62 // function fails and the pipe is closed. | 64 // function fails and the pipe is closed. |
| 65 // Sent by the interface client side. |
| 63 struct RequireVersion { | 66 struct RequireVersion { |
| 64 uint32 version; | 67 uint32 version; |
| 65 }; | 68 }; |
| 69 |
| 70 // A user-defined reason about why the interface is disconnected. The sender |
| 71 // usually send this message and immediately disconnect the interface. |
| 72 // Sent by either side of the interface. |
| 73 struct SendDisconnectReason { |
| 74 uint32 custom_reason; |
| 75 string description; |
| 76 }; |
| OLD | NEW |