| Index: mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ProviderInternal.java
|
| diff --git a/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ProviderInternal.java b/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ProviderInternal.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9a9c3f1a344f6a40e1b720427ccba81e2a0a736d
|
| --- /dev/null
|
| +++ b/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ProviderInternal.java
|
| @@ -0,0 +1,672 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// This file is autogenerated by:
|
| +// mojo/public/tools/bindings/mojom_bindings_generator.py
|
| +// For:
|
| +// mojo/public/interfaces/bindings/tests/sample_interfaces.mojom
|
| +//
|
| +
|
| +package org.chromium.mojo.bindings.test.mojom.sample;
|
| +
|
| +class ProviderInternal {
|
| +
|
| + public static final org.chromium.mojo.bindings.InterfaceWithClient.Builder<ProviderClient, Provider, Provider.Proxy> BUILDER =
|
| + new org.chromium.mojo.bindings.InterfaceWithClient.Builder<ProviderClient, Provider, Provider.Proxy>() {
|
| +
|
| + public Proxy buildProxy(org.chromium.mojo.system.Core core,
|
| + org.chromium.mojo.bindings.MessageReceiverWithResponder messageReceiver) {
|
| + return new Proxy(core, messageReceiver);
|
| + }
|
| +
|
| + public Stub buildStub(org.chromium.mojo.system.Core core, Provider impl) {
|
| + return new Stub(core, impl);
|
| + }
|
| +
|
| + public Provider[] newArray(int size) {
|
| + return new Provider[size];
|
| + }
|
| +
|
| + protected org.chromium.mojo.bindings.Interface.Builder<ProviderClient, ?> getClientBuilder() {
|
| + return ProviderClient.BUILDER;
|
| + }
|
| + };
|
| +
|
| + private static final int ECHO_STRING_ORDINAL = 0;
|
| + private static final int ECHO_STRINGS_ORDINAL = 1;
|
| + private static final int ECHO_MESSAGE_PIPE_HANDLE_ORDINAL = 2;
|
| + private static final int ECHO_ENUM_ORDINAL = 3;
|
| +
|
| + static final class Proxy extends org.chromium.mojo.bindings.InterfaceWithClient.BaseProxy<ProviderClient> implements Provider.Proxy {
|
| +
|
| + Proxy(org.chromium.mojo.system.Core core,
|
| + org.chromium.mojo.bindings.MessageReceiverWithResponder messageReceiver) {
|
| + super(core, messageReceiver);
|
| + }
|
| +
|
| + @Override
|
| + public void echoString(String a, EchoStringResponse callback) {
|
| + ProviderEchoStringParams message = new ProviderEchoStringParams();
|
| + message.a = a;
|
| + getMessageReceiver().acceptWithResponder(
|
| + message.serializeWithHeader(
|
| + getCore(),
|
| + new org.chromium.mojo.bindings.MessageHeader(
|
| + ECHO_STRING_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
|
| + 0)),
|
| + new ProviderEchoStringResponseParamsForwardToCallback(callback));
|
| + }
|
| +
|
| + @Override
|
| + public void echoStrings(String a, String b, EchoStringsResponse callback) {
|
| + ProviderEchoStringsParams message = new ProviderEchoStringsParams();
|
| + message.a = a;
|
| + message.b = b;
|
| + getMessageReceiver().acceptWithResponder(
|
| + message.serializeWithHeader(
|
| + getCore(),
|
| + new org.chromium.mojo.bindings.MessageHeader(
|
| + ECHO_STRINGS_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
|
| + 0)),
|
| + new ProviderEchoStringsResponseParamsForwardToCallback(callback));
|
| + }
|
| +
|
| + @Override
|
| + public void echoMessagePipeHandle(org.chromium.mojo.system.MessagePipeHandle a, EchoMessagePipeHandleResponse callback) {
|
| + ProviderEchoMessagePipeHandleParams message = new ProviderEchoMessagePipeHandleParams();
|
| + message.a = a;
|
| + getMessageReceiver().acceptWithResponder(
|
| + message.serializeWithHeader(
|
| + getCore(),
|
| + new org.chromium.mojo.bindings.MessageHeader(
|
| + ECHO_MESSAGE_PIPE_HANDLE_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
|
| + 0)),
|
| + new ProviderEchoMessagePipeHandleResponseParamsForwardToCallback(callback));
|
| + }
|
| +
|
| + @Override
|
| + public void echoEnum(int a, EchoEnumResponse callback) {
|
| + ProviderEchoEnumParams message = new ProviderEchoEnumParams();
|
| + message.a = a;
|
| + getMessageReceiver().acceptWithResponder(
|
| + message.serializeWithHeader(
|
| + getCore(),
|
| + new org.chromium.mojo.bindings.MessageHeader(
|
| + ECHO_ENUM_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
|
| + 0)),
|
| + new ProviderEchoEnumResponseParamsForwardToCallback(callback));
|
| + }
|
| +
|
| + }
|
| +
|
| + static final class Stub extends org.chromium.mojo.bindings.Interface.Stub<Provider> {
|
| +
|
| + Stub(org.chromium.mojo.system.Core core, Provider impl) {
|
| + super(core, impl);
|
| + }
|
| +
|
| + @Override
|
| + public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) {
|
| + return false;
|
| + }
|
| +
|
| + @Override
|
| + public boolean acceptWithResponder(org.chromium.mojo.bindings.MessageWithHeader message, org.chromium.mojo.bindings.MessageReceiver receiver) {
|
| + try {
|
| + org.chromium.mojo.bindings.MessageHeader header = message.getHeader();
|
| + switch(header.getType()) {
|
| + case ECHO_STRING_ORDINAL: {
|
| + if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG)) {
|
| + return false;
|
| + }
|
| + ProviderEchoStringParams data =
|
| + ProviderEchoStringParams.deserialize(message.getPayload());
|
| + getImpl().echoString(data.a, new ProviderEchoStringResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
|
| + return true;
|
| + }
|
| + case ECHO_STRINGS_ORDINAL: {
|
| + if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG)) {
|
| + return false;
|
| + }
|
| + ProviderEchoStringsParams data =
|
| + ProviderEchoStringsParams.deserialize(message.getPayload());
|
| + getImpl().echoStrings(data.a, data.b, new ProviderEchoStringsResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
|
| + return true;
|
| + }
|
| + case ECHO_MESSAGE_PIPE_HANDLE_ORDINAL: {
|
| + if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG)) {
|
| + return false;
|
| + }
|
| + ProviderEchoMessagePipeHandleParams data =
|
| + ProviderEchoMessagePipeHandleParams.deserialize(message.getPayload());
|
| + getImpl().echoMessagePipeHandle(data.a, new ProviderEchoMessagePipeHandleResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
|
| + return true;
|
| + }
|
| + case ECHO_ENUM_ORDINAL: {
|
| + if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG)) {
|
| + return false;
|
| + }
|
| + ProviderEchoEnumParams data =
|
| + ProviderEchoEnumParams.deserialize(message.getPayload());
|
| + getImpl().echoEnum(data.a, new ProviderEchoEnumResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
|
| + return true;
|
| + }
|
| + }
|
| + } catch (org.chromium.mojo.bindings.DeserializationException e) {
|
| + }
|
| + return false;
|
| + }
|
| + }
|
| +
|
| + static final class ProviderEchoStringParams extends org.chromium.mojo.bindings.Struct {
|
| +
|
| + private static final int STRUCT_SIZE = 16;
|
| + private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1);
|
| +
|
| + public String a;
|
| +
|
| + public ProviderEchoStringParams() {
|
| + super(STRUCT_SIZE);
|
| + }
|
| +
|
| + public static ProviderEchoStringParams deserialize(org.chromium.mojo.bindings.Message message) {
|
| + return decode(new org.chromium.mojo.bindings.Decoder(message));
|
| + }
|
| +
|
| + public static ProviderEchoStringParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ProviderEchoStringParams result = new ProviderEchoStringParams();
|
| + DataHeader mainDataHeader = decoder0.readDataHeader();
|
| + if (mainDataHeader.numFields > 0) {
|
| + result.a = decoder0.readString(8);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + @Override
|
| + protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
|
| + org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
|
| + encoder0.encode(a, 8);
|
| + }
|
| + }
|
| +
|
| + static final class ProviderEchoStringResponseParams extends org.chromium.mojo.bindings.Struct {
|
| +
|
| + private static final int STRUCT_SIZE = 16;
|
| + private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1);
|
| +
|
| + public String a;
|
| +
|
| + public ProviderEchoStringResponseParams() {
|
| + super(STRUCT_SIZE);
|
| + }
|
| +
|
| + public static ProviderEchoStringResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
|
| + return decode(new org.chromium.mojo.bindings.Decoder(message));
|
| + }
|
| +
|
| + public static ProviderEchoStringResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ProviderEchoStringResponseParams result = new ProviderEchoStringResponseParams();
|
| + DataHeader mainDataHeader = decoder0.readDataHeader();
|
| + if (mainDataHeader.numFields > 0) {
|
| + result.a = decoder0.readString(8);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + @Override
|
| + protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
|
| + org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
|
| + encoder0.encode(a, 8);
|
| + }
|
| + }
|
| +
|
| + static class ProviderEchoStringResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
|
| + implements org.chromium.mojo.bindings.MessageReceiver {
|
| + private final Provider.EchoStringResponse mCallback;
|
| +
|
| + ProviderEchoStringResponseParamsForwardToCallback(Provider.EchoStringResponse callback) {
|
| + this.mCallback = callback;
|
| + }
|
| +
|
| + @Override
|
| + public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) {
|
| + try {
|
| + org.chromium.mojo.bindings.MessageHeader header = message.getHeader();
|
| + if (!header.validateHeader(ECHO_STRING_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
|
| + return false;
|
| + }
|
| + ProviderEchoStringResponseParams response = ProviderEchoStringResponseParams.deserialize(message.getPayload());
|
| + mCallback.call(response.a);
|
| + return true;
|
| + } catch (org.chromium.mojo.bindings.DeserializationException e) {
|
| + return false;
|
| + }
|
| + }
|
| + }
|
| +
|
| + static class ProviderEchoStringResponseParamsProxyToResponder implements Provider.EchoStringResponse {
|
| +
|
| + private final org.chromium.mojo.system.Core mCore;
|
| + private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
|
| + private final long mRequestId;
|
| +
|
| + ProviderEchoStringResponseParamsProxyToResponder(
|
| + org.chromium.mojo.system.Core core,
|
| + org.chromium.mojo.bindings.MessageReceiver messageReceiver,
|
| + long requestId) {
|
| + mCore = core;
|
| + mMessageReceiver = messageReceiver;
|
| + mRequestId = requestId;
|
| + }
|
| +
|
| + @Override
|
| + public void call(String a) {
|
| + ProviderEchoStringResponseParams response = new ProviderEchoStringResponseParams();
|
| + response.a = a;
|
| + org.chromium.mojo.bindings.MessageWithHeader message =
|
| + response.serializeWithHeader(
|
| + mCore,
|
| + new org.chromium.mojo.bindings.MessageHeader(
|
| + ECHO_STRING_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
|
| + mRequestId));
|
| + mMessageReceiver.accept(message);
|
| + }
|
| + }
|
| +
|
| + static final class ProviderEchoStringsParams extends org.chromium.mojo.bindings.Struct {
|
| +
|
| + private static final int STRUCT_SIZE = 24;
|
| + private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 2);
|
| +
|
| + public String a;
|
| + public String b;
|
| +
|
| + public ProviderEchoStringsParams() {
|
| + super(STRUCT_SIZE);
|
| + }
|
| +
|
| + public static ProviderEchoStringsParams deserialize(org.chromium.mojo.bindings.Message message) {
|
| + return decode(new org.chromium.mojo.bindings.Decoder(message));
|
| + }
|
| +
|
| + public static ProviderEchoStringsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ProviderEchoStringsParams result = new ProviderEchoStringsParams();
|
| + DataHeader mainDataHeader = decoder0.readDataHeader();
|
| + if (mainDataHeader.numFields > 0) {
|
| + result.a = decoder0.readString(8);
|
| + }
|
| + if (mainDataHeader.numFields > 1) {
|
| + result.b = decoder0.readString(16);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + @Override
|
| + protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
|
| + org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
|
| + encoder0.encode(a, 8);
|
| + encoder0.encode(b, 16);
|
| + }
|
| + }
|
| +
|
| + static final class ProviderEchoStringsResponseParams extends org.chromium.mojo.bindings.Struct {
|
| +
|
| + private static final int STRUCT_SIZE = 24;
|
| + private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 2);
|
| +
|
| + public String a;
|
| + public String b;
|
| +
|
| + public ProviderEchoStringsResponseParams() {
|
| + super(STRUCT_SIZE);
|
| + }
|
| +
|
| + public static ProviderEchoStringsResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
|
| + return decode(new org.chromium.mojo.bindings.Decoder(message));
|
| + }
|
| +
|
| + public static ProviderEchoStringsResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ProviderEchoStringsResponseParams result = new ProviderEchoStringsResponseParams();
|
| + DataHeader mainDataHeader = decoder0.readDataHeader();
|
| + if (mainDataHeader.numFields > 0) {
|
| + result.a = decoder0.readString(8);
|
| + }
|
| + if (mainDataHeader.numFields > 1) {
|
| + result.b = decoder0.readString(16);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + @Override
|
| + protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
|
| + org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
|
| + encoder0.encode(a, 8);
|
| + encoder0.encode(b, 16);
|
| + }
|
| + }
|
| +
|
| + static class ProviderEchoStringsResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
|
| + implements org.chromium.mojo.bindings.MessageReceiver {
|
| + private final Provider.EchoStringsResponse mCallback;
|
| +
|
| + ProviderEchoStringsResponseParamsForwardToCallback(Provider.EchoStringsResponse callback) {
|
| + this.mCallback = callback;
|
| + }
|
| +
|
| + @Override
|
| + public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) {
|
| + try {
|
| + org.chromium.mojo.bindings.MessageHeader header = message.getHeader();
|
| + if (!header.validateHeader(ECHO_STRINGS_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
|
| + return false;
|
| + }
|
| + ProviderEchoStringsResponseParams response = ProviderEchoStringsResponseParams.deserialize(message.getPayload());
|
| + mCallback.call(response.a, response.b);
|
| + return true;
|
| + } catch (org.chromium.mojo.bindings.DeserializationException e) {
|
| + return false;
|
| + }
|
| + }
|
| + }
|
| +
|
| + static class ProviderEchoStringsResponseParamsProxyToResponder implements Provider.EchoStringsResponse {
|
| +
|
| + private final org.chromium.mojo.system.Core mCore;
|
| + private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
|
| + private final long mRequestId;
|
| +
|
| + ProviderEchoStringsResponseParamsProxyToResponder(
|
| + org.chromium.mojo.system.Core core,
|
| + org.chromium.mojo.bindings.MessageReceiver messageReceiver,
|
| + long requestId) {
|
| + mCore = core;
|
| + mMessageReceiver = messageReceiver;
|
| + mRequestId = requestId;
|
| + }
|
| +
|
| + @Override
|
| + public void call(String a, String b) {
|
| + ProviderEchoStringsResponseParams response = new ProviderEchoStringsResponseParams();
|
| + response.a = a;
|
| + response.b = b;
|
| + org.chromium.mojo.bindings.MessageWithHeader message =
|
| + response.serializeWithHeader(
|
| + mCore,
|
| + new org.chromium.mojo.bindings.MessageHeader(
|
| + ECHO_STRINGS_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
|
| + mRequestId));
|
| + mMessageReceiver.accept(message);
|
| + }
|
| + }
|
| +
|
| + static final class ProviderEchoMessagePipeHandleParams extends org.chromium.mojo.bindings.Struct {
|
| +
|
| + private static final int STRUCT_SIZE = 16;
|
| + private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1);
|
| +
|
| + public org.chromium.mojo.system.MessagePipeHandle a;
|
| +
|
| + public ProviderEchoMessagePipeHandleParams() {
|
| + super(STRUCT_SIZE);
|
| + a = org.chromium.mojo.system.InvalidHandle.INSTANCE;
|
| + }
|
| +
|
| + public static ProviderEchoMessagePipeHandleParams deserialize(org.chromium.mojo.bindings.Message message) {
|
| + return decode(new org.chromium.mojo.bindings.Decoder(message));
|
| + }
|
| +
|
| + public static ProviderEchoMessagePipeHandleParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ProviderEchoMessagePipeHandleParams result = new ProviderEchoMessagePipeHandleParams();
|
| + DataHeader mainDataHeader = decoder0.readDataHeader();
|
| + if (mainDataHeader.numFields > 0) {
|
| + result.a = decoder0.readMessagePipeHandle(8);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + @Override
|
| + protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
|
| + org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
|
| + encoder0.encode(a, 8);
|
| + }
|
| + }
|
| +
|
| + static final class ProviderEchoMessagePipeHandleResponseParams extends org.chromium.mojo.bindings.Struct {
|
| +
|
| + private static final int STRUCT_SIZE = 16;
|
| + private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1);
|
| +
|
| + public org.chromium.mojo.system.MessagePipeHandle a;
|
| +
|
| + public ProviderEchoMessagePipeHandleResponseParams() {
|
| + super(STRUCT_SIZE);
|
| + a = org.chromium.mojo.system.InvalidHandle.INSTANCE;
|
| + }
|
| +
|
| + public static ProviderEchoMessagePipeHandleResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
|
| + return decode(new org.chromium.mojo.bindings.Decoder(message));
|
| + }
|
| +
|
| + public static ProviderEchoMessagePipeHandleResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ProviderEchoMessagePipeHandleResponseParams result = new ProviderEchoMessagePipeHandleResponseParams();
|
| + DataHeader mainDataHeader = decoder0.readDataHeader();
|
| + if (mainDataHeader.numFields > 0) {
|
| + result.a = decoder0.readMessagePipeHandle(8);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + @Override
|
| + protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
|
| + org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
|
| + encoder0.encode(a, 8);
|
| + }
|
| + }
|
| +
|
| + static class ProviderEchoMessagePipeHandleResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
|
| + implements org.chromium.mojo.bindings.MessageReceiver {
|
| + private final Provider.EchoMessagePipeHandleResponse mCallback;
|
| +
|
| + ProviderEchoMessagePipeHandleResponseParamsForwardToCallback(Provider.EchoMessagePipeHandleResponse callback) {
|
| + this.mCallback = callback;
|
| + }
|
| +
|
| + @Override
|
| + public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) {
|
| + try {
|
| + org.chromium.mojo.bindings.MessageHeader header = message.getHeader();
|
| + if (!header.validateHeader(ECHO_MESSAGE_PIPE_HANDLE_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
|
| + return false;
|
| + }
|
| + ProviderEchoMessagePipeHandleResponseParams response = ProviderEchoMessagePipeHandleResponseParams.deserialize(message.getPayload());
|
| + mCallback.call(response.a);
|
| + return true;
|
| + } catch (org.chromium.mojo.bindings.DeserializationException e) {
|
| + return false;
|
| + }
|
| + }
|
| + }
|
| +
|
| + static class ProviderEchoMessagePipeHandleResponseParamsProxyToResponder implements Provider.EchoMessagePipeHandleResponse {
|
| +
|
| + private final org.chromium.mojo.system.Core mCore;
|
| + private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
|
| + private final long mRequestId;
|
| +
|
| + ProviderEchoMessagePipeHandleResponseParamsProxyToResponder(
|
| + org.chromium.mojo.system.Core core,
|
| + org.chromium.mojo.bindings.MessageReceiver messageReceiver,
|
| + long requestId) {
|
| + mCore = core;
|
| + mMessageReceiver = messageReceiver;
|
| + mRequestId = requestId;
|
| + }
|
| +
|
| + @Override
|
| + public void call(org.chromium.mojo.system.MessagePipeHandle a) {
|
| + ProviderEchoMessagePipeHandleResponseParams response = new ProviderEchoMessagePipeHandleResponseParams();
|
| + response.a = a;
|
| + org.chromium.mojo.bindings.MessageWithHeader message =
|
| + response.serializeWithHeader(
|
| + mCore,
|
| + new org.chromium.mojo.bindings.MessageHeader(
|
| + ECHO_MESSAGE_PIPE_HANDLE_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
|
| + mRequestId));
|
| + mMessageReceiver.accept(message);
|
| + }
|
| + }
|
| +
|
| + static final class ProviderEchoEnumParams extends org.chromium.mojo.bindings.Struct {
|
| +
|
| + private static final int STRUCT_SIZE = 16;
|
| + private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1);
|
| +
|
| + public int a;
|
| +
|
| + public ProviderEchoEnumParams() {
|
| + super(STRUCT_SIZE);
|
| + }
|
| +
|
| + public static ProviderEchoEnumParams deserialize(org.chromium.mojo.bindings.Message message) {
|
| + return decode(new org.chromium.mojo.bindings.Decoder(message));
|
| + }
|
| +
|
| + public static ProviderEchoEnumParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ProviderEchoEnumParams result = new ProviderEchoEnumParams();
|
| + DataHeader mainDataHeader = decoder0.readDataHeader();
|
| + if (mainDataHeader.numFields > 0) {
|
| + result.a = decoder0.readInt(8);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + @Override
|
| + protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
|
| + org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
|
| + encoder0.encode(a, 8);
|
| + }
|
| + }
|
| +
|
| + static final class ProviderEchoEnumResponseParams extends org.chromium.mojo.bindings.Struct {
|
| +
|
| + private static final int STRUCT_SIZE = 16;
|
| + private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 1);
|
| +
|
| + public int a;
|
| +
|
| + public ProviderEchoEnumResponseParams() {
|
| + super(STRUCT_SIZE);
|
| + }
|
| +
|
| + public static ProviderEchoEnumResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
|
| + return decode(new org.chromium.mojo.bindings.Decoder(message));
|
| + }
|
| +
|
| + public static ProviderEchoEnumResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ProviderEchoEnumResponseParams result = new ProviderEchoEnumResponseParams();
|
| + DataHeader mainDataHeader = decoder0.readDataHeader();
|
| + if (mainDataHeader.numFields > 0) {
|
| + result.a = decoder0.readInt(8);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + @Override
|
| + protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
|
| + org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
|
| + encoder0.encode(a, 8);
|
| + }
|
| + }
|
| +
|
| + static class ProviderEchoEnumResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
|
| + implements org.chromium.mojo.bindings.MessageReceiver {
|
| + private final Provider.EchoEnumResponse mCallback;
|
| +
|
| + ProviderEchoEnumResponseParamsForwardToCallback(Provider.EchoEnumResponse callback) {
|
| + this.mCallback = callback;
|
| + }
|
| +
|
| + @Override
|
| + public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) {
|
| + try {
|
| + org.chromium.mojo.bindings.MessageHeader header = message.getHeader();
|
| + if (!header.validateHeader(ECHO_ENUM_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
|
| + return false;
|
| + }
|
| + ProviderEchoEnumResponseParams response = ProviderEchoEnumResponseParams.deserialize(message.getPayload());
|
| + mCallback.call(response.a);
|
| + return true;
|
| + } catch (org.chromium.mojo.bindings.DeserializationException e) {
|
| + return false;
|
| + }
|
| + }
|
| + }
|
| +
|
| + static class ProviderEchoEnumResponseParamsProxyToResponder implements Provider.EchoEnumResponse {
|
| +
|
| + private final org.chromium.mojo.system.Core mCore;
|
| + private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
|
| + private final long mRequestId;
|
| +
|
| + ProviderEchoEnumResponseParamsProxyToResponder(
|
| + org.chromium.mojo.system.Core core,
|
| + org.chromium.mojo.bindings.MessageReceiver messageReceiver,
|
| + long requestId) {
|
| + mCore = core;
|
| + mMessageReceiver = messageReceiver;
|
| + mRequestId = requestId;
|
| + }
|
| +
|
| + @Override
|
| + public void call(Integer a) {
|
| + ProviderEchoEnumResponseParams response = new ProviderEchoEnumResponseParams();
|
| + response.a = a;
|
| + org.chromium.mojo.bindings.MessageWithHeader message =
|
| + response.serializeWithHeader(
|
| + mCore,
|
| + new org.chromium.mojo.bindings.MessageHeader(
|
| + ECHO_ENUM_ORDINAL,
|
| + org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
|
| + mRequestId));
|
| + mMessageReceiver.accept(message);
|
| + }
|
| + }
|
| +
|
| +}
|
| +
|
|
|