Index: mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/NamedObjectInternal.java |
diff --git a/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/NamedObjectInternal.java b/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/NamedObjectInternal.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..66638bc72304076f9555921b57de4a8863a6820e |
--- /dev/null |
+++ b/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/NamedObjectInternal.java |
@@ -0,0 +1,265 @@ |
+// 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_factory.mojom |
+// |
+ |
+package org.chromium.mojo.bindings.test.mojom.sample; |
+ |
+class NamedObjectInternal { |
+ |
+ public static final org.chromium.mojo.bindings.Interface.Builder<NamedObject, NamedObject.Proxy> BUILDER = |
+ new org.chromium.mojo.bindings.Interface.Builder<NamedObject, NamedObject.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, NamedObject impl) { |
+ return new Stub(core, impl); |
+ } |
+ |
+ public NamedObject[] newArray(int size) { |
+ return new NamedObject[size]; |
+ } |
+ }; |
+ |
+ private static final int SET_NAME_ORDINAL = 0; |
+ private static final int GET_NAME_ORDINAL = 1; |
+ |
+ static final class Proxy extends org.chromium.mojo.bindings.Interface.BaseProxy implements NamedObject.Proxy { |
+ |
+ Proxy(org.chromium.mojo.system.Core core, |
+ org.chromium.mojo.bindings.MessageReceiverWithResponder messageReceiver) { |
+ super(core, messageReceiver); |
+ } |
+ |
+ @Override |
+ public void setName(String name) { |
+ NamedObjectSetNameParams message = new NamedObjectSetNameParams(); |
+ message.name = name; |
+ getMessageReceiver().accept( |
+ message.serializeWithHeader( |
+ getCore(), |
+ new org.chromium.mojo.bindings.MessageHeader(SET_NAME_ORDINAL))); |
+ } |
+ |
+ @Override |
+ public void getName(GetNameResponse callback) { |
+ NamedObjectGetNameParams message = new NamedObjectGetNameParams(); |
+ getMessageReceiver().acceptWithResponder( |
+ message.serializeWithHeader( |
+ getCore(), |
+ new org.chromium.mojo.bindings.MessageHeader( |
+ GET_NAME_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG, |
+ 0)), |
+ new NamedObjectGetNameResponseParamsForwardToCallback(callback)); |
+ } |
+ |
+ } |
+ |
+ static final class Stub extends org.chromium.mojo.bindings.Interface.Stub<NamedObject> { |
+ |
+ Stub(org.chromium.mojo.system.Core core, NamedObject impl) { |
+ super(core, impl); |
+ } |
+ |
+ @Override |
+ public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) { |
+ try { |
+ org.chromium.mojo.bindings.MessageHeader header = message.getHeader(); |
+ switch(header.getType()) { |
+ case SET_NAME_ORDINAL: { |
+ if (!header.validateHeader(0)) { |
+ return false; |
+ } |
+ NamedObjectSetNameParams data = |
+ NamedObjectSetNameParams.deserialize(message.getPayload()); |
+ getImpl().setName(data.name); |
+ return true; |
+ } |
+ } |
+ } catch (org.chromium.mojo.bindings.DeserializationException e) { |
+ } |
+ 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 GET_NAME_ORDINAL: { |
+ if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG)) { |
+ return false; |
+ } |
+ NamedObjectGetNameParams.deserialize(message.getPayload()); |
+ getImpl().getName(new NamedObjectGetNameResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId())); |
+ return true; |
+ } |
+ } |
+ } catch (org.chromium.mojo.bindings.DeserializationException e) { |
+ } |
+ return false; |
+ } |
+ } |
+ |
+ static final class NamedObjectSetNameParams 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 name; |
+ |
+ public NamedObjectSetNameParams() { |
+ super(STRUCT_SIZE); |
+ } |
+ |
+ public static NamedObjectSetNameParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static NamedObjectSetNameParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ NamedObjectSetNameParams result = new NamedObjectSetNameParams(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ result.name = 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(name, 8); |
+ } |
+ } |
+ |
+ static final class NamedObjectGetNameParams extends org.chromium.mojo.bindings.Struct { |
+ |
+ private static final int STRUCT_SIZE = 8; |
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 0); |
+ |
+ public NamedObjectGetNameParams() { |
+ super(STRUCT_SIZE); |
+ } |
+ |
+ public static NamedObjectGetNameParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static NamedObjectGetNameParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ NamedObjectGetNameParams result = new NamedObjectGetNameParams(); |
+ decoder0.readDataHeader(); |
+ return result; |
+ } |
+ |
+ @Override |
+ protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { |
+ encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO); |
+ } |
+ } |
+ |
+ static final class NamedObjectGetNameResponseParams 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 name; |
+ |
+ public NamedObjectGetNameResponseParams() { |
+ super(STRUCT_SIZE); |
+ } |
+ |
+ public static NamedObjectGetNameResponseParams deserialize(org.chromium.mojo.bindings.Message message) { |
+ return decode(new org.chromium.mojo.bindings.Decoder(message)); |
+ } |
+ |
+ public static NamedObjectGetNameResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ NamedObjectGetNameResponseParams result = new NamedObjectGetNameResponseParams(); |
+ DataHeader mainDataHeader = decoder0.readDataHeader(); |
+ if (mainDataHeader.numFields > 0) { |
+ result.name = 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(name, 8); |
+ } |
+ } |
+ |
+ static class NamedObjectGetNameResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable |
+ implements org.chromium.mojo.bindings.MessageReceiver { |
+ private final NamedObject.GetNameResponse mCallback; |
+ |
+ NamedObjectGetNameResponseParamsForwardToCallback(NamedObject.GetNameResponse 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(GET_NAME_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) { |
+ return false; |
+ } |
+ NamedObjectGetNameResponseParams response = NamedObjectGetNameResponseParams.deserialize(message.getPayload()); |
+ mCallback.call(response.name); |
+ return true; |
+ } catch (org.chromium.mojo.bindings.DeserializationException e) { |
+ return false; |
+ } |
+ } |
+ } |
+ |
+ static class NamedObjectGetNameResponseParamsProxyToResponder implements NamedObject.GetNameResponse { |
+ |
+ private final org.chromium.mojo.system.Core mCore; |
+ private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver; |
+ private final long mRequestId; |
+ |
+ NamedObjectGetNameResponseParamsProxyToResponder( |
+ 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 name) { |
+ NamedObjectGetNameResponseParams response = new NamedObjectGetNameResponseParams(); |
+ response.name = name; |
+ org.chromium.mojo.bindings.MessageWithHeader message = |
+ response.serializeWithHeader( |
+ mCore, |
+ new org.chromium.mojo.bindings.MessageHeader( |
+ GET_NAME_ORDINAL, |
+ org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG, |
+ mRequestId)); |
+ mMessageReceiver.accept(message); |
+ } |
+ } |
+ |
+} |
+ |