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 vsync_mojom; | 5 library vsync_mojom; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; |
8 | 9 |
9 import 'package:mojo/bindings.dart' as bindings; | 10 import 'package:mojo/bindings.dart' as bindings; |
10 import 'package:mojo/core.dart' as core; | 11 import 'package:mojo/core.dart' as core; |
| 12 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 13 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
11 | 14 |
12 | 15 |
13 | 16 |
14 class _VSyncProviderAwaitVSyncParams extends bindings.Struct { | 17 class _VSyncProviderAwaitVSyncParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(8, 0) | 19 const bindings.StructDataHeader(8, 0) |
17 ]; | 20 ]; |
18 | 21 |
19 _VSyncProviderAwaitVSyncParams() : super(kVersions.last.size); | 22 _VSyncProviderAwaitVSyncParams() : super(kVersions.last.size); |
20 | 23 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 63 |
61 String toString() { | 64 String toString() { |
62 return "_VSyncProviderAwaitVSyncParams("")"; | 65 return "_VSyncProviderAwaitVSyncParams("")"; |
63 } | 66 } |
64 | 67 |
65 Map toJson() { | 68 Map toJson() { |
66 Map map = new Map(); | 69 Map map = new Map(); |
67 return map; | 70 return map; |
68 } | 71 } |
69 } | 72 } |
| 73 mojom_types.MojomStruct _vsync_VSyncProvider_AwaitVSync_Params__() { |
| 74 return new mojom_types.MojomStruct() |
| 75 ..declData = (new mojom_types.DeclarationData() |
| 76 ..shortName = '_VSyncProviderAwaitVSyncParams' |
| 77 ..fullIdentifier = 'vsync._VSyncProviderAwaitVSyncParams') |
| 78 ..fields = <mojom_types.StructField>[]; |
| 79 } |
70 | 80 |
71 | 81 |
72 class VSyncProviderAwaitVSyncResponseParams extends bindings.Struct { | 82 class VSyncProviderAwaitVSyncResponseParams extends bindings.Struct { |
73 static const List<bindings.StructDataHeader> kVersions = const [ | 83 static const List<bindings.StructDataHeader> kVersions = const [ |
74 const bindings.StructDataHeader(16, 0) | 84 const bindings.StructDataHeader(16, 0) |
75 ]; | 85 ]; |
76 int timeStamp = 0; | 86 int timeStamp = 0; |
77 | 87 |
78 VSyncProviderAwaitVSyncResponseParams() : super(kVersions.last.size); | 88 VSyncProviderAwaitVSyncResponseParams() : super(kVersions.last.size); |
79 | 89 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return "VSyncProviderAwaitVSyncResponseParams(" | 137 return "VSyncProviderAwaitVSyncResponseParams(" |
128 "timeStamp: $timeStamp" ")"; | 138 "timeStamp: $timeStamp" ")"; |
129 } | 139 } |
130 | 140 |
131 Map toJson() { | 141 Map toJson() { |
132 Map map = new Map(); | 142 Map map = new Map(); |
133 map["timeStamp"] = timeStamp; | 143 map["timeStamp"] = timeStamp; |
134 return map; | 144 return map; |
135 } | 145 } |
136 } | 146 } |
| 147 mojom_types.MojomStruct _vsync_VSyncProvider_AwaitVSync_ResponseParams__() { |
| 148 return new mojom_types.MojomStruct() |
| 149 ..declData = (new mojom_types.DeclarationData() |
| 150 ..shortName = 'VSyncProviderAwaitVSyncResponseParams' |
| 151 ..fullIdentifier = 'vsync.VSyncProviderAwaitVSyncResponseParams') |
| 152 ..fields = <mojom_types.StructField>[ |
| 153 new mojom_types.StructField() |
| 154 ..declData = (new mojom_types.DeclarationData()..shortName = 'TimeStamp'
) |
| 155 ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.in
t64), |
| 156 ]; |
| 157 } |
| 158 |
137 | 159 |
138 const int _VSyncProvider_awaitVSyncName = 0; | 160 const int _VSyncProvider_awaitVSyncName = 0; |
139 | 161 |
| 162 mojom_types.MojomInterface _vsync_VSyncProvider__() { |
| 163 return new mojom_types.MojomInterface() |
| 164 ..declData = (new mojom_types.DeclarationData() |
| 165 ..shortName = 'VSyncProvider' |
| 166 ..fullIdentifier = 'vsync.VSyncProvider') |
| 167 ..interfaceName = 'VSyncProvider' |
| 168 ..methods = <int, mojom_types.MojomMethod>{ |
| 169 _VSyncProvider_awaitVSyncName: new mojom_types.MojomMethod() |
| 170 ..declData = (new mojom_types.DeclarationData()..shortName = 'AwaitVSync
') |
| 171 ..ordinal = _VSyncProvider_awaitVSyncName |
| 172 ..responseParams = _vsync_VSyncProvider_AwaitVSync_ResponseParams__()..p
arameters = _vsync_VSyncProvider_AwaitVSync_Params__(), |
| 173 }; |
| 174 } |
| 175 |
| 176 class _VSyncProviderServiceDescription implements service_describer.ServiceDescr
iption { |
| 177 dynamic getTopLevelInterface([Function responseFactory = null]) { |
| 178 return _vsync_VSyncProvider__(); |
| 179 } |
| 180 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
| 181 return getAllMojomTypeDefinitions()[typeKey]; |
| 182 } |
| 183 dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
| 184 return getAllMojomTypeDefinitions(); |
| 185 } |
| 186 } |
| 187 |
140 abstract class VSyncProvider { | 188 abstract class VSyncProvider { |
141 static const String serviceName = "vsync::VSyncProvider"; | 189 static const String serviceName = "vsync::VSyncProvider"; |
142 dynamic awaitVSync([Function responseFactory = null]); | 190 dynamic awaitVSync([Function responseFactory = null]); |
143 } | 191 } |
144 | 192 |
145 | 193 |
146 class _VSyncProviderProxyImpl extends bindings.Proxy { | 194 class _VSyncProviderProxyImpl extends bindings.Proxy { |
147 _VSyncProviderProxyImpl.fromEndpoint( | 195 _VSyncProviderProxyImpl.fromEndpoint( |
148 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 196 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
149 | 197 |
150 _VSyncProviderProxyImpl.fromHandle(core.MojoHandle handle) : | 198 _VSyncProviderProxyImpl.fromHandle(core.MojoHandle handle) : |
151 super.fromHandle(handle); | 199 super.fromHandle(handle); |
152 | 200 |
153 _VSyncProviderProxyImpl.unbound() : super.unbound(); | 201 _VSyncProviderProxyImpl.unbound() : super.unbound(); |
154 | 202 |
155 static _VSyncProviderProxyImpl newFromEndpoint( | 203 static _VSyncProviderProxyImpl newFromEndpoint( |
156 core.MojoMessagePipeEndpoint endpoint) { | 204 core.MojoMessagePipeEndpoint endpoint) { |
157 assert(endpoint.setDescription("For _VSyncProviderProxyImpl")); | 205 assert(endpoint.setDescription("For _VSyncProviderProxyImpl")); |
158 return new _VSyncProviderProxyImpl.fromEndpoint(endpoint); | 206 return new _VSyncProviderProxyImpl.fromEndpoint(endpoint); |
159 } | 207 } |
160 | 208 |
| 209 service_describer.ServiceDescription get serviceDescription => |
| 210 new _VSyncProviderServiceDescription(); |
| 211 |
161 void handleResponse(bindings.ServiceMessage message) { | 212 void handleResponse(bindings.ServiceMessage message) { |
162 switch (message.header.type) { | 213 switch (message.header.type) { |
163 case _VSyncProvider_awaitVSyncName: | 214 case _VSyncProvider_awaitVSyncName: |
164 var r = VSyncProviderAwaitVSyncResponseParams.deserialize( | 215 var r = VSyncProviderAwaitVSyncResponseParams.deserialize( |
165 message.payload); | 216 message.payload); |
166 if (!message.header.hasRequestId) { | 217 if (!message.header.hasRequestId) { |
167 proxyError("Expected a message with a valid request Id."); | 218 proxyError("Expected a message with a valid request Id."); |
168 return; | 219 return; |
169 } | 220 } |
170 Completer c = completerMap[message.header.requestId]; | 221 Completer c = completerMap[message.header.requestId]; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 assert(_impl == null); | 386 assert(_impl == null); |
336 _impl = d; | 387 _impl = d; |
337 } | 388 } |
338 | 389 |
339 String toString() { | 390 String toString() { |
340 var superString = super.toString(); | 391 var superString = super.toString(); |
341 return "VSyncProviderStub($superString)"; | 392 return "VSyncProviderStub($superString)"; |
342 } | 393 } |
343 | 394 |
344 int get version => 0; | 395 int get version => 0; |
| 396 |
| 397 |
| 398 service_describer.ServiceDescription get serviceDescription => |
| 399 new _VSyncProviderServiceDescription(); |
345 } | 400 } |
346 | 401 |
347 | 402 |
| 403 |
| 404 |
| 405 |
| 406 |
| 407 |
| 408 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 409 var map = new HashMap<String, mojom_types.UserDefinedType>(); |
| 410 map["_vsync_VSyncProvider_AwaitVSync_Params__"] = |
| 411 new mojom_types.UserDefinedType() |
| 412 ..structType = _vsync_VSyncProvider_AwaitVSync_Params__(); |
| 413 map["_vsync_VSyncProvider_AwaitVSync_ResponseParams__"] = |
| 414 new mojom_types.UserDefinedType() |
| 415 ..structType = _vsync_VSyncProvider_AwaitVSync_ResponseParams__(); |
| 416 map["_vsync_VSyncProvider__"] = |
| 417 new mojom_types.UserDefinedType() |
| 418 ..interfaceType = _vsync_VSyncProvider__(); |
| 419 |
| 420 return map; |
| 421 } |
| 422 |
| 423 var _MojomDesc; |
| 424 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 425 if (_MojomDesc == null) { |
| 426 _MojomDesc = _initDescriptions(); |
| 427 } |
| 428 return _MojomDesc; |
| 429 } |
| 430 |
OLD | NEW |