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 compositor_mojom; | 5 library compositor_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 import 'package:mojo_services/mojo/gfx/composition/renderers.mojom.dart' as rend
erers_mojom; | 10 import 'package:mojo_services/mojo/gfx/composition/renderers.mojom.dart' as rend
erers_mojom; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 dynamic getAllTypeDefinitions([Function responseFactory]) => | 281 dynamic getAllTypeDefinitions([Function responseFactory]) => |
282 responseFactory(null); | 282 responseFactory(null); |
283 } | 283 } |
284 | 284 |
285 abstract class Compositor { | 285 abstract class Compositor { |
286 static const String serviceName = "mojo::gfx::composition::Compositor"; | 286 static const String serviceName = "mojo::gfx::composition::Compositor"; |
287 dynamic createScene(Object scene,String label,[Function responseFactory = null
]); | 287 dynamic createScene(Object scene,String label,[Function responseFactory = null
]); |
288 void createRenderer(Object contextProvider, Object renderer, String label); | 288 void createRenderer(Object contextProvider, Object renderer, String label); |
289 } | 289 } |
290 | 290 |
291 | 291 class _CompositorProxyControl |
292 class _CompositorProxyControl extends bindings.ProxyMessageHandler | 292 extends bindings.ProxyMessageHandler |
293 implements bindings.ProxyControl { | 293 implements bindings.ProxyControl { |
294 _CompositorProxyControl.fromEndpoint( | 294 _CompositorProxyControl.fromEndpoint( |
295 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 295 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
296 | 296 |
297 _CompositorProxyControl.fromHandle( | 297 _CompositorProxyControl.fromHandle( |
298 core.MojoHandle handle) : super.fromHandle(handle); | 298 core.MojoHandle handle) : super.fromHandle(handle); |
299 | 299 |
300 _CompositorProxyControl.unbound() : super.unbound(); | 300 _CompositorProxyControl.unbound() : super.unbound(); |
301 | 301 |
302 service_describer.ServiceDescription get serviceDescription => | 302 service_describer.ServiceDescription get serviceDescription => |
303 new _CompositorServiceDescription(); | 303 new _CompositorServiceDescription(); |
304 | 304 |
305 String get serviceName => Compositor.serviceName; | 305 String get serviceName => Compositor.serviceName; |
306 | 306 |
307 @override | |
308 void handleResponse(bindings.ServiceMessage message) { | 307 void handleResponse(bindings.ServiceMessage message) { |
309 switch (message.header.type) { | 308 switch (message.header.type) { |
310 case _compositorMethodCreateSceneName: | 309 case _compositorMethodCreateSceneName: |
311 var r = CompositorCreateSceneResponseParams.deserialize( | 310 var r = CompositorCreateSceneResponseParams.deserialize( |
312 message.payload); | 311 message.payload); |
313 if (!message.header.hasRequestId) { | 312 if (!message.header.hasRequestId) { |
314 proxyError("Expected a message with a valid request Id."); | 313 proxyError("Expected a message with a valid request Id."); |
315 return; | 314 return; |
316 } | 315 } |
317 Completer c = completerMap[message.header.requestId]; | 316 Completer c = completerMap[message.header.requestId]; |
(...skipping 16 matching lines...) Expand all Loading... |
334 } | 333 } |
335 } | 334 } |
336 | 335 |
337 @override | 336 @override |
338 String toString() { | 337 String toString() { |
339 var superString = super.toString(); | 338 var superString = super.toString(); |
340 return "_CompositorProxyControl($superString)"; | 339 return "_CompositorProxyControl($superString)"; |
341 } | 340 } |
342 } | 341 } |
343 | 342 |
344 | 343 class CompositorProxy |
345 class CompositorProxy extends bindings.Proxy | 344 extends bindings.Proxy |
346 implements Compositor { | 345 implements Compositor { |
347 CompositorProxy.fromEndpoint( | 346 CompositorProxy.fromEndpoint( |
348 core.MojoMessagePipeEndpoint endpoint) | 347 core.MojoMessagePipeEndpoint endpoint) |
349 : super(new _CompositorProxyControl.fromEndpoint(endpoint)); | 348 : super(new _CompositorProxyControl.fromEndpoint(endpoint)); |
350 | 349 |
351 CompositorProxy.fromHandle(core.MojoHandle handle) | 350 CompositorProxy.fromHandle(core.MojoHandle handle) |
352 : super(new _CompositorProxyControl.fromHandle(handle)); | 351 : super(new _CompositorProxyControl.fromHandle(handle)); |
353 | 352 |
354 CompositorProxy.unbound() | 353 CompositorProxy.unbound() |
355 : super(new _CompositorProxyControl.unbound()); | 354 : super(new _CompositorProxyControl.unbound()); |
356 | 355 |
(...skipping 28 matching lines...) Expand all Loading... |
385 } | 384 } |
386 var params = new _CompositorCreateRendererParams(); | 385 var params = new _CompositorCreateRendererParams(); |
387 params.contextProvider = contextProvider; | 386 params.contextProvider = contextProvider; |
388 params.renderer = renderer; | 387 params.renderer = renderer; |
389 params.label = label; | 388 params.label = label; |
390 ctrl.sendMessage(params, | 389 ctrl.sendMessage(params, |
391 _compositorMethodCreateRendererName); | 390 _compositorMethodCreateRendererName); |
392 } | 391 } |
393 } | 392 } |
394 | 393 |
395 | 394 class _CompositorStubControl |
396 class CompositorStub extends bindings.Stub { | 395 extends bindings.StubMessageHandler |
| 396 implements bindings.StubControl<Compositor> { |
397 Compositor _impl; | 397 Compositor _impl; |
398 | 398 |
399 CompositorStub.fromEndpoint( | 399 _CompositorStubControl.fromEndpoint( |
400 core.MojoMessagePipeEndpoint endpoint, [Compositor impl]) | 400 core.MojoMessagePipeEndpoint endpoint, [Compositor impl]) |
401 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 401 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
402 _impl = impl; | 402 _impl = impl; |
403 } | 403 } |
404 | 404 |
405 CompositorStub.fromHandle( | 405 _CompositorStubControl.fromHandle( |
406 core.MojoHandle handle, [Compositor impl]) | 406 core.MojoHandle handle, [Compositor impl]) |
407 : super.fromHandle(handle, autoBegin: impl != null) { | 407 : super.fromHandle(handle, autoBegin: impl != null) { |
408 _impl = impl; | 408 _impl = impl; |
409 } | 409 } |
410 | 410 |
411 CompositorStub.unbound([this._impl]) : super.unbound(); | 411 _CompositorStubControl.unbound([this._impl]) : super.unbound(); |
412 | |
413 static CompositorStub newFromEndpoint( | |
414 core.MojoMessagePipeEndpoint endpoint) { | |
415 assert(endpoint.setDescription("For CompositorStub")); | |
416 return new CompositorStub.fromEndpoint(endpoint); | |
417 } | |
418 | 412 |
419 | 413 |
420 CompositorCreateSceneResponseParams _compositorCreateSceneResponseParamsFactor
y(scene_token_mojom.SceneToken sceneToken) { | 414 CompositorCreateSceneResponseParams _compositorCreateSceneResponseParamsFactor
y(scene_token_mojom.SceneToken sceneToken) { |
421 var result = new CompositorCreateSceneResponseParams(); | 415 var result = new CompositorCreateSceneResponseParams(); |
422 result.sceneToken = sceneToken; | 416 result.sceneToken = sceneToken; |
423 return result; | 417 return result; |
424 } | 418 } |
425 | 419 |
426 dynamic handleMessage(bindings.ServiceMessage message) { | 420 dynamic handleMessage(bindings.ServiceMessage message) { |
427 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 421 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 473 } |
480 | 474 |
481 @override | 475 @override |
482 void bind(core.MojoMessagePipeEndpoint endpoint) { | 476 void bind(core.MojoMessagePipeEndpoint endpoint) { |
483 super.bind(endpoint); | 477 super.bind(endpoint); |
484 if (!isOpen && (_impl != null)) { | 478 if (!isOpen && (_impl != null)) { |
485 beginHandlingEvents(); | 479 beginHandlingEvents(); |
486 } | 480 } |
487 } | 481 } |
488 | 482 |
| 483 @override |
489 String toString() { | 484 String toString() { |
490 var superString = super.toString(); | 485 var superString = super.toString(); |
491 return "CompositorStub($superString)"; | 486 return "_CompositorStubControl($superString)"; |
492 } | 487 } |
493 | 488 |
494 int get version => 0; | 489 int get version => 0; |
495 | 490 |
496 static service_describer.ServiceDescription _cachedServiceDescription; | 491 static service_describer.ServiceDescription _cachedServiceDescription; |
497 static service_describer.ServiceDescription get serviceDescription { | 492 static service_describer.ServiceDescription get serviceDescription { |
498 if (_cachedServiceDescription == null) { | 493 if (_cachedServiceDescription == null) { |
499 _cachedServiceDescription = new _CompositorServiceDescription(); | 494 _cachedServiceDescription = new _CompositorServiceDescription(); |
500 } | 495 } |
501 return _cachedServiceDescription; | 496 return _cachedServiceDescription; |
502 } | 497 } |
503 } | 498 } |
504 | 499 |
| 500 class CompositorStub |
| 501 extends bindings.Stub<Compositor> |
| 502 implements Compositor { |
| 503 CompositorStub.fromEndpoint( |
| 504 core.MojoMessagePipeEndpoint endpoint, [Compositor impl]) |
| 505 : super(new _CompositorStubControl.fromEndpoint(endpoint, impl)); |
| 506 |
| 507 CompositorStub.fromHandle( |
| 508 core.MojoHandle handle, [Compositor impl]) |
| 509 : super(new _CompositorStubControl.fromHandle(handle, impl)); |
| 510 |
| 511 CompositorStub.unbound([Compositor impl]) |
| 512 : super(new _CompositorStubControl.unbound(impl)); |
| 513 |
| 514 static CompositorStub newFromEndpoint( |
| 515 core.MojoMessagePipeEndpoint endpoint) { |
| 516 assert(endpoint.setDescription("For CompositorStub")); |
| 517 return new CompositorStub.fromEndpoint(endpoint); |
| 518 } |
| 519 |
| 520 static service_describer.ServiceDescription get serviceDescription => |
| 521 _CompositorStubControl.serviceDescription; |
| 522 |
| 523 |
| 524 dynamic createScene(Object scene,String label,[Function responseFactory = null
]) { |
| 525 return impl.createScene(scene,label,responseFactory); |
| 526 } |
| 527 void createRenderer(Object contextProvider, Object renderer, String label) { |
| 528 return impl.createRenderer(contextProvider, renderer, label); |
| 529 } |
| 530 } |
| 531 |
505 | 532 |
506 | 533 |
OLD | NEW |