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 icu_data_mojom; | 5 library icu_data_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 _IcuDataMapParams extends bindings.Struct { | 17 class _IcuDataMapParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(16, 0) | 19 const bindings.StructDataHeader(16, 0) |
17 ]; | 20 ]; |
18 String sha1hash = null; | 21 String sha1hash = null; |
19 | 22 |
20 _IcuDataMapParams() : super(kVersions.last.size); | 23 _IcuDataMapParams() : super(kVersions.last.size); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return "_IcuDataMapParams(" | 72 return "_IcuDataMapParams(" |
70 "sha1hash: $sha1hash" ")"; | 73 "sha1hash: $sha1hash" ")"; |
71 } | 74 } |
72 | 75 |
73 Map toJson() { | 76 Map toJson() { |
74 Map map = new Map(); | 77 Map map = new Map(); |
75 map["sha1hash"] = sha1hash; | 78 map["sha1hash"] = sha1hash; |
76 return map; | 79 return map; |
77 } | 80 } |
78 } | 81 } |
| 82 mojom_types.MojomStruct _icu_data_ICUData_Map_Params__() { |
| 83 return new mojom_types.MojomStruct() |
| 84 ..declData = (new mojom_types.DeclarationData() |
| 85 ..shortName = '_IcuDataMapParams' |
| 86 ..fullIdentifier = 'icu_data._IcuDataMapParams') |
| 87 ..fields = <mojom_types.StructField>[ |
| 88 new mojom_types.StructField() |
| 89 ..declData = (new mojom_types.DeclarationData()..shortName = 'Sha1hash') |
| 90 ..type = (new mojom_types.Type() |
| 91 ..stringType = (new mojom_types.StringType()..nullable = false)), |
| 92 ]; |
| 93 } |
79 | 94 |
80 | 95 |
81 class IcuDataMapResponseParams extends bindings.Struct { | 96 class IcuDataMapResponseParams extends bindings.Struct { |
82 static const List<bindings.StructDataHeader> kVersions = const [ | 97 static const List<bindings.StructDataHeader> kVersions = const [ |
83 const bindings.StructDataHeader(16, 0) | 98 const bindings.StructDataHeader(16, 0) |
84 ]; | 99 ]; |
85 core.MojoSharedBuffer icuData = null; | 100 core.MojoSharedBuffer icuData = null; |
86 | 101 |
87 IcuDataMapResponseParams() : super(kVersions.last.size); | 102 IcuDataMapResponseParams() : super(kVersions.last.size); |
88 | 103 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 String toString() { | 150 String toString() { |
136 return "IcuDataMapResponseParams(" | 151 return "IcuDataMapResponseParams(" |
137 "icuData: $icuData" ")"; | 152 "icuData: $icuData" ")"; |
138 } | 153 } |
139 | 154 |
140 Map toJson() { | 155 Map toJson() { |
141 throw new bindings.MojoCodecError( | 156 throw new bindings.MojoCodecError( |
142 'Object containing handles cannot be encoded to JSON.'); | 157 'Object containing handles cannot be encoded to JSON.'); |
143 } | 158 } |
144 } | 159 } |
| 160 mojom_types.MojomStruct _icu_data_ICUData_Map_ResponseParams__() { |
| 161 return new mojom_types.MojomStruct() |
| 162 ..declData = (new mojom_types.DeclarationData() |
| 163 ..shortName = 'IcuDataMapResponseParams' |
| 164 ..fullIdentifier = 'icu_data.IcuDataMapResponseParams') |
| 165 ..fields = <mojom_types.StructField>[ |
| 166 new mojom_types.StructField() |
| 167 ..declData = (new mojom_types.DeclarationData()..shortName = 'IcuData') |
| 168 ..type = (new mojom_types.Type() |
| 169 ..handleType = (new mojom_types.HandleType() |
| 170 ..kind = mojom_types.HandleTypeKind.sharedBuffer |
| 171 ..nullable = true)), |
| 172 ]; |
| 173 } |
| 174 |
145 | 175 |
146 const int _IcuData_mapName = 0; | 176 const int _IcuData_mapName = 0; |
147 | 177 |
| 178 mojom_types.MojomInterface _icu_data_ICUData__() { |
| 179 return new mojom_types.MojomInterface() |
| 180 ..declData = (new mojom_types.DeclarationData() |
| 181 ..shortName = 'IcuData' |
| 182 ..fullIdentifier = 'icu_data.IcuData') |
| 183 ..interfaceName = 'IcuData' |
| 184 ..methods = <int, mojom_types.MojomMethod>{ |
| 185 _IcuData_mapName: new mojom_types.MojomMethod() |
| 186 ..declData = (new mojom_types.DeclarationData()..shortName = 'Map') |
| 187 ..ordinal = _IcuData_mapName |
| 188 ..responseParams = _icu_data_ICUData_Map_ResponseParams__()..parameters
= _icu_data_ICUData_Map_Params__(), |
| 189 }; |
| 190 } |
| 191 |
| 192 class _IcuDataServiceDescription implements service_describer.ServiceDescription
{ |
| 193 dynamic getTopLevelInterface([Function responseFactory = null]) { |
| 194 return _icu_data_ICUData__(); |
| 195 } |
| 196 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
| 197 return getAllMojomTypeDefinitions()[typeKey]; |
| 198 } |
| 199 dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
| 200 return getAllMojomTypeDefinitions(); |
| 201 } |
| 202 } |
| 203 |
148 abstract class IcuData { | 204 abstract class IcuData { |
149 static const String serviceName = "icu_data::ICUData"; | 205 static const String serviceName = "icu_data::ICUData"; |
150 dynamic map(String sha1hash,[Function responseFactory = null]); | 206 dynamic map(String sha1hash,[Function responseFactory = null]); |
151 } | 207 } |
152 | 208 |
153 | 209 |
154 class _IcuDataProxyImpl extends bindings.Proxy { | 210 class _IcuDataProxyImpl extends bindings.Proxy { |
155 _IcuDataProxyImpl.fromEndpoint( | 211 _IcuDataProxyImpl.fromEndpoint( |
156 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 212 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
157 | 213 |
158 _IcuDataProxyImpl.fromHandle(core.MojoHandle handle) : | 214 _IcuDataProxyImpl.fromHandle(core.MojoHandle handle) : |
159 super.fromHandle(handle); | 215 super.fromHandle(handle); |
160 | 216 |
161 _IcuDataProxyImpl.unbound() : super.unbound(); | 217 _IcuDataProxyImpl.unbound() : super.unbound(); |
162 | 218 |
163 static _IcuDataProxyImpl newFromEndpoint( | 219 static _IcuDataProxyImpl newFromEndpoint( |
164 core.MojoMessagePipeEndpoint endpoint) { | 220 core.MojoMessagePipeEndpoint endpoint) { |
165 assert(endpoint.setDescription("For _IcuDataProxyImpl")); | 221 assert(endpoint.setDescription("For _IcuDataProxyImpl")); |
166 return new _IcuDataProxyImpl.fromEndpoint(endpoint); | 222 return new _IcuDataProxyImpl.fromEndpoint(endpoint); |
167 } | 223 } |
168 | 224 |
| 225 service_describer.ServiceDescription get serviceDescription => |
| 226 new _IcuDataServiceDescription(); |
| 227 |
169 void handleResponse(bindings.ServiceMessage message) { | 228 void handleResponse(bindings.ServiceMessage message) { |
170 switch (message.header.type) { | 229 switch (message.header.type) { |
171 case _IcuData_mapName: | 230 case _IcuData_mapName: |
172 var r = IcuDataMapResponseParams.deserialize( | 231 var r = IcuDataMapResponseParams.deserialize( |
173 message.payload); | 232 message.payload); |
174 if (!message.header.hasRequestId) { | 233 if (!message.header.hasRequestId) { |
175 proxyError("Expected a message with a valid request Id."); | 234 proxyError("Expected a message with a valid request Id."); |
176 return; | 235 return; |
177 } | 236 } |
178 Completer c = completerMap[message.header.requestId]; | 237 Completer c = completerMap[message.header.requestId]; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 assert(_impl == null); | 403 assert(_impl == null); |
345 _impl = d; | 404 _impl = d; |
346 } | 405 } |
347 | 406 |
348 String toString() { | 407 String toString() { |
349 var superString = super.toString(); | 408 var superString = super.toString(); |
350 return "IcuDataStub($superString)"; | 409 return "IcuDataStub($superString)"; |
351 } | 410 } |
352 | 411 |
353 int get version => 0; | 412 int get version => 0; |
| 413 |
| 414 |
| 415 service_describer.ServiceDescription get serviceDescription => |
| 416 new _IcuDataServiceDescription(); |
354 } | 417 } |
355 | 418 |
356 | 419 |
| 420 |
| 421 |
| 422 |
| 423 |
| 424 |
| 425 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 426 var map = new HashMap<String, mojom_types.UserDefinedType>(); |
| 427 map["_icu_data_ICUData_Map_Params__"] = |
| 428 new mojom_types.UserDefinedType() |
| 429 ..structType = _icu_data_ICUData_Map_Params__(); |
| 430 map["_icu_data_ICUData_Map_ResponseParams__"] = |
| 431 new mojom_types.UserDefinedType() |
| 432 ..structType = _icu_data_ICUData_Map_ResponseParams__(); |
| 433 map["_icu_data_ICUData__"] = |
| 434 new mojom_types.UserDefinedType() |
| 435 ..interfaceType = _icu_data_ICUData__(); |
| 436 |
| 437 return map; |
| 438 } |
| 439 |
| 440 var _MojomDesc; |
| 441 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 442 if (_MojomDesc == null) { |
| 443 _MojomDesc = _initDescriptions(); |
| 444 } |
| 445 return _MojomDesc; |
| 446 } |
| 447 |
OLD | NEW |