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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/media/media_clock.mojom.dart

Issue 1509323002: Mojom updates for Motown. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 library media_clock_mojom;
6
7 import 'dart:async';
8
9 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core;
11 class ClockDisposition extends bindings.MojoEnum {
12 static const PASSIVE = const ClockDisposition._(0);
13 static const SLAVE = const ClockDisposition._(1);
14 static const PREFER_SLAVE = const ClockDisposition._(2);
15 static const INDIFFERENT = const ClockDisposition._(3);
16 static const PREFER_MASTER = const ClockDisposition._(4);
17 static const MASTER = const ClockDisposition._(5);
18
19 const ClockDisposition._(int v) : super(v);
20
21 static const Map<String, ClockDisposition> valuesMap = const {
22 "PASSIVE": PASSIVE,
23 "SLAVE": SLAVE,
24 "PREFER_SLAVE": PREFER_SLAVE,
25 "INDIFFERENT": INDIFFERENT,
26 "PREFER_MASTER": PREFER_MASTER,
27 "MASTER": MASTER,
28 };
29 static const List<ClockDisposition> values = const [
30 PASSIVE,
31 SLAVE,
32 PREFER_SLAVE,
33 INDIFFERENT,
34 PREFER_MASTER,
35 MASTER,
36 ];
37
38 static ClockDisposition valueOf(String name) => valuesMap[name];
39
40 factory ClockDisposition(int v) {
41 switch (v) {
42 case 0:
43 return PASSIVE;
44 case 1:
45 return SLAVE;
46 case 2:
47 return PREFER_SLAVE;
48 case 3:
49 return INDIFFERENT;
50 case 4:
51 return PREFER_MASTER;
52 case 5:
53 return MASTER;
54 default:
55 return null;
56 }
57 }
58
59 static ClockDisposition decode(bindings.Decoder decoder0, int offset) {
60 int v = decoder0.decodeUint32(offset);
61 ClockDisposition result = new ClockDisposition(v);
62 if (result == null) {
63 throw new bindings.MojoCodecError(
64 'Bad value $v for enum ClockDisposition.');
65 }
66 return result;
67 }
68
69 String toString() {
70 switch(this) {
71 case PASSIVE:
72 return 'ClockDisposition.PASSIVE';
73 case SLAVE:
74 return 'ClockDisposition.SLAVE';
75 case PREFER_SLAVE:
76 return 'ClockDisposition.PREFER_SLAVE';
77 case INDIFFERENT:
78 return 'ClockDisposition.INDIFFERENT';
79 case PREFER_MASTER:
80 return 'ClockDisposition.PREFER_MASTER';
81 case MASTER:
82 return 'ClockDisposition.MASTER';
83 }
84 }
85
86 int toJson() => value;
87 }
88
89
90 const String ClockName = null;
91
92 abstract class Clock {
93
94 }
95
96
97 class ClockProxyImpl extends bindings.Proxy {
98 ClockProxyImpl.fromEndpoint(
99 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
100
101 ClockProxyImpl.fromHandle(core.MojoHandle handle) :
102 super.fromHandle(handle);
103
104 ClockProxyImpl.unbound() : super.unbound();
105
106 static ClockProxyImpl newFromEndpoint(
107 core.MojoMessagePipeEndpoint endpoint) {
108 assert(endpoint.setDescription("For ClockProxyImpl"));
109 return new ClockProxyImpl.fromEndpoint(endpoint);
110 }
111
112 String get name => ClockName;
113
114 void handleResponse(bindings.ServiceMessage message) {
115 switch (message.header.type) {
116 default:
117 proxyError("Unexpected message type: ${message.header.type}");
118 close(immediate: true);
119 break;
120 }
121 }
122
123 String toString() {
124 var superString = super.toString();
125 return "ClockProxyImpl($superString)";
126 }
127 }
128
129
130 class _ClockProxyCalls implements Clock {
131 ClockProxyImpl _proxyImpl;
132
133 _ClockProxyCalls(this._proxyImpl);
134 }
135
136
137 class ClockProxy implements bindings.ProxyBase {
138 final bindings.Proxy impl;
139 Clock ptr;
140 final String name = ClockName;
141
142 ClockProxy(ClockProxyImpl proxyImpl) :
143 impl = proxyImpl,
144 ptr = new _ClockProxyCalls(proxyImpl);
145
146 ClockProxy.fromEndpoint(
147 core.MojoMessagePipeEndpoint endpoint) :
148 impl = new ClockProxyImpl.fromEndpoint(endpoint) {
149 ptr = new _ClockProxyCalls(impl);
150 }
151
152 ClockProxy.fromHandle(core.MojoHandle handle) :
153 impl = new ClockProxyImpl.fromHandle(handle) {
154 ptr = new _ClockProxyCalls(impl);
155 }
156
157 ClockProxy.unbound() :
158 impl = new ClockProxyImpl.unbound() {
159 ptr = new _ClockProxyCalls(impl);
160 }
161
162 factory ClockProxy.connectToService(
163 bindings.ServiceConnector s, String url) {
164 ClockProxy p = new ClockProxy.unbound();
165 s.connectToService(url, p);
166 return p;
167 }
168
169 static ClockProxy newFromEndpoint(
170 core.MojoMessagePipeEndpoint endpoint) {
171 assert(endpoint.setDescription("For ClockProxy"));
172 return new ClockProxy.fromEndpoint(endpoint);
173 }
174
175 Future close({bool immediate: false}) => impl.close(immediate: immediate);
176
177 Future responseOrError(Future f) => impl.responseOrError(f);
178
179 Future get errorFuture => impl.errorFuture;
180
181 int get version => impl.version;
182
183 Future<int> queryVersion() => impl.queryVersion();
184
185 void requireVersion(int requiredVersion) {
186 impl.requireVersion(requiredVersion);
187 }
188
189 String toString() {
190 return "ClockProxy($impl)";
191 }
192 }
193
194
195 class ClockStub extends bindings.Stub {
196 Clock _impl = null;
197
198 ClockStub.fromEndpoint(
199 core.MojoMessagePipeEndpoint endpoint, [this._impl])
200 : super.fromEndpoint(endpoint);
201
202 ClockStub.fromHandle(core.MojoHandle handle, [this._impl])
203 : super.fromHandle(handle);
204
205 ClockStub.unbound() : super.unbound();
206
207 static ClockStub newFromEndpoint(
208 core.MojoMessagePipeEndpoint endpoint) {
209 assert(endpoint.setDescription("For ClockStub"));
210 return new ClockStub.fromEndpoint(endpoint);
211 }
212
213 static const String name = ClockName;
214
215
216
217 dynamic handleMessage(bindings.ServiceMessage message) {
218 if (bindings.ControlMessageHandler.isControlMessage(message)) {
219 return bindings.ControlMessageHandler.handleMessage(this,
220 0,
221 message);
222 }
223 assert(_impl != null);
224 switch (message.header.type) {
225 default:
226 throw new bindings.MojoCodecError("Unexpected message name");
227 break;
228 }
229 return null;
230 }
231
232 Clock get impl => _impl;
233 set impl(Clock d) {
234 assert(_impl == null);
235 _impl = d;
236 }
237
238 String toString() {
239 var superString = super.toString();
240 return "ClockStub($superString)";
241 }
242
243 int get version => 0;
244 }
245
246
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698