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 | 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 | 13 |
12 | 14 |
13 | 15 |
14 class VSyncProviderAwaitVSyncParams extends bindings.Struct { | 16 class VSyncProviderAwaitVSyncParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 17 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(8, 0) | 18 const bindings.StructDataHeader(8, 0) |
17 ]; | 19 ]; |
18 | 20 |
19 VSyncProviderAwaitVSyncParams() : super(kVersions.last.size); | 21 VSyncProviderAwaitVSyncParams() : super(kVersions.last.size); |
20 | 22 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 String toString() { | 63 String toString() { |
62 return "VSyncProviderAwaitVSyncParams("")"; | 64 return "VSyncProviderAwaitVSyncParams("")"; |
63 } | 65 } |
64 | 66 |
65 Map toJson() { | 67 Map toJson() { |
66 Map map = new Map(); | 68 Map map = new Map(); |
67 return map; | 69 return map; |
68 } | 70 } |
69 } | 71 } |
70 | 72 |
| 73 mojom_types.MojomStruct _vsync_VSyncProvider_AwaitVSync_Params__() { |
| 74 return new mojom_types.MojomStruct() |
| 75 ..declData = (new mojom_types.DeclarationData()..shortName = 'VSyncProviderA
waitVSyncParams') |
| 76 ..fields = <mojom_types.StructField>[]; |
| 77 } |
| 78 |
71 | 79 |
72 class VSyncProviderAwaitVSyncResponseParams extends bindings.Struct { | 80 class VSyncProviderAwaitVSyncResponseParams extends bindings.Struct { |
73 static const List<bindings.StructDataHeader> kVersions = const [ | 81 static const List<bindings.StructDataHeader> kVersions = const [ |
74 const bindings.StructDataHeader(16, 0) | 82 const bindings.StructDataHeader(16, 0) |
75 ]; | 83 ]; |
76 int timeStamp = 0; | 84 int timeStamp = 0; |
77 | 85 |
78 VSyncProviderAwaitVSyncResponseParams() : super(kVersions.last.size); | 86 VSyncProviderAwaitVSyncResponseParams() : super(kVersions.last.size); |
79 | 87 |
80 static VSyncProviderAwaitVSyncResponseParams deserialize(bindings.Message mess
age) { | 88 static VSyncProviderAwaitVSyncResponseParams deserialize(bindings.Message mess
age) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 "timeStamp: $timeStamp" ")"; | 136 "timeStamp: $timeStamp" ")"; |
129 } | 137 } |
130 | 138 |
131 Map toJson() { | 139 Map toJson() { |
132 Map map = new Map(); | 140 Map map = new Map(); |
133 map["timeStamp"] = timeStamp; | 141 map["timeStamp"] = timeStamp; |
134 return map; | 142 return map; |
135 } | 143 } |
136 } | 144 } |
137 | 145 |
| 146 mojom_types.MojomStruct _vsync_VSyncProvider_AwaitVSync_ResponseParams__() { |
| 147 return new mojom_types.MojomStruct() |
| 148 ..declData = (new mojom_types.DeclarationData()..shortName = 'VSyncProviderA
waitVSyncResponseParams') |
| 149 ..fields = <mojom_types.StructField>[ |
| 150 new mojom_types.StructField() |
| 151 ..declData = (new mojom_types.DeclarationData()..shortName = 'TimeStamp'
) |
| 152 ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.IN
T64), |
| 153 ]; |
| 154 } |
| 155 |
| 156 |
138 const int kVSyncProvider_awaitVSync_name = 0; | 157 const int kVSyncProvider_awaitVSync_name = 0; |
139 | 158 |
140 const String VSyncProviderName = | 159 const String VSyncProviderName = |
141 'vsync::VSyncProvider'; | 160 'vsync::VSyncProvider'; |
142 | 161 |
| 162 mojom_types.MojomInterface _vsync_VSyncProvider__() { |
| 163 return new mojom_types.MojomInterface() |
| 164 ..declData = (new mojom_types.DeclarationData()..shortName = "VSyncProvider"
) |
| 165 ..interfaceName = "VSyncProvider" |
| 166 ..methods = <int, mojom_types.MojomMethod>{ |
| 167 kVSyncProvider_awaitVSync_name: new mojom_types.MojomMethod() |
| 168 ..declData = (new mojom_types.DeclarationData()..shortName = "AwaitVSync
") |
| 169 ..ordinal = kVSyncProvider_awaitVSync_name |
| 170 ..responseParams = _vsync_VSyncProvider_AwaitVSync_ResponseParams__()..p
arameters = _vsync_VSyncProvider_AwaitVSync_Params__(), |
| 171 }; |
| 172 } |
| 173 |
| 174 class _VSyncProviderServiceDescription extends service_describer.ServiceDescript
ion { |
| 175 // Avoid infinite loop by overriding serviceDescription field. |
| 176 final service_describer.ServiceDescription serviceDescription = null; |
| 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 |
143 abstract class VSyncProvider { | 188 abstract class VSyncProvider { |
144 dynamic awaitVSync([Function responseFactory = null]); | 189 dynamic awaitVSync([Function responseFactory = null]); |
145 | 190 |
146 } | 191 } |
147 | 192 |
148 | 193 |
149 class VSyncProviderProxyImpl extends bindings.Proxy { | 194 class VSyncProviderProxyImpl extends bindings.Proxy { |
150 VSyncProviderProxyImpl.fromEndpoint( | 195 VSyncProviderProxyImpl.fromEndpoint( |
151 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 196 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
152 | 197 |
153 VSyncProviderProxyImpl.fromHandle(core.MojoHandle handle) : | 198 VSyncProviderProxyImpl.fromHandle(core.MojoHandle handle) : |
154 super.fromHandle(handle); | 199 super.fromHandle(handle); |
155 | 200 |
156 VSyncProviderProxyImpl.unbound() : super.unbound(); | 201 VSyncProviderProxyImpl.unbound() : super.unbound(); |
157 | 202 |
158 static VSyncProviderProxyImpl newFromEndpoint( | 203 static VSyncProviderProxyImpl newFromEndpoint( |
159 core.MojoMessagePipeEndpoint endpoint) { | 204 core.MojoMessagePipeEndpoint endpoint) { |
160 assert(endpoint.setDescription("For VSyncProviderProxyImpl")); | 205 assert(endpoint.setDescription("For VSyncProviderProxyImpl")); |
161 return new VSyncProviderProxyImpl.fromEndpoint(endpoint); | 206 return new VSyncProviderProxyImpl.fromEndpoint(endpoint); |
162 } | 207 } |
163 | 208 |
164 String get name => VSyncProviderName; | 209 String get name => VSyncProviderName; |
165 | 210 |
| 211 service_describer.ServiceDescription get serviceDescription => |
| 212 new _VSyncProviderServiceDescription(); |
| 213 |
166 void handleResponse(bindings.ServiceMessage message) { | 214 void handleResponse(bindings.ServiceMessage message) { |
167 switch (message.header.type) { | 215 switch (message.header.type) { |
168 case kVSyncProvider_awaitVSync_name: | 216 case kVSyncProvider_awaitVSync_name: |
169 var r = VSyncProviderAwaitVSyncResponseParams.deserialize( | 217 var r = VSyncProviderAwaitVSyncResponseParams.deserialize( |
170 message.payload); | 218 message.payload); |
171 if (!message.header.hasRequestId) { | 219 if (!message.header.hasRequestId) { |
172 proxyError("Expected a message with a valid request Id."); | 220 proxyError("Expected a message with a valid request Id."); |
173 return; | 221 return; |
174 } | 222 } |
175 Completer c = completerMap[message.header.requestId]; | 223 Completer c = completerMap[message.header.requestId]; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 assert(_impl == null); | 389 assert(_impl == null); |
342 _impl = d; | 390 _impl = d; |
343 } | 391 } |
344 | 392 |
345 String toString() { | 393 String toString() { |
346 var superString = super.toString(); | 394 var superString = super.toString(); |
347 return "VSyncProviderStub($superString)"; | 395 return "VSyncProviderStub($superString)"; |
348 } | 396 } |
349 | 397 |
350 int get version => 0; | 398 int get version => 0; |
| 399 |
| 400 service_describer.ServiceDescription get serviceDescription => |
| 401 new _VSyncProviderServiceDescription(); |
351 } | 402 } |
352 | 403 |
353 | 404 |
| 405 |
| 406 |
| 407 |
| 408 |
| 409 |
| 410 |
| 411 var _MojomDesc__ = _initDescriptions(); |
| 412 |
| 413 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 414 var map = new Map<String, mojom_types.UserDefinedType>(); |
| 415 |
| 416 map["_vsync_VSyncProvider_AwaitVSync_Params__"] = |
| 417 new mojom_types.UserDefinedType() |
| 418 ..structType = _vsync_VSyncProvider_AwaitVSync_Params__(); |
| 419 |
| 420 |
| 421 |
| 422 map["_vsync_VSyncProvider_AwaitVSync_ResponseParams__"] = |
| 423 new mojom_types.UserDefinedType() |
| 424 ..structType = _vsync_VSyncProvider_AwaitVSync_ResponseParams__(); |
| 425 |
| 426 |
| 427 |
| 428 |
| 429 |
| 430 map["_vsync_VSyncProvider__"] = |
| 431 new mojom_types.UserDefinedType() |
| 432 ..interfaceType = _vsync_VSyncProvider__(); |
| 433 |
| 434 return map; |
| 435 } |
| 436 |
| 437 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 438 return _MojomDesc__; |
| 439 } |
| 440 |
| 441 |
OLD | NEW |