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

Unified Diff: mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ServiceInternal.java

Issue 411913002: mojo: generate Proxies and Stubs for java bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Follow review. Created 6 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/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ServiceInternal.java
diff --git a/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ServiceInternal.java b/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ServiceInternal.java
new file mode 100644
index 0000000000000000000000000000000000000000..1d9d2350be16251eac94459f658fa1c4ab68384a
--- /dev/null
+++ b/mojo/not-to-commit/mojo_public_test_interfaces/src/org/chromium/mojo/bindings/test/mojom/sample/ServiceInternal.java
@@ -0,0 +1,190 @@
+// 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_service.mojom
+//
+
+package org.chromium.mojo.bindings.test.mojom.sample;
+
+class ServiceInternal {
+
+ public static final org.chromium.mojo.bindings.InterfaceWithClient.Manager<Service, Service.Proxy, ServiceClient> MANAGER =
+ new org.chromium.mojo.bindings.InterfaceWithClient.Manager<Service, Service.Proxy, ServiceClient>() {
+
+ 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, Service impl) {
+ return new Stub(core, impl);
+ }
+
+ public Service[] buildArray(int size) {
+ return new Service[size];
+ }
+
+ protected org.chromium.mojo.bindings.Interface.Manager<ServiceClient, ?> getClientManager() {
+ return ServiceClient.MANAGER;
+ }
+ };
+
+ private static final int FROBINATE_ORDINAL = 0;
+ private static final int GET_PORT_ORDINAL = 1;
+
+ static final class Proxy extends org.chromium.mojo.bindings.InterfaceWithClient.AbstractProxy<ServiceClient> implements Service.Proxy {
+
+ Proxy(org.chromium.mojo.system.Core core,
+ org.chromium.mojo.bindings.MessageReceiverWithResponder messageReceiver) {
+ super(core, messageReceiver);
+ }
+
+ @Override
+ public void frobinate(Foo foo, int baz, Port port) {
+ ServiceFrobinateParams message = new ServiceFrobinateParams();
+ message.foo = foo;
+ message.baz = baz;
+ message.port = port;
+ getMessageReceiver().accept(
+ message.serializeWithHeader(
+ getCore(),
+ new org.chromium.mojo.bindings.MessageHeader(FROBINATE_ORDINAL)));
+ }
+
+ @Override
+ public void getPort(org.chromium.mojo.bindings.InterfaceRequest<Port> port) {
+ ServiceGetPortParams message = new ServiceGetPortParams();
+ message.port = port;
+ getMessageReceiver().accept(
+ message.serializeWithHeader(
+ getCore(),
+ new org.chromium.mojo.bindings.MessageHeader(GET_PORT_ORDINAL)));
+ }
+
+ }
+
+ static final class Stub extends org.chromium.mojo.bindings.Interface.Stub<Service> {
+
+ Stub(org.chromium.mojo.system.Core core, Service impl) {
+ super(core, impl);
+ }
+
+ @Override
+ public boolean accept(org.chromium.mojo.bindings.MessageWithHeader message) {
+ try {
+ org.chromium.mojo.bindings.MessageHeader header = message.getHeader();
+ if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.NO_FLAG)) {
+ return false;
+ }
+ switch(header.getType()) {
+ case FROBINATE_ORDINAL: {
+ ServiceFrobinateParams data =
+ ServiceFrobinateParams.deserialize(message.getPayload());
+ getImpl().frobinate(data.foo, data.baz, data.port);
+ return true;
+ }
+ case GET_PORT_ORDINAL: {
+ ServiceGetPortParams data =
+ ServiceGetPortParams.deserialize(message.getPayload());
+ getImpl().getPort(data.port);
+ return true;
+ }
+ default:
+ return false;
+ }
+ } 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) {
+ return false;
+ }
+ }
+
+ static final class ServiceFrobinateParams extends org.chromium.mojo.bindings.Struct {
+
+ private static final int STRUCT_SIZE = 24;
+ private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_SIZE, 3);
+
+ public Foo foo;
+ public int baz;
+ public Port port;
+
+ public ServiceFrobinateParams() {
+ super(STRUCT_SIZE);
+ }
+
+ public static ServiceFrobinateParams deserialize(org.chromium.mojo.bindings.Message message) {
+ return decode(new org.chromium.mojo.bindings.Decoder(message));
+ }
+
+ public static ServiceFrobinateParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ServiceFrobinateParams result = new ServiceFrobinateParams();
+ DataHeader mainDataHeader = decoder0.readDataHeader();
+ if (mainDataHeader.numFields > 0) {
+ org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8);
+ result.foo = Foo.decode(decoder1);
+ }
+ if (mainDataHeader.numFields > 1) {
+ result.baz = decoder0.readInt(16);
+ }
+ if (mainDataHeader.numFields > 2) {
+ result.port = decoder0.readServiceInterface(20, Port.MANAGER);
+ }
+ 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(foo, 8);
+ encoder0.encode(baz, 16);
+ encoder0.encode(port, 20, Port.MANAGER);
+ }
+ }
+
+ static final class ServiceGetPortParams 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.bindings.InterfaceRequest<Port> port;
+
+ public ServiceGetPortParams() {
+ super(STRUCT_SIZE);
+ }
+
+ public static ServiceGetPortParams deserialize(org.chromium.mojo.bindings.Message message) {
+ return decode(new org.chromium.mojo.bindings.Decoder(message));
+ }
+
+ public static ServiceGetPortParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ ServiceGetPortParams result = new ServiceGetPortParams();
+ DataHeader mainDataHeader = decoder0.readDataHeader();
+ if (mainDataHeader.numFields > 0) {
+ result.port = decoder0.readInterfaceRequest(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(port, 8);
+ }
+ }
+
+}
+

Powered by Google App Engine
This is Rietveld 408576698