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 asset_bundle_mojom; | 5 library asset_bundle_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 | 14 |
13 | 15 |
14 class _AssetBundleGetAsStreamParams extends bindings.Struct { | 16 class _AssetBundleGetAsStreamParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 17 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(16, 0) | 18 const bindings.StructDataHeader(16, 0) |
17 ]; | 19 ]; |
18 String assetName = null; | 20 String assetName = null; |
19 | 21 |
20 _AssetBundleGetAsStreamParams() : super(kVersions.last.size); | 22 _AssetBundleGetAsStreamParams() : super(kVersions.last.size); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 73 } |
72 | 74 |
73 Map toJson() { | 75 Map toJson() { |
74 Map map = new Map(); | 76 Map map = new Map(); |
75 map["assetName"] = assetName; | 77 map["assetName"] = assetName; |
76 return map; | 78 return map; |
77 } | 79 } |
78 } | 80 } |
79 | 81 |
80 | 82 |
| 83 |
| 84 |
81 class AssetBundleGetAsStreamResponseParams extends bindings.Struct { | 85 class AssetBundleGetAsStreamResponseParams extends bindings.Struct { |
82 static const List<bindings.StructDataHeader> kVersions = const [ | 86 static const List<bindings.StructDataHeader> kVersions = const [ |
83 const bindings.StructDataHeader(16, 0) | 87 const bindings.StructDataHeader(16, 0) |
84 ]; | 88 ]; |
85 core.MojoDataPipeConsumer assetData = null; | 89 core.MojoDataPipeConsumer assetData = null; |
86 | 90 |
87 AssetBundleGetAsStreamResponseParams() : super(kVersions.last.size); | 91 AssetBundleGetAsStreamResponseParams() : super(kVersions.last.size); |
88 | 92 |
89 static AssetBundleGetAsStreamResponseParams deserialize(bindings.Message messa
ge) { | 93 static AssetBundleGetAsStreamResponseParams deserialize(bindings.Message messa
ge) { |
90 var decoder = new bindings.Decoder(message); | 94 var decoder = new bindings.Decoder(message); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 "assetData: $assetData" ")"; | 141 "assetData: $assetData" ")"; |
138 } | 142 } |
139 | 143 |
140 Map toJson() { | 144 Map toJson() { |
141 throw new bindings.MojoCodecError( | 145 throw new bindings.MojoCodecError( |
142 'Object containing handles cannot be encoded to JSON.'); | 146 'Object containing handles cannot be encoded to JSON.'); |
143 } | 147 } |
144 } | 148 } |
145 | 149 |
146 | 150 |
| 151 |
| 152 |
147 class _AssetUnpackerUnpackZipStreamParams extends bindings.Struct { | 153 class _AssetUnpackerUnpackZipStreamParams extends bindings.Struct { |
148 static const List<bindings.StructDataHeader> kVersions = const [ | 154 static const List<bindings.StructDataHeader> kVersions = const [ |
149 const bindings.StructDataHeader(16, 0) | 155 const bindings.StructDataHeader(16, 0) |
150 ]; | 156 ]; |
151 core.MojoDataPipeConsumer zippedAssets = null; | 157 core.MojoDataPipeConsumer zippedAssets = null; |
152 Object assetBundle = null; | 158 Object assetBundle = null; |
153 | 159 |
154 _AssetUnpackerUnpackZipStreamParams() : super(kVersions.last.size); | 160 _AssetUnpackerUnpackZipStreamParams() : super(kVersions.last.size); |
155 | 161 |
156 static _AssetUnpackerUnpackZipStreamParams deserialize(bindings.Message messag
e) { | 162 static _AssetUnpackerUnpackZipStreamParams deserialize(bindings.Message messag
e) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 "zippedAssets: $zippedAssets" ", " | 216 "zippedAssets: $zippedAssets" ", " |
211 "assetBundle: $assetBundle" ")"; | 217 "assetBundle: $assetBundle" ")"; |
212 } | 218 } |
213 | 219 |
214 Map toJson() { | 220 Map toJson() { |
215 throw new bindings.MojoCodecError( | 221 throw new bindings.MojoCodecError( |
216 'Object containing handles cannot be encoded to JSON.'); | 222 'Object containing handles cannot be encoded to JSON.'); |
217 } | 223 } |
218 } | 224 } |
219 | 225 |
| 226 |
| 227 |
| 228 |
220 const int _AssetBundle_getAsStreamName = 0; | 229 const int _AssetBundle_getAsStreamName = 0; |
221 | 230 |
| 231 |
| 232 |
| 233 class _AssetBundleServiceDescription implements service_describer.ServiceDescrip
tion { |
| 234 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 235 |
| 236 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 237 |
| 238 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 239 } |
| 240 |
222 abstract class AssetBundle { | 241 abstract class AssetBundle { |
223 static const String serviceName = "mojo::asset_bundle::AssetBundle"; | 242 static const String serviceName = "mojo::asset_bundle::AssetBundle"; |
224 dynamic getAsStream(String assetName,[Function responseFactory = null]); | 243 dynamic getAsStream(String assetName,[Function responseFactory = null]); |
225 } | 244 } |
226 | 245 |
227 | 246 |
228 class _AssetBundleProxyImpl extends bindings.Proxy { | 247 class _AssetBundleProxyImpl extends bindings.Proxy { |
229 _AssetBundleProxyImpl.fromEndpoint( | 248 _AssetBundleProxyImpl.fromEndpoint( |
230 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 249 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
231 | 250 |
232 _AssetBundleProxyImpl.fromHandle(core.MojoHandle handle) : | 251 _AssetBundleProxyImpl.fromHandle(core.MojoHandle handle) : |
233 super.fromHandle(handle); | 252 super.fromHandle(handle); |
234 | 253 |
235 _AssetBundleProxyImpl.unbound() : super.unbound(); | 254 _AssetBundleProxyImpl.unbound() : super.unbound(); |
236 | 255 |
237 static _AssetBundleProxyImpl newFromEndpoint( | 256 static _AssetBundleProxyImpl newFromEndpoint( |
238 core.MojoMessagePipeEndpoint endpoint) { | 257 core.MojoMessagePipeEndpoint endpoint) { |
239 assert(endpoint.setDescription("For _AssetBundleProxyImpl")); | 258 assert(endpoint.setDescription("For _AssetBundleProxyImpl")); |
240 return new _AssetBundleProxyImpl.fromEndpoint(endpoint); | 259 return new _AssetBundleProxyImpl.fromEndpoint(endpoint); |
241 } | 260 } |
242 | 261 |
| 262 service_describer.ServiceDescription get serviceDescription => |
| 263 new _AssetBundleServiceDescription(); |
| 264 |
243 void handleResponse(bindings.ServiceMessage message) { | 265 void handleResponse(bindings.ServiceMessage message) { |
244 switch (message.header.type) { | 266 switch (message.header.type) { |
245 case _AssetBundle_getAsStreamName: | 267 case _AssetBundle_getAsStreamName: |
246 var r = AssetBundleGetAsStreamResponseParams.deserialize( | 268 var r = AssetBundleGetAsStreamResponseParams.deserialize( |
247 message.payload); | 269 message.payload); |
248 if (!message.header.hasRequestId) { | 270 if (!message.header.hasRequestId) { |
249 proxyError("Expected a message with a valid request Id."); | 271 proxyError("Expected a message with a valid request Id."); |
250 return; | 272 return; |
251 } | 273 } |
252 Completer c = completerMap[message.header.requestId]; | 274 Completer c = completerMap[message.header.requestId]; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 assert(_impl == null); | 440 assert(_impl == null); |
419 _impl = d; | 441 _impl = d; |
420 } | 442 } |
421 | 443 |
422 String toString() { | 444 String toString() { |
423 var superString = super.toString(); | 445 var superString = super.toString(); |
424 return "AssetBundleStub($superString)"; | 446 return "AssetBundleStub($superString)"; |
425 } | 447 } |
426 | 448 |
427 int get version => 0; | 449 int get version => 0; |
| 450 |
| 451 service_describer.ServiceDescription get serviceDescription => |
| 452 new _AssetBundleServiceDescription(); |
428 } | 453 } |
429 | 454 |
430 const int _AssetUnpacker_unpackZipStreamName = 0; | 455 const int _AssetUnpacker_unpackZipStreamName = 0; |
431 | 456 |
| 457 |
| 458 |
| 459 class _AssetUnpackerServiceDescription implements service_describer.ServiceDescr
iption { |
| 460 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 461 |
| 462 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 463 |
| 464 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 465 } |
| 466 |
432 abstract class AssetUnpacker { | 467 abstract class AssetUnpacker { |
433 static const String serviceName = "mojo::asset_bundle::AssetUnpacker"; | 468 static const String serviceName = "mojo::asset_bundle::AssetUnpacker"; |
434 void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundl
e); | 469 void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundl
e); |
435 } | 470 } |
436 | 471 |
437 | 472 |
438 class _AssetUnpackerProxyImpl extends bindings.Proxy { | 473 class _AssetUnpackerProxyImpl extends bindings.Proxy { |
439 _AssetUnpackerProxyImpl.fromEndpoint( | 474 _AssetUnpackerProxyImpl.fromEndpoint( |
440 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 475 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
441 | 476 |
442 _AssetUnpackerProxyImpl.fromHandle(core.MojoHandle handle) : | 477 _AssetUnpackerProxyImpl.fromHandle(core.MojoHandle handle) : |
443 super.fromHandle(handle); | 478 super.fromHandle(handle); |
444 | 479 |
445 _AssetUnpackerProxyImpl.unbound() : super.unbound(); | 480 _AssetUnpackerProxyImpl.unbound() : super.unbound(); |
446 | 481 |
447 static _AssetUnpackerProxyImpl newFromEndpoint( | 482 static _AssetUnpackerProxyImpl newFromEndpoint( |
448 core.MojoMessagePipeEndpoint endpoint) { | 483 core.MojoMessagePipeEndpoint endpoint) { |
449 assert(endpoint.setDescription("For _AssetUnpackerProxyImpl")); | 484 assert(endpoint.setDescription("For _AssetUnpackerProxyImpl")); |
450 return new _AssetUnpackerProxyImpl.fromEndpoint(endpoint); | 485 return new _AssetUnpackerProxyImpl.fromEndpoint(endpoint); |
451 } | 486 } |
452 | 487 |
| 488 service_describer.ServiceDescription get serviceDescription => |
| 489 new _AssetUnpackerServiceDescription(); |
| 490 |
453 void handleResponse(bindings.ServiceMessage message) { | 491 void handleResponse(bindings.ServiceMessage message) { |
454 switch (message.header.type) { | 492 switch (message.header.type) { |
455 default: | 493 default: |
456 proxyError("Unexpected message type: ${message.header.type}"); | 494 proxyError("Unexpected message type: ${message.header.type}"); |
457 close(immediate: true); | 495 close(immediate: true); |
458 break; | 496 break; |
459 } | 497 } |
460 } | 498 } |
461 | 499 |
462 String toString() { | 500 String toString() { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 assert(_impl == null); | 625 assert(_impl == null); |
588 _impl = d; | 626 _impl = d; |
589 } | 627 } |
590 | 628 |
591 String toString() { | 629 String toString() { |
592 var superString = super.toString(); | 630 var superString = super.toString(); |
593 return "AssetUnpackerStub($superString)"; | 631 return "AssetUnpackerStub($superString)"; |
594 } | 632 } |
595 | 633 |
596 int get version => 0; | 634 int get version => 0; |
| 635 |
| 636 service_describer.ServiceDescription get serviceDescription => |
| 637 new _AssetUnpackerServiceDescription(); |
597 } | 638 } |
598 | 639 |
599 | 640 |
| 641 |
OLD | NEW |