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

Unified Diff: mojo/public/interfaces/bindings/interface_control_messages.mojom

Issue 2277853003: Use unions for interface control messages. (Closed)
Patch Set: Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/interfaces/bindings/interface_control_messages.mojom
diff --git a/mojo/public/interfaces/bindings/interface_control_messages.mojom b/mojo/public/interfaces/bindings/interface_control_messages.mojom
index 2143c06cce5c64a015599e3fb040628964637ded..d193351c49e56939a16cd396b6c97e5c241c51b7 100644
--- a/mojo/public/interfaces/bindings/interface_control_messages.mojom
+++ b/mojo/public/interfaces/bindings/interface_control_messages.mojom
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-[JavaPackage="org.chromium.mojo.bindings"]
-module mojo;
+[JavaPackage="org.chromium.mojo.bindings.interfacecontrol"]
+module mojo.interface_control;
// For each user-defined interface, some control functions are provided at the
// same end of the message pipe as the user-defined interface, providing
@@ -15,38 +15,20 @@ module mojo;
// This control function runs the input command. If the command is not
// supported, |output| is set to null; otherwise |output| stores the result,
// whose type depends on the input.
-//
-// TODO(yzshen): Once union support is ready, switch the following definition
-// to:
-// struct RunMessageParams {
-// RunInput input;
-// };
-// union RunInput {
-// QueryVersion query_version;
-// };
-//
-// struct RunResponseMessageParams {
-// RunOutput? output;
-// };
-// union RunOutput {
-// QueryVersionResult query_version_result;
-// };
const uint32 kRunMessageId = 0xFFFFFFFF;
struct RunMessageParams {
- // The reserved fields make the layout compatible with the RunInput union
- // described above.
- uint32 reserved0; // Must be set to 16.
- uint32 reserved1; // Must be set to 0;
+ RunInput input;
+};
+union RunInput {
QueryVersion query_version;
};
struct RunResponseMessageParams {
- // The reserved fields make the layout compatible with the RunOutput union
- // described above.
- uint32 reserved0; // Must be set to 16.
- uint32 reserved1; // Must be set to 0.
+ RunOutput? output;
+};
+union RunOutput {
QueryVersionResult query_version_result;
};
@@ -62,23 +44,13 @@ struct QueryVersionResult {
//
// This control function runs the input command. If the operation fails or the
// command is not supported, the message pipe is closed.
-//
-// TODO(yzshen): Once union support is ready, switch the following definition
-// to:
-// struct RunOrClosePipeMessageParams {
-// RunOrClosePipeInput input;
-// };
-// union RunOrClosePipeInput {
-// RequireVersion require_version;
-// };
const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE;
struct RunOrClosePipeMessageParams {
- // The reserved fields make the layout compatible with the RunOrClosePipeInput
- // union described above.
- uint32 reserved0; // Must be set to 16.
- uint32 reserved1; // Must be set to 0.
+ RunOrClosePipeInput input;
+};
+union RunOrClosePipeInput {
RequireVersion require_version;
};

Powered by Google App Engine
This is Rietveld 408576698