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 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 dynamic getAllTypeDefinitions([Function responseFactory]) => | 151 dynamic getAllTypeDefinitions([Function responseFactory]) => |
152 responseFactory(null); | 152 responseFactory(null); |
153 } | 153 } |
154 | 154 |
155 abstract class VSyncProvider { | 155 abstract class VSyncProvider { |
156 static const String serviceName = "vsync::VSyncProvider"; | 156 static const String serviceName = "vsync::VSyncProvider"; |
157 dynamic awaitVSync([Function responseFactory = null]); | 157 dynamic awaitVSync([Function responseFactory = null]); |
158 } | 158 } |
159 | 159 |
160 | 160 class _VSyncProviderProxyControl |
161 class _VSyncProviderProxyControl extends bindings.ProxyMessageHandler | 161 extends bindings.ProxyMessageHandler |
162 implements bindings.ProxyControl { | 162 implements bindings.ProxyControl { |
163 _VSyncProviderProxyControl.fromEndpoint( | 163 _VSyncProviderProxyControl.fromEndpoint( |
164 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 164 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
165 | 165 |
166 _VSyncProviderProxyControl.fromHandle( | 166 _VSyncProviderProxyControl.fromHandle( |
167 core.MojoHandle handle) : super.fromHandle(handle); | 167 core.MojoHandle handle) : super.fromHandle(handle); |
168 | 168 |
169 _VSyncProviderProxyControl.unbound() : super.unbound(); | 169 _VSyncProviderProxyControl.unbound() : super.unbound(); |
170 | 170 |
171 service_describer.ServiceDescription get serviceDescription => | 171 service_describer.ServiceDescription get serviceDescription => |
172 new _VSyncProviderServiceDescription(); | 172 new _VSyncProviderServiceDescription(); |
173 | 173 |
174 String get serviceName => VSyncProvider.serviceName; | 174 String get serviceName => VSyncProvider.serviceName; |
175 | 175 |
176 @override | |
177 void handleResponse(bindings.ServiceMessage message) { | 176 void handleResponse(bindings.ServiceMessage message) { |
178 switch (message.header.type) { | 177 switch (message.header.type) { |
179 case _vSyncProviderMethodAwaitVSyncName: | 178 case _vSyncProviderMethodAwaitVSyncName: |
180 var r = VSyncProviderAwaitVSyncResponseParams.deserialize( | 179 var r = VSyncProviderAwaitVSyncResponseParams.deserialize( |
181 message.payload); | 180 message.payload); |
182 if (!message.header.hasRequestId) { | 181 if (!message.header.hasRequestId) { |
183 proxyError("Expected a message with a valid request Id."); | 182 proxyError("Expected a message with a valid request Id."); |
184 return; | 183 return; |
185 } | 184 } |
186 Completer c = completerMap[message.header.requestId]; | 185 Completer c = completerMap[message.header.requestId]; |
(...skipping 16 matching lines...) Expand all Loading... |
203 } | 202 } |
204 } | 203 } |
205 | 204 |
206 @override | 205 @override |
207 String toString() { | 206 String toString() { |
208 var superString = super.toString(); | 207 var superString = super.toString(); |
209 return "_VSyncProviderProxyControl($superString)"; | 208 return "_VSyncProviderProxyControl($superString)"; |
210 } | 209 } |
211 } | 210 } |
212 | 211 |
213 | 212 class VSyncProviderProxy |
214 class VSyncProviderProxy extends bindings.Proxy | 213 extends bindings.Proxy |
215 implements VSyncProvider { | 214 implements VSyncProvider { |
216 VSyncProviderProxy.fromEndpoint( | 215 VSyncProviderProxy.fromEndpoint( |
217 core.MojoMessagePipeEndpoint endpoint) | 216 core.MojoMessagePipeEndpoint endpoint) |
218 : super(new _VSyncProviderProxyControl.fromEndpoint(endpoint)); | 217 : super(new _VSyncProviderProxyControl.fromEndpoint(endpoint)); |
219 | 218 |
220 VSyncProviderProxy.fromHandle(core.MojoHandle handle) | 219 VSyncProviderProxy.fromHandle(core.MojoHandle handle) |
221 : super(new _VSyncProviderProxyControl.fromHandle(handle)); | 220 : super(new _VSyncProviderProxyControl.fromHandle(handle)); |
222 | 221 |
223 VSyncProviderProxy.unbound() | 222 VSyncProviderProxy.unbound() |
224 : super(new _VSyncProviderProxyControl.unbound()); | 223 : super(new _VSyncProviderProxyControl.unbound()); |
225 | 224 |
(...skipping 14 matching lines...) Expand all Loading... |
240 dynamic awaitVSync([Function responseFactory = null]) { | 239 dynamic awaitVSync([Function responseFactory = null]) { |
241 var params = new _VSyncProviderAwaitVSyncParams(); | 240 var params = new _VSyncProviderAwaitVSyncParams(); |
242 return ctrl.sendMessageWithRequestId( | 241 return ctrl.sendMessageWithRequestId( |
243 params, | 242 params, |
244 _vSyncProviderMethodAwaitVSyncName, | 243 _vSyncProviderMethodAwaitVSyncName, |
245 -1, | 244 -1, |
246 bindings.MessageHeader.kMessageExpectsResponse); | 245 bindings.MessageHeader.kMessageExpectsResponse); |
247 } | 246 } |
248 } | 247 } |
249 | 248 |
250 | 249 class _VSyncProviderStubControl |
251 class VSyncProviderStub extends bindings.Stub { | 250 extends bindings.StubMessageHandler |
| 251 implements bindings.StubControl<VSyncProvider> { |
252 VSyncProvider _impl; | 252 VSyncProvider _impl; |
253 | 253 |
254 VSyncProviderStub.fromEndpoint( | 254 _VSyncProviderStubControl.fromEndpoint( |
255 core.MojoMessagePipeEndpoint endpoint, [VSyncProvider impl]) | 255 core.MojoMessagePipeEndpoint endpoint, [VSyncProvider impl]) |
256 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 256 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
257 _impl = impl; | 257 _impl = impl; |
258 } | 258 } |
259 | 259 |
260 VSyncProviderStub.fromHandle( | 260 _VSyncProviderStubControl.fromHandle( |
261 core.MojoHandle handle, [VSyncProvider impl]) | 261 core.MojoHandle handle, [VSyncProvider impl]) |
262 : super.fromHandle(handle, autoBegin: impl != null) { | 262 : super.fromHandle(handle, autoBegin: impl != null) { |
263 _impl = impl; | 263 _impl = impl; |
264 } | 264 } |
265 | 265 |
266 VSyncProviderStub.unbound([this._impl]) : super.unbound(); | 266 _VSyncProviderStubControl.unbound([this._impl]) : super.unbound(); |
267 | |
268 static VSyncProviderStub newFromEndpoint( | |
269 core.MojoMessagePipeEndpoint endpoint) { | |
270 assert(endpoint.setDescription("For VSyncProviderStub")); | |
271 return new VSyncProviderStub.fromEndpoint(endpoint); | |
272 } | |
273 | 267 |
274 | 268 |
275 VSyncProviderAwaitVSyncResponseParams _vSyncProviderAwaitVSyncResponseParamsFa
ctory(int timeStamp) { | 269 VSyncProviderAwaitVSyncResponseParams _vSyncProviderAwaitVSyncResponseParamsFa
ctory(int timeStamp) { |
276 var result = new VSyncProviderAwaitVSyncResponseParams(); | 270 var result = new VSyncProviderAwaitVSyncResponseParams(); |
277 result.timeStamp = timeStamp; | 271 result.timeStamp = timeStamp; |
278 return result; | 272 return result; |
279 } | 273 } |
280 | 274 |
281 dynamic handleMessage(bindings.ServiceMessage message) { | 275 dynamic handleMessage(bindings.ServiceMessage message) { |
282 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 276 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 321 } |
328 | 322 |
329 @override | 323 @override |
330 void bind(core.MojoMessagePipeEndpoint endpoint) { | 324 void bind(core.MojoMessagePipeEndpoint endpoint) { |
331 super.bind(endpoint); | 325 super.bind(endpoint); |
332 if (!isOpen && (_impl != null)) { | 326 if (!isOpen && (_impl != null)) { |
333 beginHandlingEvents(); | 327 beginHandlingEvents(); |
334 } | 328 } |
335 } | 329 } |
336 | 330 |
| 331 @override |
337 String toString() { | 332 String toString() { |
338 var superString = super.toString(); | 333 var superString = super.toString(); |
339 return "VSyncProviderStub($superString)"; | 334 return "_VSyncProviderStubControl($superString)"; |
340 } | 335 } |
341 | 336 |
342 int get version => 0; | 337 int get version => 0; |
343 | 338 |
344 static service_describer.ServiceDescription _cachedServiceDescription; | 339 static service_describer.ServiceDescription _cachedServiceDescription; |
345 static service_describer.ServiceDescription get serviceDescription { | 340 static service_describer.ServiceDescription get serviceDescription { |
346 if (_cachedServiceDescription == null) { | 341 if (_cachedServiceDescription == null) { |
347 _cachedServiceDescription = new _VSyncProviderServiceDescription(); | 342 _cachedServiceDescription = new _VSyncProviderServiceDescription(); |
348 } | 343 } |
349 return _cachedServiceDescription; | 344 return _cachedServiceDescription; |
350 } | 345 } |
351 } | 346 } |
352 | 347 |
| 348 class VSyncProviderStub |
| 349 extends bindings.Stub<VSyncProvider> |
| 350 implements VSyncProvider { |
| 351 VSyncProviderStub.fromEndpoint( |
| 352 core.MojoMessagePipeEndpoint endpoint, [VSyncProvider impl]) |
| 353 : super(new _VSyncProviderStubControl.fromEndpoint(endpoint, impl)); |
| 354 |
| 355 VSyncProviderStub.fromHandle( |
| 356 core.MojoHandle handle, [VSyncProvider impl]) |
| 357 : super(new _VSyncProviderStubControl.fromHandle(handle, impl)); |
| 358 |
| 359 VSyncProviderStub.unbound([VSyncProvider impl]) |
| 360 : super(new _VSyncProviderStubControl.unbound(impl)); |
| 361 |
| 362 static VSyncProviderStub newFromEndpoint( |
| 363 core.MojoMessagePipeEndpoint endpoint) { |
| 364 assert(endpoint.setDescription("For VSyncProviderStub")); |
| 365 return new VSyncProviderStub.fromEndpoint(endpoint); |
| 366 } |
| 367 |
| 368 static service_describer.ServiceDescription get serviceDescription => |
| 369 _VSyncProviderStubControl.serviceDescription; |
| 370 |
| 371 |
| 372 dynamic awaitVSync([Function responseFactory = null]) { |
| 373 return impl.awaitVSync(responseFactory); |
| 374 } |
| 375 } |
| 376 |
353 | 377 |
354 | 378 |
OLD | NEW |