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 media_clock_mojom; | 5 library media_clock_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/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
11 | 13 |
12 class ClockDisposition extends bindings.MojoEnum { | 14 class ClockDisposition extends bindings.MojoEnum { |
13 static const ClockDisposition passive = const ClockDisposition._(0); | 15 static const ClockDisposition passive = const ClockDisposition._(0); |
14 static const ClockDisposition slave = const ClockDisposition._(1); | 16 static const ClockDisposition slave = const ClockDisposition._(1); |
15 static const ClockDisposition preferSlave = const ClockDisposition._(2); | 17 static const ClockDisposition preferSlave = const ClockDisposition._(2); |
16 static const ClockDisposition indifferent = const ClockDisposition._(3); | 18 static const ClockDisposition indifferent = const ClockDisposition._(3); |
17 static const ClockDisposition preferMaster = const ClockDisposition._(4); | 19 static const ClockDisposition preferMaster = const ClockDisposition._(4); |
18 static const ClockDisposition master = const ClockDisposition._(5); | 20 static const ClockDisposition master = const ClockDisposition._(5); |
19 | 21 |
20 const ClockDisposition._(int v) : super(v); | 22 const ClockDisposition._(int v) : super(v); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 case slave: | 76 case slave: |
75 return 'ClockDisposition.slave'; | 77 return 'ClockDisposition.slave'; |
76 case preferSlave: | 78 case preferSlave: |
77 return 'ClockDisposition.preferSlave'; | 79 return 'ClockDisposition.preferSlave'; |
78 case indifferent: | 80 case indifferent: |
79 return 'ClockDisposition.indifferent'; | 81 return 'ClockDisposition.indifferent'; |
80 case preferMaster: | 82 case preferMaster: |
81 return 'ClockDisposition.preferMaster'; | 83 return 'ClockDisposition.preferMaster'; |
82 case master: | 84 case master: |
83 return 'ClockDisposition.master'; | 85 return 'ClockDisposition.master'; |
| 86 default: |
| 87 return null; |
84 } | 88 } |
85 } | 89 } |
86 | 90 |
87 int toJson() => mojoEnumValue; | 91 int toJson() => mojoEnumValue; |
88 } | 92 } |
89 | 93 |
90 | 94 |
91 | 95 |
| 96 |
| 97 |
| 98 |
| 99 |
| 100 |
| 101 class _ClockServiceDescription implements service_describer.ServiceDescription { |
| 102 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 103 |
| 104 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 105 |
| 106 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 107 } |
| 108 |
92 abstract class Clock { | 109 abstract class Clock { |
93 static const String serviceName = null; | 110 static const String serviceName = null; |
94 } | 111 } |
95 | 112 |
96 | 113 |
97 class _ClockProxyImpl extends bindings.Proxy { | 114 class _ClockProxyImpl extends bindings.Proxy { |
98 _ClockProxyImpl.fromEndpoint( | 115 _ClockProxyImpl.fromEndpoint( |
99 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 116 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
100 | 117 |
101 _ClockProxyImpl.fromHandle(core.MojoHandle handle) : | 118 _ClockProxyImpl.fromHandle(core.MojoHandle handle) : |
102 super.fromHandle(handle); | 119 super.fromHandle(handle); |
103 | 120 |
104 _ClockProxyImpl.unbound() : super.unbound(); | 121 _ClockProxyImpl.unbound() : super.unbound(); |
105 | 122 |
106 static _ClockProxyImpl newFromEndpoint( | 123 static _ClockProxyImpl newFromEndpoint( |
107 core.MojoMessagePipeEndpoint endpoint) { | 124 core.MojoMessagePipeEndpoint endpoint) { |
108 assert(endpoint.setDescription("For _ClockProxyImpl")); | 125 assert(endpoint.setDescription("For _ClockProxyImpl")); |
109 return new _ClockProxyImpl.fromEndpoint(endpoint); | 126 return new _ClockProxyImpl.fromEndpoint(endpoint); |
110 } | 127 } |
111 | 128 |
| 129 service_describer.ServiceDescription get serviceDescription => |
| 130 new _ClockServiceDescription(); |
| 131 |
112 void handleResponse(bindings.ServiceMessage message) { | 132 void handleResponse(bindings.ServiceMessage message) { |
113 switch (message.header.type) { | 133 switch (message.header.type) { |
114 default: | 134 default: |
115 proxyError("Unexpected message type: ${message.header.type}"); | 135 proxyError("Unexpected message type: ${message.header.type}"); |
116 close(immediate: true); | 136 close(immediate: true); |
117 break; | 137 break; |
118 } | 138 } |
119 } | 139 } |
120 | 140 |
121 String toString() { | 141 String toString() { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 assert(_impl == null); | 251 assert(_impl == null); |
232 _impl = d; | 252 _impl = d; |
233 } | 253 } |
234 | 254 |
235 String toString() { | 255 String toString() { |
236 var superString = super.toString(); | 256 var superString = super.toString(); |
237 return "ClockStub($superString)"; | 257 return "ClockStub($superString)"; |
238 } | 258 } |
239 | 259 |
240 int get version => 0; | 260 int get version => 0; |
| 261 |
| 262 service_describer.ServiceDescription get serviceDescription => |
| 263 new _ClockServiceDescription(); |
241 } | 264 } |
242 | 265 |
243 | 266 |
| 267 |
OLD | NEW |