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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart

Issue 1449203002: Check in generated Dart bindings and add presubmit script (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ee107e2aef0516d4ecf0aa16d2a2240e5f622b1f
--- /dev/null
+++ b/mojo/dart/packages/mojo_services/lib/mojo/http_server.mojom.dart
@@ -0,0 +1,264 @@
+// 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.
+
+library http_server_mojom;
+
+import 'dart:async';
+
+import 'package:mojo/bindings.dart' as bindings;
+import 'package:mojo/core.dart' as core;
+import 'package:mojo_services/mojo/http_connection.mojom.dart' as http_connection_mojom;
+
+
+
+class HttpServerDelegateOnConnectedParams extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(24, 0)
+ ];
+ Object connection = null;
+ Object delegate = null;
+
+ HttpServerDelegateOnConnectedParams() : super(kVersions.last.size);
+
+ static HttpServerDelegateOnConnectedParams deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static HttpServerDelegateOnConnectedParams decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ HttpServerDelegateOnConnectedParams result = new HttpServerDelegateOnConnectedParams();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.connection = decoder0.decodeServiceInterface(8, false, http_connection_mojom.HttpConnectionProxy.newFromEndpoint);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.delegate = decoder0.decodeInterfaceRequest(16, false, http_connection_mojom.HttpConnectionDelegateStub.newFromEndpoint);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeInterface(connection, 8, false);
+
+ encoder0.encodeInterfaceRequest(delegate, 16, false);
+ }
+
+ String toString() {
+ return "HttpServerDelegateOnConnectedParams("
+ "connection: $connection" ", "
+ "delegate: $delegate" ")";
+ }
+
+ Map toJson() {
+ throw new bindings.MojoCodecError(
+ 'Object containing handles cannot be encoded to JSON.');
+ }
+}
+
+const int kHttpServerDelegate_onConnected_name = 0;
+
+const String HttpServerDelegateName =
+ 'mojo::HttpServerDelegate';
+
+abstract class HttpServerDelegate {
+ void onConnected(Object connection, Object delegate);
+
+}
+
+
+class HttpServerDelegateProxyImpl extends bindings.Proxy {
+ HttpServerDelegateProxyImpl.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
+
+ HttpServerDelegateProxyImpl.fromHandle(core.MojoHandle handle) :
+ super.fromHandle(handle);
+
+ HttpServerDelegateProxyImpl.unbound() : super.unbound();
+
+ static HttpServerDelegateProxyImpl newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For HttpServerDelegateProxyImpl"));
+ return new HttpServerDelegateProxyImpl.fromEndpoint(endpoint);
+ }
+
+ String get name => HttpServerDelegateName;
+
+ void handleResponse(bindings.ServiceMessage message) {
+ switch (message.header.type) {
+ default:
+ proxyError("Unexpected message type: ${message.header.type}");
+ close(immediate: true);
+ break;
+ }
+ }
+
+ String toString() {
+ var superString = super.toString();
+ return "HttpServerDelegateProxyImpl($superString)";
+ }
+}
+
+
+class _HttpServerDelegateProxyCalls implements HttpServerDelegate {
+ HttpServerDelegateProxyImpl _proxyImpl;
+
+ _HttpServerDelegateProxyCalls(this._proxyImpl);
+ void onConnected(Object connection, Object delegate) {
+ if (!_proxyImpl.isBound) {
+ _proxyImpl.proxyError("The Proxy is closed.");
+ return;
+ }
+ var params = new HttpServerDelegateOnConnectedParams();
+ params.connection = connection;
+ params.delegate = delegate;
+ _proxyImpl.sendMessage(params, kHttpServerDelegate_onConnected_name);
+ }
+
+}
+
+
+class HttpServerDelegateProxy implements bindings.ProxyBase {
+ final bindings.Proxy impl;
+ HttpServerDelegate ptr;
+ final String name = HttpServerDelegateName;
+
+ HttpServerDelegateProxy(HttpServerDelegateProxyImpl proxyImpl) :
+ impl = proxyImpl,
+ ptr = new _HttpServerDelegateProxyCalls(proxyImpl);
+
+ HttpServerDelegateProxy.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) :
+ impl = new HttpServerDelegateProxyImpl.fromEndpoint(endpoint) {
+ ptr = new _HttpServerDelegateProxyCalls(impl);
+ }
+
+ HttpServerDelegateProxy.fromHandle(core.MojoHandle handle) :
+ impl = new HttpServerDelegateProxyImpl.fromHandle(handle) {
+ ptr = new _HttpServerDelegateProxyCalls(impl);
+ }
+
+ HttpServerDelegateProxy.unbound() :
+ impl = new HttpServerDelegateProxyImpl.unbound() {
+ ptr = new _HttpServerDelegateProxyCalls(impl);
+ }
+
+ factory HttpServerDelegateProxy.connectToService(
+ bindings.ServiceConnector s, String url) {
+ HttpServerDelegateProxy p = new HttpServerDelegateProxy.unbound();
+ s.connectToService(url, p);
+ return p;
+ }
+
+ static HttpServerDelegateProxy newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For HttpServerDelegateProxy"));
+ return new HttpServerDelegateProxy.fromEndpoint(endpoint);
+ }
+
+ Future close({bool immediate: false}) => impl.close(immediate: immediate);
+
+ Future responseOrError(Future f) => impl.responseOrError(f);
+
+ Future get errorFuture => impl.errorFuture;
+
+ int get version => impl.version;
+
+ Future<int> queryVersion() => impl.queryVersion();
+
+ void requireVersion(int requiredVersion) {
+ impl.requireVersion(requiredVersion);
+ }
+
+ String toString() {
+ return "HttpServerDelegateProxy($impl)";
+ }
+}
+
+
+class HttpServerDelegateStub extends bindings.Stub {
+ HttpServerDelegate _impl = null;
+
+ HttpServerDelegateStub.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint, [this._impl])
+ : super.fromEndpoint(endpoint);
+
+ HttpServerDelegateStub.fromHandle(core.MojoHandle handle, [this._impl])
+ : super.fromHandle(handle);
+
+ HttpServerDelegateStub.unbound() : super.unbound();
+
+ static HttpServerDelegateStub newFromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint) {
+ assert(endpoint.setDescription("For HttpServerDelegateStub"));
+ return new HttpServerDelegateStub.fromEndpoint(endpoint);
+ }
+
+ static const String name = HttpServerDelegateName;
+
+
+
+ dynamic handleMessage(bindings.ServiceMessage message) {
+ if (bindings.ControlMessageHandler.isControlMessage(message)) {
+ return bindings.ControlMessageHandler.handleMessage(this,
+ 0,
+ message);
+ }
+ assert(_impl != null);
+ switch (message.header.type) {
+ case kHttpServerDelegate_onConnected_name:
+ var params = HttpServerDelegateOnConnectedParams.deserialize(
+ message.payload);
+ _impl.onConnected(params.connection, params.delegate);
+ break;
+ default:
+ throw new bindings.MojoCodecError("Unexpected message name");
+ break;
+ }
+ return null;
+ }
+
+ HttpServerDelegate get impl => _impl;
+ set impl(HttpServerDelegate d) {
+ assert(_impl == null);
+ _impl = d;
+ }
+
+ String toString() {
+ var superString = super.toString();
+ return "HttpServerDelegateStub($superString)";
+ }
+
+ int get version => 0;
+}
+
+

Powered by Google App Engine
This is Rietveld 408576698