| OLD | NEW |
| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 impl.requireVersion(requiredVersion); | 294 impl.requireVersion(requiredVersion); |
| 295 } | 295 } |
| 296 | 296 |
| 297 String toString() { | 297 String toString() { |
| 298 return "IcuDataProxy($impl)"; | 298 return "IcuDataProxy($impl)"; |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 | 301 |
| 302 | 302 |
| 303 class IcuDataStub extends bindings.Stub { | 303 class IcuDataStub extends bindings.Stub { |
| 304 IcuData _impl = null; | 304 IcuData _impl; |
| 305 | 305 |
| 306 IcuDataStub.fromEndpoint( | 306 IcuDataStub.fromEndpoint( |
| 307 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 307 core.MojoMessagePipeEndpoint endpoint, [IcuData impl]) |
| 308 : super.fromEndpoint(endpoint); | 308 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 309 _impl = impl; |
| 310 } |
| 309 | 311 |
| 310 IcuDataStub.fromHandle(core.MojoHandle handle, [this._impl]) | 312 IcuDataStub.fromHandle( |
| 311 : super.fromHandle(handle); | 313 core.MojoHandle handle, [IcuData impl]) |
| 314 : super.fromHandle(handle, autoBegin: impl != null) { |
| 315 _impl = impl; |
| 316 } |
| 312 | 317 |
| 313 IcuDataStub.unbound() : super.unbound(); | 318 IcuDataStub.unbound() : super.unbound(); |
| 314 | 319 |
| 315 static IcuDataStub newFromEndpoint( | 320 static IcuDataStub newFromEndpoint( |
| 316 core.MojoMessagePipeEndpoint endpoint) { | 321 core.MojoMessagePipeEndpoint endpoint) { |
| 317 assert(endpoint.setDescription("For IcuDataStub")); | 322 assert(endpoint.setDescription("For IcuDataStub")); |
| 318 return new IcuDataStub.fromEndpoint(endpoint); | 323 return new IcuDataStub.fromEndpoint(endpoint); |
| 319 } | 324 } |
| 320 | 325 |
| 321 | 326 |
| 322 IcuDataMapResponseParams _icuDataMapResponseParamsFactory(core.MojoSharedBuffe
r icuData) { | 327 IcuDataMapResponseParams _icuDataMapResponseParamsFactory(core.MojoSharedBuffe
r icuData) { |
| 323 var result = new IcuDataMapResponseParams(); | 328 var result = new IcuDataMapResponseParams(); |
| 324 result.icuData = icuData; | 329 result.icuData = icuData; |
| 325 return result; | 330 return result; |
| 326 } | 331 } |
| 327 | 332 |
| 328 dynamic handleMessage(bindings.ServiceMessage message) { | 333 dynamic handleMessage(bindings.ServiceMessage message) { |
| 329 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 334 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 330 return bindings.ControlMessageHandler.handleMessage(this, | 335 return bindings.ControlMessageHandler.handleMessage(this, |
| 331 0, | 336 0, |
| 332 message); | 337 message); |
| 333 } | 338 } |
| 334 assert(_impl != null); | 339 if (_impl == null) { |
| 340 throw new core.MojoApiError("$this has no implementation set"); |
| 341 } |
| 335 switch (message.header.type) { | 342 switch (message.header.type) { |
| 336 case _icuDataMethodMapName: | 343 case _icuDataMethodMapName: |
| 337 var params = _IcuDataMapParams.deserialize( | 344 var params = _IcuDataMapParams.deserialize( |
| 338 message.payload); | 345 message.payload); |
| 339 var response = _impl.map(params.sha1hash,_icuDataMapResponseParamsFactor
y); | 346 var response = _impl.map(params.sha1hash,_icuDataMapResponseParamsFactor
y); |
| 340 if (response is Future) { | 347 if (response is Future) { |
| 341 return response.then((response) { | 348 return response.then((response) { |
| 342 if (response != null) { | 349 if (response != null) { |
| 343 return buildResponseWithId( | 350 return buildResponseWithId( |
| 344 response, | 351 response, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 357 break; | 364 break; |
| 358 default: | 365 default: |
| 359 throw new bindings.MojoCodecError("Unexpected message name"); | 366 throw new bindings.MojoCodecError("Unexpected message name"); |
| 360 break; | 367 break; |
| 361 } | 368 } |
| 362 return null; | 369 return null; |
| 363 } | 370 } |
| 364 | 371 |
| 365 IcuData get impl => _impl; | 372 IcuData get impl => _impl; |
| 366 set impl(IcuData d) { | 373 set impl(IcuData d) { |
| 367 assert(_impl == null); | 374 if (d == null) { |
| 375 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 376 } |
| 377 if (isBound && (_impl == null)) { |
| 378 beginHandlingEvents(); |
| 379 } |
| 368 _impl = d; | 380 _impl = d; |
| 369 } | 381 } |
| 370 | 382 |
| 383 @override |
| 384 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 385 super.bind(endpoint); |
| 386 if (!isOpen && (_impl != null)) { |
| 387 beginHandlingEvents(); |
| 388 } |
| 389 } |
| 390 |
| 371 String toString() { | 391 String toString() { |
| 372 var superString = super.toString(); | 392 var superString = super.toString(); |
| 373 return "IcuDataStub($superString)"; | 393 return "IcuDataStub($superString)"; |
| 374 } | 394 } |
| 375 | 395 |
| 376 int get version => 0; | 396 int get version => 0; |
| 377 | 397 |
| 378 static service_describer.ServiceDescription _cachedServiceDescription; | 398 static service_describer.ServiceDescription _cachedServiceDescription; |
| 379 static service_describer.ServiceDescription get serviceDescription { | 399 static service_describer.ServiceDescription get serviceDescription { |
| 380 if (_cachedServiceDescription == null) { | 400 if (_cachedServiceDescription == null) { |
| 381 _cachedServiceDescription = new _IcuDataServiceDescription(); | 401 _cachedServiceDescription = new _IcuDataServiceDescription(); |
| 382 } | 402 } |
| 383 return _cachedServiceDescription; | 403 return _cachedServiceDescription; |
| 384 } | 404 } |
| 385 } | 405 } |
| 386 | 406 |
| 387 | 407 |
| 388 | 408 |
| OLD | NEW |