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 display_mojom; | 5 library display_mojom; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:mojo/bindings.dart' as bindings; | 9 import 'package:mojo/bindings.dart' as bindings; |
10 import 'package:mojo/core.dart' as core; | 10 import 'package:mojo/core.dart' as core; |
| 11 import 'package:mojo/mojo/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/service_describer.mojom.dart' as service_describer; |
11 import 'package:mojo_services/mojo/context_provider.mojom.dart' as context_provi
der_mojom; | 13 import 'package:mojo_services/mojo/context_provider.mojom.dart' as context_provi
der_mojom; |
12 import 'package:mojo_services/mojo/viewport_parameter_listener.mojom.dart' as vi
ewport_parameter_listener_mojom; | 14 import 'package:mojo_services/mojo/viewport_parameter_listener.mojom.dart' as vi
ewport_parameter_listener_mojom; |
13 import 'package:mojo_services/mojo/surfaces.mojom.dart' as surfaces_mojom; | 15 import 'package:mojo_services/mojo/surfaces.mojom.dart' as surfaces_mojom; |
14 | 16 |
15 | 17 |
16 | 18 |
17 class DisplaySubmitFrameParams extends bindings.Struct { | 19 class DisplaySubmitFrameParams extends bindings.Struct { |
18 static const List<bindings.StructDataHeader> kVersions = const [ | 20 static const List<bindings.StructDataHeader> kVersions = const [ |
19 const bindings.StructDataHeader(16, 0) | 21 const bindings.StructDataHeader(16, 0) |
20 ]; | 22 ]; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 "frame: $frame" ")"; | 76 "frame: $frame" ")"; |
75 } | 77 } |
76 | 78 |
77 Map toJson() { | 79 Map toJson() { |
78 Map map = new Map(); | 80 Map map = new Map(); |
79 map["frame"] = frame; | 81 map["frame"] = frame; |
80 return map; | 82 return map; |
81 } | 83 } |
82 } | 84 } |
83 | 85 |
| 86 mojom_types.MojomStruct _display_Display_SubmitFrame_Params__() { |
| 87 return new mojom_types.MojomStruct() |
| 88 ..declData = (new mojom_types.DeclarationData()..shortName = 'DisplaySubmitF
rameParams') |
| 89 ..fields = <mojom_types.StructField>[ |
| 90 new mojom_types.StructField() |
| 91 ..declData = (new mojom_types.DeclarationData()..shortName = 'Frame') |
| 92 ..type = (new mojom_types.Type() |
| 93 ..typeReference = (new mojom_types.TypeReference() |
| 94 |
| 95 ..identifier = '_surfaces_Frame__' |
| 96 ..typeKey = '_surfaces_Frame__' |
| 97 )), |
| 98 ]; |
| 99 } |
| 100 |
84 | 101 |
85 class DisplaySubmitFrameResponseParams extends bindings.Struct { | 102 class DisplaySubmitFrameResponseParams extends bindings.Struct { |
86 static const List<bindings.StructDataHeader> kVersions = const [ | 103 static const List<bindings.StructDataHeader> kVersions = const [ |
87 const bindings.StructDataHeader(8, 0) | 104 const bindings.StructDataHeader(8, 0) |
88 ]; | 105 ]; |
89 | 106 |
90 DisplaySubmitFrameResponseParams() : super(kVersions.last.size); | 107 DisplaySubmitFrameResponseParams() : super(kVersions.last.size); |
91 | 108 |
92 static DisplaySubmitFrameResponseParams deserialize(bindings.Message message)
{ | 109 static DisplaySubmitFrameResponseParams deserialize(bindings.Message message)
{ |
93 var decoder = new bindings.Decoder(message); | 110 var decoder = new bindings.Decoder(message); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 String toString() { | 149 String toString() { |
133 return "DisplaySubmitFrameResponseParams("")"; | 150 return "DisplaySubmitFrameResponseParams("")"; |
134 } | 151 } |
135 | 152 |
136 Map toJson() { | 153 Map toJson() { |
137 Map map = new Map(); | 154 Map map = new Map(); |
138 return map; | 155 return map; |
139 } | 156 } |
140 } | 157 } |
141 | 158 |
| 159 mojom_types.MojomStruct _display_Display_SubmitFrame_ResponseParams__() { |
| 160 return new mojom_types.MojomStruct() |
| 161 ..declData = (new mojom_types.DeclarationData()..shortName = 'DisplaySubmitF
rameResponseParams') |
| 162 ..fields = <mojom_types.StructField>[]; |
| 163 } |
| 164 |
142 | 165 |
143 class DisplayFactoryCreateParams extends bindings.Struct { | 166 class DisplayFactoryCreateParams extends bindings.Struct { |
144 static const List<bindings.StructDataHeader> kVersions = const [ | 167 static const List<bindings.StructDataHeader> kVersions = const [ |
145 const bindings.StructDataHeader(32, 0) | 168 const bindings.StructDataHeader(32, 0) |
146 ]; | 169 ]; |
147 Object contextProvider = null; | 170 Object contextProvider = null; |
148 Object returner = null; | 171 Object returner = null; |
149 Object displayRequest = null; | 172 Object displayRequest = null; |
150 | 173 |
151 DisplayFactoryCreateParams() : super(kVersions.last.size); | 174 DisplayFactoryCreateParams() : super(kVersions.last.size); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 "returner: $returner" ", " | 237 "returner: $returner" ", " |
215 "displayRequest: $displayRequest" ")"; | 238 "displayRequest: $displayRequest" ")"; |
216 } | 239 } |
217 | 240 |
218 Map toJson() { | 241 Map toJson() { |
219 throw new bindings.MojoCodecError( | 242 throw new bindings.MojoCodecError( |
220 'Object containing handles cannot be encoded to JSON.'); | 243 'Object containing handles cannot be encoded to JSON.'); |
221 } | 244 } |
222 } | 245 } |
223 | 246 |
| 247 mojom_types.MojomStruct _display_DisplayFactory_Create_Params__() { |
| 248 return new mojom_types.MojomStruct() |
| 249 ..declData = (new mojom_types.DeclarationData()..shortName = 'DisplayFactory
CreateParams') |
| 250 ..fields = <mojom_types.StructField>[ |
| 251 new mojom_types.StructField() |
| 252 ..declData = (new mojom_types.DeclarationData()..shortName = 'ContextPro
vider') |
| 253 ..type = (new mojom_types.Type() |
| 254 ..typeReference = (new mojom_types.TypeReference() |
| 255 |
| 256 ..identifier = '_context_provider_ContextProvider__' |
| 257 ..typeKey = '_context_provider_ContextProvider__' |
| 258 )), |
| 259 |
| 260 new mojom_types.StructField() |
| 261 ..declData = (new mojom_types.DeclarationData()..shortName = 'Returner') |
| 262 ..type = (new mojom_types.Type() |
| 263 ..typeReference = (new mojom_types.TypeReference() |
| 264 ..nullable = true |
| 265 |
| 266 |
| 267 ..identifier = '_surfaces_ResourceReturner__' |
| 268 ..typeKey = '_surfaces_ResourceReturner__' |
| 269 )), |
| 270 |
| 271 new mojom_types.StructField() |
| 272 ..declData = (new mojom_types.DeclarationData()..shortName = 'DisplayReq
uest') |
| 273 ..type = (new mojom_types.Type() |
| 274 ..typeReference = (new mojom_types.TypeReference() |
| 275 |
| 276 ..isInterfaceRequest = true |
| 277 ..identifier = '_display_Display__' |
| 278 ..typeKey = '_display_Display__' |
| 279 )), |
| 280 ]; |
| 281 } |
| 282 |
| 283 |
224 const int kDisplay_submitFrame_name = 0; | 284 const int kDisplay_submitFrame_name = 0; |
225 | 285 |
226 const String DisplayName = | 286 const String DisplayName = |
227 'mojo::Display'; | 287 'mojo::Display'; |
228 | 288 |
| 289 mojom_types.MojomInterface _display_Display__() { |
| 290 return new mojom_types.MojomInterface() |
| 291 ..declData = (new mojom_types.DeclarationData()..shortName = "Display") |
| 292 ..interfaceName = "Display" |
| 293 ..methods = <int, mojom_types.MojomMethod>{ |
| 294 kDisplay_submitFrame_name: new mojom_types.MojomMethod() |
| 295 ..declData = (new mojom_types.DeclarationData()..shortName = "SubmitFram
e") |
| 296 ..ordinal = kDisplay_submitFrame_name |
| 297 ..responseParams = _display_Display_SubmitFrame_ResponseParams__()..para
meters = _display_Display_SubmitFrame_Params__(), |
| 298 }; |
| 299 } |
| 300 |
| 301 class _DisplayServiceDescription extends service_describer.ServiceDescription { |
| 302 // Avoid infinite loop by overriding serviceDescription field. |
| 303 final service_describer.ServiceDescription serviceDescription = null; |
| 304 dynamic getTopLevelInterface([Function responseFactory = null]) { |
| 305 return _display_Display__(); |
| 306 } |
| 307 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
| 308 return getAllMojomTypeDefinitions()[typeKey]; |
| 309 } |
| 310 dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
| 311 return getAllMojomTypeDefinitions(); |
| 312 } |
| 313 } |
| 314 |
229 abstract class Display { | 315 abstract class Display { |
230 dynamic submitFrame(surfaces_mojom.Frame frame,[Function responseFactory = nul
l]); | 316 dynamic submitFrame(surfaces_mojom.Frame frame,[Function responseFactory = nul
l]); |
231 | 317 |
232 } | 318 } |
233 | 319 |
234 | 320 |
235 class DisplayProxyImpl extends bindings.Proxy { | 321 class DisplayProxyImpl extends bindings.Proxy { |
236 DisplayProxyImpl.fromEndpoint( | 322 DisplayProxyImpl.fromEndpoint( |
237 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 323 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
238 | 324 |
239 DisplayProxyImpl.fromHandle(core.MojoHandle handle) : | 325 DisplayProxyImpl.fromHandle(core.MojoHandle handle) : |
240 super.fromHandle(handle); | 326 super.fromHandle(handle); |
241 | 327 |
242 DisplayProxyImpl.unbound() : super.unbound(); | 328 DisplayProxyImpl.unbound() : super.unbound(); |
243 | 329 |
244 static DisplayProxyImpl newFromEndpoint( | 330 static DisplayProxyImpl newFromEndpoint( |
245 core.MojoMessagePipeEndpoint endpoint) { | 331 core.MojoMessagePipeEndpoint endpoint) { |
246 assert(endpoint.setDescription("For DisplayProxyImpl")); | 332 assert(endpoint.setDescription("For DisplayProxyImpl")); |
247 return new DisplayProxyImpl.fromEndpoint(endpoint); | 333 return new DisplayProxyImpl.fromEndpoint(endpoint); |
248 } | 334 } |
249 | 335 |
250 String get name => DisplayName; | 336 String get name => DisplayName; |
251 | 337 |
| 338 service_describer.ServiceDescription get serviceDescription => |
| 339 new _DisplayServiceDescription(); |
| 340 |
252 void handleResponse(bindings.ServiceMessage message) { | 341 void handleResponse(bindings.ServiceMessage message) { |
253 switch (message.header.type) { | 342 switch (message.header.type) { |
254 case kDisplay_submitFrame_name: | 343 case kDisplay_submitFrame_name: |
255 var r = DisplaySubmitFrameResponseParams.deserialize( | 344 var r = DisplaySubmitFrameResponseParams.deserialize( |
256 message.payload); | 345 message.payload); |
257 if (!message.header.hasRequestId) { | 346 if (!message.header.hasRequestId) { |
258 proxyError("Expected a message with a valid request Id."); | 347 proxyError("Expected a message with a valid request Id."); |
259 return; | 348 return; |
260 } | 349 } |
261 Completer c = completerMap[message.header.requestId]; | 350 Completer c = completerMap[message.header.requestId]; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 assert(_impl == null); | 516 assert(_impl == null); |
428 _impl = d; | 517 _impl = d; |
429 } | 518 } |
430 | 519 |
431 String toString() { | 520 String toString() { |
432 var superString = super.toString(); | 521 var superString = super.toString(); |
433 return "DisplayStub($superString)"; | 522 return "DisplayStub($superString)"; |
434 } | 523 } |
435 | 524 |
436 int get version => 0; | 525 int get version => 0; |
| 526 |
| 527 service_describer.ServiceDescription get serviceDescription => |
| 528 new _DisplayServiceDescription(); |
437 } | 529 } |
438 | 530 |
439 const int kDisplayFactory_create_name = 0; | 531 const int kDisplayFactory_create_name = 0; |
440 | 532 |
441 const String DisplayFactoryName = | 533 const String DisplayFactoryName = |
442 'mojo::DisplayFactory'; | 534 'mojo::DisplayFactory'; |
443 | 535 |
| 536 mojom_types.MojomInterface _display_DisplayFactory__() { |
| 537 return new mojom_types.MojomInterface() |
| 538 ..declData = (new mojom_types.DeclarationData()..shortName = "DisplayFactory
") |
| 539 ..interfaceName = "DisplayFactory" |
| 540 ..methods = <int, mojom_types.MojomMethod>{ |
| 541 kDisplayFactory_create_name: new mojom_types.MojomMethod() |
| 542 ..declData = (new mojom_types.DeclarationData()..shortName = "Create") |
| 543 ..ordinal = kDisplayFactory_create_name..parameters = _display_DisplayFa
ctory_Create_Params__(), |
| 544 }; |
| 545 } |
| 546 |
| 547 class _DisplayFactoryServiceDescription extends service_describer.ServiceDescrip
tion { |
| 548 // Avoid infinite loop by overriding serviceDescription field. |
| 549 final service_describer.ServiceDescription serviceDescription = null; |
| 550 dynamic getTopLevelInterface([Function responseFactory = null]) { |
| 551 return _display_DisplayFactory__(); |
| 552 } |
| 553 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
| 554 return getAllMojomTypeDefinitions()[typeKey]; |
| 555 } |
| 556 dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
| 557 return getAllMojomTypeDefinitions(); |
| 558 } |
| 559 } |
| 560 |
444 abstract class DisplayFactory { | 561 abstract class DisplayFactory { |
445 void create(Object contextProvider, Object returner, Object displayRequest); | 562 void create(Object contextProvider, Object returner, Object displayRequest); |
446 | 563 |
447 } | 564 } |
448 | 565 |
449 | 566 |
450 class DisplayFactoryProxyImpl extends bindings.Proxy { | 567 class DisplayFactoryProxyImpl extends bindings.Proxy { |
451 DisplayFactoryProxyImpl.fromEndpoint( | 568 DisplayFactoryProxyImpl.fromEndpoint( |
452 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 569 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
453 | 570 |
454 DisplayFactoryProxyImpl.fromHandle(core.MojoHandle handle) : | 571 DisplayFactoryProxyImpl.fromHandle(core.MojoHandle handle) : |
455 super.fromHandle(handle); | 572 super.fromHandle(handle); |
456 | 573 |
457 DisplayFactoryProxyImpl.unbound() : super.unbound(); | 574 DisplayFactoryProxyImpl.unbound() : super.unbound(); |
458 | 575 |
459 static DisplayFactoryProxyImpl newFromEndpoint( | 576 static DisplayFactoryProxyImpl newFromEndpoint( |
460 core.MojoMessagePipeEndpoint endpoint) { | 577 core.MojoMessagePipeEndpoint endpoint) { |
461 assert(endpoint.setDescription("For DisplayFactoryProxyImpl")); | 578 assert(endpoint.setDescription("For DisplayFactoryProxyImpl")); |
462 return new DisplayFactoryProxyImpl.fromEndpoint(endpoint); | 579 return new DisplayFactoryProxyImpl.fromEndpoint(endpoint); |
463 } | 580 } |
464 | 581 |
465 String get name => DisplayFactoryName; | 582 String get name => DisplayFactoryName; |
466 | 583 |
| 584 service_describer.ServiceDescription get serviceDescription => |
| 585 new _DisplayFactoryServiceDescription(); |
| 586 |
467 void handleResponse(bindings.ServiceMessage message) { | 587 void handleResponse(bindings.ServiceMessage message) { |
468 switch (message.header.type) { | 588 switch (message.header.type) { |
469 default: | 589 default: |
470 proxyError("Unexpected message type: ${message.header.type}"); | 590 proxyError("Unexpected message type: ${message.header.type}"); |
471 close(immediate: true); | 591 close(immediate: true); |
472 break; | 592 break; |
473 } | 593 } |
474 } | 594 } |
475 | 595 |
476 String toString() { | 596 String toString() { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 assert(_impl == null); | 724 assert(_impl == null); |
605 _impl = d; | 725 _impl = d; |
606 } | 726 } |
607 | 727 |
608 String toString() { | 728 String toString() { |
609 var superString = super.toString(); | 729 var superString = super.toString(); |
610 return "DisplayFactoryStub($superString)"; | 730 return "DisplayFactoryStub($superString)"; |
611 } | 731 } |
612 | 732 |
613 int get version => 0; | 733 int get version => 0; |
| 734 |
| 735 service_describer.ServiceDescription get serviceDescription => |
| 736 new _DisplayFactoryServiceDescription(); |
614 } | 737 } |
615 | 738 |
616 | 739 |
| 740 |
| 741 |
| 742 |
| 743 |
| 744 |
| 745 |
| 746 var _MojomDesc__ = _initDescriptions(); |
| 747 |
| 748 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 749 var map = new Map<String, mojom_types.UserDefinedType>(); |
| 750 |
| 751 map["_display_Display_SubmitFrame_Params__"] = |
| 752 new mojom_types.UserDefinedType() |
| 753 ..structType = _display_Display_SubmitFrame_Params__(); |
| 754 |
| 755 |
| 756 |
| 757 |
| 758 |
| 759 map["_display_Display_SubmitFrame_ResponseParams__"] = |
| 760 new mojom_types.UserDefinedType() |
| 761 ..structType = _display_Display_SubmitFrame_ResponseParams__(); |
| 762 |
| 763 |
| 764 |
| 765 map["_display_DisplayFactory_Create_Params__"] = |
| 766 new mojom_types.UserDefinedType() |
| 767 ..structType = _display_DisplayFactory_Create_Params__(); |
| 768 |
| 769 |
| 770 |
| 771 |
| 772 |
| 773 |
| 774 |
| 775 |
| 776 |
| 777 |
| 778 map["_display_DisplayFactory__"] = |
| 779 new mojom_types.UserDefinedType() |
| 780 ..interfaceType = _display_DisplayFactory__(); |
| 781 |
| 782 context_provider_mojom.getAllMojomTypeDefinitions().forEach((String s, mojom_typ
es.UserDefinedType udt) { |
| 783 map[s] = udt; |
| 784 }); |
| 785 viewport_parameter_listener_mojom.getAllMojomTypeDefinitions().forEach((String s
, mojom_types.UserDefinedType udt) { |
| 786 map[s] = udt; |
| 787 }); |
| 788 surfaces_mojom.getAllMojomTypeDefinitions().forEach((String s, mojom_types.UserD
efinedType udt) { |
| 789 map[s] = udt; |
| 790 }); |
| 791 return map; |
| 792 } |
| 793 |
| 794 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 795 return _MojomDesc__; |
| 796 } |
| 797 |
| 798 |
OLD | NEW |