| Index: mojo/dart/packages/mojo_services/lib/mojo/native_viewport_event_dispatcher.mojom.dart
|
| diff --git a/mojo/dart/packages/mojo_services/lib/vsync/vsync.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/native_viewport_event_dispatcher.mojom.dart
|
| similarity index 54%
|
| copy from mojo/dart/packages/mojo_services/lib/vsync/vsync.mojom.dart
|
| copy to mojo/dart/packages/mojo_services/lib/mojo/native_viewport_event_dispatcher.mojom.dart
|
| index ac2e4c17749a6591189b8ec2d814a601f1e8bc2a..ce4e2f1335949ac102def1de9cd6c3bf2aa2f3b9 100644
|
| --- a/mojo/dart/packages/mojo_services/lib/vsync/vsync.mojom.dart
|
| +++ b/mojo/dart/packages/mojo_services/lib/mojo/native_viewport_event_dispatcher.mojom.dart
|
| @@ -2,25 +2,25 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -library vsync_mojom;
|
| +library native_viewport_event_dispatcher_mojom;
|
|
|
| import 'dart:async';
|
|
|
| import 'package:mojo/bindings.dart' as bindings;
|
| import 'package:mojo/core.dart' as core;
|
| -import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
|
| -import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as service_describer;
|
| +import 'package:mojo_services/mojo/input_events.mojom.dart' as input_events_mojom;
|
|
|
|
|
|
|
| -class _VSyncProviderAwaitVSyncParams extends bindings.Struct {
|
| +class _NativeViewportEventDispatcherOnEventParams extends bindings.Struct {
|
| static const List<bindings.StructDataHeader> kVersions = const [
|
| - const bindings.StructDataHeader(8, 0)
|
| + const bindings.StructDataHeader(16, 0)
|
| ];
|
| + input_events_mojom.Event event = null;
|
|
|
| - _VSyncProviderAwaitVSyncParams() : super(kVersions.last.size);
|
| + _NativeViewportEventDispatcherOnEventParams() : super(kVersions.last.size);
|
|
|
| - static _VSyncProviderAwaitVSyncParams deserialize(bindings.Message message) {
|
| + static _NativeViewportEventDispatcherOnEventParams deserialize(bindings.Message message) {
|
| var decoder = new bindings.Decoder(message);
|
| var result = decode(decoder);
|
| if (decoder.excessHandles != null) {
|
| @@ -29,11 +29,11 @@ class _VSyncProviderAwaitVSyncParams extends bindings.Struct {
|
| return result;
|
| }
|
|
|
| - static _VSyncProviderAwaitVSyncParams decode(bindings.Decoder decoder0) {
|
| + static _NativeViewportEventDispatcherOnEventParams decode(bindings.Decoder decoder0) {
|
| if (decoder0 == null) {
|
| return null;
|
| }
|
| - _VSyncProviderAwaitVSyncParams result = new _VSyncProviderAwaitVSyncParams();
|
| + _NativeViewportEventDispatcherOnEventParams result = new _NativeViewportEventDispatcherOnEventParams();
|
|
|
| var mainDataHeader = decoder0.decodeStructDataHeader();
|
| if (mainDataHeader.version <= kVersions.last.version) {
|
| @@ -53,35 +53,41 @@ class _VSyncProviderAwaitVSyncParams extends bindings.Struct {
|
| 'Message newer than the last known version cannot be shorter than '
|
| 'required by the last known version.');
|
| }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + var decoder1 = decoder0.decodePointer(8, false);
|
| + result.event = input_events_mojom.Event.decode(decoder1);
|
| + }
|
| return result;
|
| }
|
|
|
| void encode(bindings.Encoder encoder) {
|
| - encoder.getStructEncoderAtOffset(kVersions.last);
|
| + var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
|
| +
|
| + encoder0.encodeStruct(event, 8, false);
|
| }
|
|
|
| String toString() {
|
| - return "_VSyncProviderAwaitVSyncParams("")";
|
| + return "_NativeViewportEventDispatcherOnEventParams("
|
| + "event: $event" ")";
|
| }
|
|
|
| Map toJson() {
|
| Map map = new Map();
|
| + map["event"] = event;
|
| return map;
|
| }
|
| }
|
|
|
|
|
| -
|
| -
|
| -class VSyncProviderAwaitVSyncResponseParams extends bindings.Struct {
|
| +class NativeViewportEventDispatcherOnEventResponseParams extends bindings.Struct {
|
| static const List<bindings.StructDataHeader> kVersions = const [
|
| - const bindings.StructDataHeader(16, 0)
|
| + const bindings.StructDataHeader(8, 0)
|
| ];
|
| - int timeStamp = 0;
|
|
|
| - VSyncProviderAwaitVSyncResponseParams() : super(kVersions.last.size);
|
| + NativeViewportEventDispatcherOnEventResponseParams() : super(kVersions.last.size);
|
|
|
| - static VSyncProviderAwaitVSyncResponseParams deserialize(bindings.Message message) {
|
| + static NativeViewportEventDispatcherOnEventResponseParams deserialize(bindings.Message message) {
|
| var decoder = new bindings.Decoder(message);
|
| var result = decode(decoder);
|
| if (decoder.excessHandles != null) {
|
| @@ -90,11 +96,11 @@ class VSyncProviderAwaitVSyncResponseParams extends bindings.Struct {
|
| return result;
|
| }
|
|
|
| - static VSyncProviderAwaitVSyncResponseParams decode(bindings.Decoder decoder0) {
|
| + static NativeViewportEventDispatcherOnEventResponseParams decode(bindings.Decoder decoder0) {
|
| if (decoder0 == null) {
|
| return null;
|
| }
|
| - VSyncProviderAwaitVSyncResponseParams result = new VSyncProviderAwaitVSyncResponseParams();
|
| + NativeViewportEventDispatcherOnEventResponseParams result = new NativeViewportEventDispatcherOnEventResponseParams();
|
|
|
| var mainDataHeader = decoder0.decodeStructDataHeader();
|
| if (mainDataHeader.version <= kVersions.last.version) {
|
| @@ -114,74 +120,50 @@ class VSyncProviderAwaitVSyncResponseParams extends bindings.Struct {
|
| 'Message newer than the last known version cannot be shorter than '
|
| 'required by the last known version.');
|
| }
|
| - if (mainDataHeader.version >= 0) {
|
| -
|
| - result.timeStamp = decoder0.decodeInt64(8);
|
| - }
|
| return result;
|
| }
|
|
|
| void encode(bindings.Encoder encoder) {
|
| - var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
|
| -
|
| - encoder0.encodeInt64(timeStamp, 8);
|
| + encoder.getStructEncoderAtOffset(kVersions.last);
|
| }
|
|
|
| String toString() {
|
| - return "VSyncProviderAwaitVSyncResponseParams("
|
| - "timeStamp: $timeStamp" ")";
|
| + return "NativeViewportEventDispatcherOnEventResponseParams("")";
|
| }
|
|
|
| Map toJson() {
|
| Map map = new Map();
|
| - map["timeStamp"] = timeStamp;
|
| return map;
|
| }
|
| }
|
|
|
| +const int _NativeViewportEventDispatcher_onEventName = 0;
|
|
|
| -
|
| -
|
| -const int _VSyncProvider_awaitVSyncName = 0;
|
| -
|
| -
|
| -
|
| -class _VSyncProviderServiceDescription implements service_describer.ServiceDescription {
|
| - dynamic getTopLevelInterface([Function responseFactory]) => null;
|
| -
|
| - dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
|
| -
|
| - dynamic getAllTypeDefinitions([Function responseFactory]) => null;
|
| -}
|
| -
|
| -abstract class VSyncProvider {
|
| - static const String serviceName = "vsync::VSyncProvider";
|
| - dynamic awaitVSync([Function responseFactory = null]);
|
| +abstract class NativeViewportEventDispatcher {
|
| + static const String serviceName = "mojo::NativeViewportEventDispatcher";
|
| + dynamic onEvent(input_events_mojom.Event event,[Function responseFactory = null]);
|
| }
|
|
|
|
|
| -class _VSyncProviderProxyImpl extends bindings.Proxy {
|
| - _VSyncProviderProxyImpl.fromEndpoint(
|
| +class _NativeViewportEventDispatcherProxyImpl extends bindings.Proxy {
|
| + _NativeViewportEventDispatcherProxyImpl.fromEndpoint(
|
| core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
|
|
|
| - _VSyncProviderProxyImpl.fromHandle(core.MojoHandle handle) :
|
| + _NativeViewportEventDispatcherProxyImpl.fromHandle(core.MojoHandle handle) :
|
| super.fromHandle(handle);
|
|
|
| - _VSyncProviderProxyImpl.unbound() : super.unbound();
|
| + _NativeViewportEventDispatcherProxyImpl.unbound() : super.unbound();
|
|
|
| - static _VSyncProviderProxyImpl newFromEndpoint(
|
| + static _NativeViewportEventDispatcherProxyImpl newFromEndpoint(
|
| core.MojoMessagePipeEndpoint endpoint) {
|
| - assert(endpoint.setDescription("For _VSyncProviderProxyImpl"));
|
| - return new _VSyncProviderProxyImpl.fromEndpoint(endpoint);
|
| + assert(endpoint.setDescription("For _NativeViewportEventDispatcherProxyImpl"));
|
| + return new _NativeViewportEventDispatcherProxyImpl.fromEndpoint(endpoint);
|
| }
|
|
|
| - service_describer.ServiceDescription get serviceDescription =>
|
| - new _VSyncProviderServiceDescription();
|
| -
|
| void handleResponse(bindings.ServiceMessage message) {
|
| switch (message.header.type) {
|
| - case _VSyncProvider_awaitVSyncName:
|
| - var r = VSyncProviderAwaitVSyncResponseParams.deserialize(
|
| + case _NativeViewportEventDispatcher_onEventName:
|
| + var r = NativeViewportEventDispatcherOnEventResponseParams.deserialize(
|
| message.payload);
|
| if (!message.header.hasRequestId) {
|
| proxyError("Expected a message with a valid request Id.");
|
| @@ -209,64 +191,65 @@ class _VSyncProviderProxyImpl extends bindings.Proxy {
|
|
|
| String toString() {
|
| var superString = super.toString();
|
| - return "_VSyncProviderProxyImpl($superString)";
|
| + return "_NativeViewportEventDispatcherProxyImpl($superString)";
|
| }
|
| }
|
|
|
|
|
| -class _VSyncProviderProxyCalls implements VSyncProvider {
|
| - _VSyncProviderProxyImpl _proxyImpl;
|
| +class _NativeViewportEventDispatcherProxyCalls implements NativeViewportEventDispatcher {
|
| + _NativeViewportEventDispatcherProxyImpl _proxyImpl;
|
|
|
| - _VSyncProviderProxyCalls(this._proxyImpl);
|
| - dynamic awaitVSync([Function responseFactory = null]) {
|
| - var params = new _VSyncProviderAwaitVSyncParams();
|
| + _NativeViewportEventDispatcherProxyCalls(this._proxyImpl);
|
| + dynamic onEvent(input_events_mojom.Event event,[Function responseFactory = null]) {
|
| + var params = new _NativeViewportEventDispatcherOnEventParams();
|
| + params.event = event;
|
| return _proxyImpl.sendMessageWithRequestId(
|
| params,
|
| - _VSyncProvider_awaitVSyncName,
|
| + _NativeViewportEventDispatcher_onEventName,
|
| -1,
|
| bindings.MessageHeader.kMessageExpectsResponse);
|
| }
|
| }
|
|
|
|
|
| -class VSyncProviderProxy implements bindings.ProxyBase {
|
| +class NativeViewportEventDispatcherProxy implements bindings.ProxyBase {
|
| final bindings.Proxy impl;
|
| - VSyncProvider ptr;
|
| + NativeViewportEventDispatcher ptr;
|
|
|
| - VSyncProviderProxy(_VSyncProviderProxyImpl proxyImpl) :
|
| + NativeViewportEventDispatcherProxy(_NativeViewportEventDispatcherProxyImpl proxyImpl) :
|
| impl = proxyImpl,
|
| - ptr = new _VSyncProviderProxyCalls(proxyImpl);
|
| + ptr = new _NativeViewportEventDispatcherProxyCalls(proxyImpl);
|
|
|
| - VSyncProviderProxy.fromEndpoint(
|
| + NativeViewportEventDispatcherProxy.fromEndpoint(
|
| core.MojoMessagePipeEndpoint endpoint) :
|
| - impl = new _VSyncProviderProxyImpl.fromEndpoint(endpoint) {
|
| - ptr = new _VSyncProviderProxyCalls(impl);
|
| + impl = new _NativeViewportEventDispatcherProxyImpl.fromEndpoint(endpoint) {
|
| + ptr = new _NativeViewportEventDispatcherProxyCalls(impl);
|
| }
|
|
|
| - VSyncProviderProxy.fromHandle(core.MojoHandle handle) :
|
| - impl = new _VSyncProviderProxyImpl.fromHandle(handle) {
|
| - ptr = new _VSyncProviderProxyCalls(impl);
|
| + NativeViewportEventDispatcherProxy.fromHandle(core.MojoHandle handle) :
|
| + impl = new _NativeViewportEventDispatcherProxyImpl.fromHandle(handle) {
|
| + ptr = new _NativeViewportEventDispatcherProxyCalls(impl);
|
| }
|
|
|
| - VSyncProviderProxy.unbound() :
|
| - impl = new _VSyncProviderProxyImpl.unbound() {
|
| - ptr = new _VSyncProviderProxyCalls(impl);
|
| + NativeViewportEventDispatcherProxy.unbound() :
|
| + impl = new _NativeViewportEventDispatcherProxyImpl.unbound() {
|
| + ptr = new _NativeViewportEventDispatcherProxyCalls(impl);
|
| }
|
|
|
| - factory VSyncProviderProxy.connectToService(
|
| + factory NativeViewportEventDispatcherProxy.connectToService(
|
| bindings.ServiceConnector s, String url, [String serviceName]) {
|
| - VSyncProviderProxy p = new VSyncProviderProxy.unbound();
|
| + NativeViewportEventDispatcherProxy p = new NativeViewportEventDispatcherProxy.unbound();
|
| s.connectToService(url, p, serviceName);
|
| return p;
|
| }
|
|
|
| - static VSyncProviderProxy newFromEndpoint(
|
| + static NativeViewportEventDispatcherProxy newFromEndpoint(
|
| core.MojoMessagePipeEndpoint endpoint) {
|
| - assert(endpoint.setDescription("For VSyncProviderProxy"));
|
| - return new VSyncProviderProxy.fromEndpoint(endpoint);
|
| + assert(endpoint.setDescription("For NativeViewportEventDispatcherProxy"));
|
| + return new NativeViewportEventDispatcherProxy.fromEndpoint(endpoint);
|
| }
|
|
|
| - String get serviceName => VSyncProvider.serviceName;
|
| + String get serviceName => NativeViewportEventDispatcher.serviceName;
|
|
|
| Future close({bool immediate: false}) => impl.close(immediate: immediate);
|
|
|
| @@ -283,33 +266,32 @@ class VSyncProviderProxy implements bindings.ProxyBase {
|
| }
|
|
|
| String toString() {
|
| - return "VSyncProviderProxy($impl)";
|
| + return "NativeViewportEventDispatcherProxy($impl)";
|
| }
|
| }
|
|
|
|
|
| -class VSyncProviderStub extends bindings.Stub {
|
| - VSyncProvider _impl = null;
|
| +class NativeViewportEventDispatcherStub extends bindings.Stub {
|
| + NativeViewportEventDispatcher _impl = null;
|
|
|
| - VSyncProviderStub.fromEndpoint(
|
| + NativeViewportEventDispatcherStub.fromEndpoint(
|
| core.MojoMessagePipeEndpoint endpoint, [this._impl])
|
| : super.fromEndpoint(endpoint);
|
|
|
| - VSyncProviderStub.fromHandle(core.MojoHandle handle, [this._impl])
|
| + NativeViewportEventDispatcherStub.fromHandle(core.MojoHandle handle, [this._impl])
|
| : super.fromHandle(handle);
|
|
|
| - VSyncProviderStub.unbound() : super.unbound();
|
| + NativeViewportEventDispatcherStub.unbound() : super.unbound();
|
|
|
| - static VSyncProviderStub newFromEndpoint(
|
| + static NativeViewportEventDispatcherStub newFromEndpoint(
|
| core.MojoMessagePipeEndpoint endpoint) {
|
| - assert(endpoint.setDescription("For VSyncProviderStub"));
|
| - return new VSyncProviderStub.fromEndpoint(endpoint);
|
| + assert(endpoint.setDescription("For NativeViewportEventDispatcherStub"));
|
| + return new NativeViewportEventDispatcherStub.fromEndpoint(endpoint);
|
| }
|
|
|
|
|
| - VSyncProviderAwaitVSyncResponseParams _VSyncProviderAwaitVSyncResponseParamsFactory(int timeStamp) {
|
| - var mojo_factory_result = new VSyncProviderAwaitVSyncResponseParams();
|
| - mojo_factory_result.timeStamp = timeStamp;
|
| + NativeViewportEventDispatcherOnEventResponseParams _NativeViewportEventDispatcherOnEventResponseParamsFactory() {
|
| + var mojo_factory_result = new NativeViewportEventDispatcherOnEventResponseParams();
|
| return mojo_factory_result;
|
| }
|
|
|
| @@ -321,16 +303,16 @@ class VSyncProviderStub extends bindings.Stub {
|
| }
|
| assert(_impl != null);
|
| switch (message.header.type) {
|
| - case _VSyncProvider_awaitVSyncName:
|
| - var params = _VSyncProviderAwaitVSyncParams.deserialize(
|
| + case _NativeViewportEventDispatcher_onEventName:
|
| + var params = _NativeViewportEventDispatcherOnEventParams.deserialize(
|
| message.payload);
|
| - var response = _impl.awaitVSync(_VSyncProviderAwaitVSyncResponseParamsFactory);
|
| + var response = _impl.onEvent(params.event,_NativeViewportEventDispatcherOnEventResponseParamsFactory);
|
| if (response is Future) {
|
| return response.then((response) {
|
| if (response != null) {
|
| return buildResponseWithId(
|
| response,
|
| - _VSyncProvider_awaitVSyncName,
|
| + _NativeViewportEventDispatcher_onEventName,
|
| message.header.requestId,
|
| bindings.MessageHeader.kMessageIsResponse);
|
| }
|
| @@ -338,7 +320,7 @@ class VSyncProviderStub extends bindings.Stub {
|
| } else if (response != null) {
|
| return buildResponseWithId(
|
| response,
|
| - _VSyncProvider_awaitVSyncName,
|
| + _NativeViewportEventDispatcher_onEventName,
|
| message.header.requestId,
|
| bindings.MessageHeader.kMessageIsResponse);
|
| }
|
| @@ -350,22 +332,18 @@ class VSyncProviderStub extends bindings.Stub {
|
| return null;
|
| }
|
|
|
| - VSyncProvider get impl => _impl;
|
| - set impl(VSyncProvider d) {
|
| + NativeViewportEventDispatcher get impl => _impl;
|
| + set impl(NativeViewportEventDispatcher d) {
|
| assert(_impl == null);
|
| _impl = d;
|
| }
|
|
|
| String toString() {
|
| var superString = super.toString();
|
| - return "VSyncProviderStub($superString)";
|
| + return "NativeViewportEventDispatcherStub($superString)";
|
| }
|
|
|
| int get version => 0;
|
| -
|
| - service_describer.ServiceDescription get serviceDescription =>
|
| - new _VSyncProviderServiceDescription();
|
| }
|
|
|
|
|
| -
|
|
|