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

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

Issue 1998433002: Dart: Adds Interface and InterfaceRequest interfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library icu_data_mojom; 5 library icu_data_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 161 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
162 responseFactory(null); 162 responseFactory(null);
163 163
164 dynamic getAllTypeDefinitions([Function responseFactory]) => 164 dynamic getAllTypeDefinitions([Function responseFactory]) =>
165 responseFactory(null); 165 responseFactory(null);
166 } 166 }
167 167
168 abstract class IcuData { 168 abstract class IcuData {
169 static const String serviceName = "icu_data::ICUData"; 169 static const String serviceName = "icu_data::ICUData";
170
171 static service_describer.ServiceDescription _cachedServiceDescription;
172 static service_describer.ServiceDescription get serviceDescription {
173 if (_cachedServiceDescription == null) {
174 _cachedServiceDescription = new _IcuDataServiceDescription();
175 }
176 return _cachedServiceDescription;
177 }
178
179 static IcuDataProxy connectToService(
180 bindings.ServiceConnector s, String url, [String serviceName]) {
181 IcuDataProxy p = new IcuDataProxy.unbound();
182 String name = serviceName ?? IcuData.serviceName;
183 if ((name == null) || name.isEmpty) {
184 throw new core.MojoApiError(
185 "If an interface has no ServiceName, then one must be provided.");
186 }
187 s.connectToService(url, p, name);
188 return p;
189 }
170 dynamic map(String sha1hash,[Function responseFactory = null]); 190 dynamic map(String sha1hash,[Function responseFactory = null]);
171 } 191 }
172 192
193 abstract class IcuDataInterface
194 implements bindings.MojoInterface<IcuData>,
195 IcuData {
196 factory IcuDataInterface([IcuData impl]) =>
197 new IcuDataStub.unbound(impl);
198 factory IcuDataInterface.fromEndpoint(
199 core.MojoMessagePipeEndpoint endpoint,
200 [IcuData impl]) =>
201 new IcuDataStub.fromEndpoint(endpoint, impl);
202 }
203
204 abstract class IcuDataInterfaceRequest
205 implements bindings.MojoInterface<IcuData>,
206 IcuData {
207 factory IcuDataInterfaceRequest() =>
208 new IcuDataProxy.unbound();
209 }
210
173 class _IcuDataProxyControl 211 class _IcuDataProxyControl
174 extends bindings.ProxyMessageHandler 212 extends bindings.ProxyMessageHandler
175 implements bindings.ProxyControl { 213 implements bindings.ProxyControl<IcuData> {
176 _IcuDataProxyControl.fromEndpoint( 214 _IcuDataProxyControl.fromEndpoint(
177 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 215 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
178 216
179 _IcuDataProxyControl.fromHandle( 217 _IcuDataProxyControl.fromHandle(
180 core.MojoHandle handle) : super.fromHandle(handle); 218 core.MojoHandle handle) : super.fromHandle(handle);
181 219
182 _IcuDataProxyControl.unbound() : super.unbound(); 220 _IcuDataProxyControl.unbound() : super.unbound();
183 221
184 service_describer.ServiceDescription get serviceDescription =>
185 new _IcuDataServiceDescription();
186
187 String get serviceName => IcuData.serviceName; 222 String get serviceName => IcuData.serviceName;
188 223
189 void handleResponse(bindings.ServiceMessage message) { 224 void handleResponse(bindings.ServiceMessage message) {
190 switch (message.header.type) { 225 switch (message.header.type) {
191 case _icuDataMethodMapName: 226 case _icuDataMethodMapName:
192 var r = IcuDataMapResponseParams.deserialize( 227 var r = IcuDataMapResponseParams.deserialize(
193 message.payload); 228 message.payload);
194 if (!message.header.hasRequestId) { 229 if (!message.header.hasRequestId) {
195 proxyError("Expected a message with a valid request Id."); 230 proxyError("Expected a message with a valid request Id.");
196 return; 231 return;
(...skipping 11 matching lines...) Expand all
208 } 243 }
209 c.complete(r); 244 c.complete(r);
210 break; 245 break;
211 default: 246 default:
212 proxyError("Unexpected message type: ${message.header.type}"); 247 proxyError("Unexpected message type: ${message.header.type}");
213 close(immediate: true); 248 close(immediate: true);
214 break; 249 break;
215 } 250 }
216 } 251 }
217 252
253 IcuData get impl => null;
254 set impl(IcuData _) {
255 throw new core.MojoApiError("The impl of a Proxy cannot be set.");
256 }
257
218 @override 258 @override
219 String toString() { 259 String toString() {
220 var superString = super.toString(); 260 var superString = super.toString();
221 return "_IcuDataProxyControl($superString)"; 261 return "_IcuDataProxyControl($superString)";
222 } 262 }
223 } 263 }
224 264
225 class IcuDataProxy 265 class IcuDataProxy
226 extends bindings.Proxy 266 extends bindings.Proxy<IcuData>
227 implements IcuData { 267 implements IcuData,
268 IcuDataInterface,
269 IcuDataInterfaceRequest {
228 IcuDataProxy.fromEndpoint( 270 IcuDataProxy.fromEndpoint(
229 core.MojoMessagePipeEndpoint endpoint) 271 core.MojoMessagePipeEndpoint endpoint)
230 : super(new _IcuDataProxyControl.fromEndpoint(endpoint)); 272 : super(new _IcuDataProxyControl.fromEndpoint(endpoint));
231 273
232 IcuDataProxy.fromHandle(core.MojoHandle handle) 274 IcuDataProxy.fromHandle(core.MojoHandle handle)
233 : super(new _IcuDataProxyControl.fromHandle(handle)); 275 : super(new _IcuDataProxyControl.fromHandle(handle));
234 276
235 IcuDataProxy.unbound() 277 IcuDataProxy.unbound()
236 : super(new _IcuDataProxyControl.unbound()); 278 : super(new _IcuDataProxyControl.unbound());
237 279
238 static IcuDataProxy newFromEndpoint( 280 static IcuDataProxy newFromEndpoint(
239 core.MojoMessagePipeEndpoint endpoint) { 281 core.MojoMessagePipeEndpoint endpoint) {
240 assert(endpoint.setDescription("For IcuDataProxy")); 282 assert(endpoint.setDescription("For IcuDataProxy"));
241 return new IcuDataProxy.fromEndpoint(endpoint); 283 return new IcuDataProxy.fromEndpoint(endpoint);
242 } 284 }
243 285
244 factory IcuDataProxy.connectToService(
245 bindings.ServiceConnector s, String url, [String serviceName]) {
246 IcuDataProxy p = new IcuDataProxy.unbound();
247 s.connectToService(url, p, serviceName);
248 return p;
249 }
250
251 286
252 dynamic map(String sha1hash,[Function responseFactory = null]) { 287 dynamic map(String sha1hash,[Function responseFactory = null]) {
253 var params = new _IcuDataMapParams(); 288 var params = new _IcuDataMapParams();
254 params.sha1hash = sha1hash; 289 params.sha1hash = sha1hash;
255 return ctrl.sendMessageWithRequestId( 290 return ctrl.sendMessageWithRequestId(
256 params, 291 params,
257 _icuDataMethodMapName, 292 _icuDataMethodMapName,
258 -1, 293 -1,
259 bindings.MessageHeader.kMessageExpectsResponse); 294 bindings.MessageHeader.kMessageExpectsResponse);
260 } 295 }
(...skipping 11 matching lines...) Expand all
272 } 307 }
273 308
274 _IcuDataStubControl.fromHandle( 309 _IcuDataStubControl.fromHandle(
275 core.MojoHandle handle, [IcuData impl]) 310 core.MojoHandle handle, [IcuData impl])
276 : super.fromHandle(handle, autoBegin: impl != null) { 311 : super.fromHandle(handle, autoBegin: impl != null) {
277 _impl = impl; 312 _impl = impl;
278 } 313 }
279 314
280 _IcuDataStubControl.unbound([this._impl]) : super.unbound(); 315 _IcuDataStubControl.unbound([this._impl]) : super.unbound();
281 316
317 String get serviceName => IcuData.serviceName;
318
282 319
283 IcuDataMapResponseParams _icuDataMapResponseParamsFactory(core.MojoSharedBuffe r icuData) { 320 IcuDataMapResponseParams _icuDataMapResponseParamsFactory(core.MojoSharedBuffe r icuData) {
284 var result = new IcuDataMapResponseParams(); 321 var result = new IcuDataMapResponseParams();
285 result.icuData = icuData; 322 result.icuData = icuData;
286 return result; 323 return result;
287 } 324 }
288 325
289 dynamic handleMessage(bindings.ServiceMessage message) { 326 dynamic handleMessage(bindings.ServiceMessage message) {
290 if (bindings.ControlMessageHandler.isControlMessage(message)) { 327 if (bindings.ControlMessageHandler.isControlMessage(message)) {
291 return bindings.ControlMessageHandler.handleMessage(this, 328 return bindings.ControlMessageHandler.handleMessage(this,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 381 }
345 } 382 }
346 383
347 @override 384 @override
348 String toString() { 385 String toString() {
349 var superString = super.toString(); 386 var superString = super.toString();
350 return "_IcuDataStubControl($superString)"; 387 return "_IcuDataStubControl($superString)";
351 } 388 }
352 389
353 int get version => 0; 390 int get version => 0;
354
355 static service_describer.ServiceDescription _cachedServiceDescription;
356 static service_describer.ServiceDescription get serviceDescription {
357 if (_cachedServiceDescription == null) {
358 _cachedServiceDescription = new _IcuDataServiceDescription();
359 }
360 return _cachedServiceDescription;
361 }
362 } 391 }
363 392
364 class IcuDataStub 393 class IcuDataStub
365 extends bindings.Stub<IcuData> 394 extends bindings.Stub<IcuData>
366 implements IcuData { 395 implements IcuData,
396 IcuDataInterface,
397 IcuDataInterfaceRequest {
398 IcuDataStub.unbound([IcuData impl])
399 : super(new _IcuDataStubControl.unbound(impl));
400
367 IcuDataStub.fromEndpoint( 401 IcuDataStub.fromEndpoint(
368 core.MojoMessagePipeEndpoint endpoint, [IcuData impl]) 402 core.MojoMessagePipeEndpoint endpoint, [IcuData impl])
369 : super(new _IcuDataStubControl.fromEndpoint(endpoint, impl)); 403 : super(new _IcuDataStubControl.fromEndpoint(endpoint, impl));
370 404
371 IcuDataStub.fromHandle( 405 IcuDataStub.fromHandle(
372 core.MojoHandle handle, [IcuData impl]) 406 core.MojoHandle handle, [IcuData impl])
373 : super(new _IcuDataStubControl.fromHandle(handle, impl)); 407 : super(new _IcuDataStubControl.fromHandle(handle, impl));
374 408
375 IcuDataStub.unbound([IcuData impl])
376 : super(new _IcuDataStubControl.unbound(impl));
377
378 static IcuDataStub newFromEndpoint( 409 static IcuDataStub newFromEndpoint(
379 core.MojoMessagePipeEndpoint endpoint) { 410 core.MojoMessagePipeEndpoint endpoint) {
380 assert(endpoint.setDescription("For IcuDataStub")); 411 assert(endpoint.setDescription("For IcuDataStub"));
381 return new IcuDataStub.fromEndpoint(endpoint); 412 return new IcuDataStub.fromEndpoint(endpoint);
382 } 413 }
383 414
384 static service_describer.ServiceDescription get serviceDescription =>
385 _IcuDataStubControl.serviceDescription;
386
387 415
388 dynamic map(String sha1hash,[Function responseFactory = null]) { 416 dynamic map(String sha1hash,[Function responseFactory = null]) {
389 return impl.map(sha1hash,responseFactory); 417 return impl.map(sha1hash,responseFactory);
390 } 418 }
391 } 419 }
392 420
393 421
394 422
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698