| 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]) => null; |
| 235 |
| 236 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) =
> |
| 237 null; |
| 238 |
| 239 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null; |
| 240 } |
| 241 |
| 222 abstract class AssetBundle { | 242 abstract class AssetBundle { |
| 223 static const String serviceName = "mojo::asset_bundle::AssetBundle"; | 243 static const String serviceName = "mojo::asset_bundle::AssetBundle"; |
| 224 dynamic getAsStream(String assetName,[Function responseFactory = null]); | 244 dynamic getAsStream(String assetName,[Function responseFactory = null]); |
| 225 } | 245 } |
| 226 | 246 |
| 227 | 247 |
| 228 class _AssetBundleProxyImpl extends bindings.Proxy { | 248 class _AssetBundleProxyImpl extends bindings.Proxy { |
| 229 _AssetBundleProxyImpl.fromEndpoint( | 249 _AssetBundleProxyImpl.fromEndpoint( |
| 230 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 250 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 231 | 251 |
| 232 _AssetBundleProxyImpl.fromHandle(core.MojoHandle handle) : | 252 _AssetBundleProxyImpl.fromHandle(core.MojoHandle handle) : |
| 233 super.fromHandle(handle); | 253 super.fromHandle(handle); |
| 234 | 254 |
| 235 _AssetBundleProxyImpl.unbound() : super.unbound(); | 255 _AssetBundleProxyImpl.unbound() : super.unbound(); |
| 236 | 256 |
| 237 static _AssetBundleProxyImpl newFromEndpoint( | 257 static _AssetBundleProxyImpl newFromEndpoint( |
| 238 core.MojoMessagePipeEndpoint endpoint) { | 258 core.MojoMessagePipeEndpoint endpoint) { |
| 239 assert(endpoint.setDescription("For _AssetBundleProxyImpl")); | 259 assert(endpoint.setDescription("For _AssetBundleProxyImpl")); |
| 240 return new _AssetBundleProxyImpl.fromEndpoint(endpoint); | 260 return new _AssetBundleProxyImpl.fromEndpoint(endpoint); |
| 241 } | 261 } |
| 242 | 262 |
| 263 service_describer.ServiceDescription get serviceDescription => |
| 264 new _AssetBundleServiceDescription(); |
| 265 |
| 243 void handleResponse(bindings.ServiceMessage message) { | 266 void handleResponse(bindings.ServiceMessage message) { |
| 244 switch (message.header.type) { | 267 switch (message.header.type) { |
| 245 case _AssetBundle_getAsStreamName: | 268 case _AssetBundle_getAsStreamName: |
| 246 var r = AssetBundleGetAsStreamResponseParams.deserialize( | 269 var r = AssetBundleGetAsStreamResponseParams.deserialize( |
| 247 message.payload); | 270 message.payload); |
| 248 if (!message.header.hasRequestId) { | 271 if (!message.header.hasRequestId) { |
| 249 proxyError("Expected a message with a valid request Id."); | 272 proxyError("Expected a message with a valid request Id."); |
| 250 return; | 273 return; |
| 251 } | 274 } |
| 252 Completer c = completerMap[message.header.requestId]; | 275 Completer c = completerMap[message.header.requestId]; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 assert(_impl == null); | 441 assert(_impl == null); |
| 419 _impl = d; | 442 _impl = d; |
| 420 } | 443 } |
| 421 | 444 |
| 422 String toString() { | 445 String toString() { |
| 423 var superString = super.toString(); | 446 var superString = super.toString(); |
| 424 return "AssetBundleStub($superString)"; | 447 return "AssetBundleStub($superString)"; |
| 425 } | 448 } |
| 426 | 449 |
| 427 int get version => 0; | 450 int get version => 0; |
| 451 |
| 452 service_describer.ServiceDescription get serviceDescription => |
| 453 new _AssetBundleServiceDescription(); |
| 428 } | 454 } |
| 429 | 455 |
| 430 const int _AssetUnpacker_unpackZipStreamName = 0; | 456 const int _AssetUnpacker_unpackZipStreamName = 0; |
| 431 | 457 |
| 458 |
| 459 |
| 460 class _AssetUnpackerServiceDescription implements service_describer.ServiceDescr
iption { |
| 461 dynamic getTopLevelInterface([Function responseFactory = null]) => null; |
| 462 |
| 463 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) =
> |
| 464 null; |
| 465 |
| 466 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null; |
| 467 } |
| 468 |
| 432 abstract class AssetUnpacker { | 469 abstract class AssetUnpacker { |
| 433 static const String serviceName = "mojo::asset_bundle::AssetUnpacker"; | 470 static const String serviceName = "mojo::asset_bundle::AssetUnpacker"; |
| 434 void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundl
e); | 471 void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundl
e); |
| 435 } | 472 } |
| 436 | 473 |
| 437 | 474 |
| 438 class _AssetUnpackerProxyImpl extends bindings.Proxy { | 475 class _AssetUnpackerProxyImpl extends bindings.Proxy { |
| 439 _AssetUnpackerProxyImpl.fromEndpoint( | 476 _AssetUnpackerProxyImpl.fromEndpoint( |
| 440 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 477 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 441 | 478 |
| 442 _AssetUnpackerProxyImpl.fromHandle(core.MojoHandle handle) : | 479 _AssetUnpackerProxyImpl.fromHandle(core.MojoHandle handle) : |
| 443 super.fromHandle(handle); | 480 super.fromHandle(handle); |
| 444 | 481 |
| 445 _AssetUnpackerProxyImpl.unbound() : super.unbound(); | 482 _AssetUnpackerProxyImpl.unbound() : super.unbound(); |
| 446 | 483 |
| 447 static _AssetUnpackerProxyImpl newFromEndpoint( | 484 static _AssetUnpackerProxyImpl newFromEndpoint( |
| 448 core.MojoMessagePipeEndpoint endpoint) { | 485 core.MojoMessagePipeEndpoint endpoint) { |
| 449 assert(endpoint.setDescription("For _AssetUnpackerProxyImpl")); | 486 assert(endpoint.setDescription("For _AssetUnpackerProxyImpl")); |
| 450 return new _AssetUnpackerProxyImpl.fromEndpoint(endpoint); | 487 return new _AssetUnpackerProxyImpl.fromEndpoint(endpoint); |
| 451 } | 488 } |
| 452 | 489 |
| 490 service_describer.ServiceDescription get serviceDescription => |
| 491 new _AssetUnpackerServiceDescription(); |
| 492 |
| 453 void handleResponse(bindings.ServiceMessage message) { | 493 void handleResponse(bindings.ServiceMessage message) { |
| 454 switch (message.header.type) { | 494 switch (message.header.type) { |
| 455 default: | 495 default: |
| 456 proxyError("Unexpected message type: ${message.header.type}"); | 496 proxyError("Unexpected message type: ${message.header.type}"); |
| 457 close(immediate: true); | 497 close(immediate: true); |
| 458 break; | 498 break; |
| 459 } | 499 } |
| 460 } | 500 } |
| 461 | 501 |
| 462 String toString() { | 502 String toString() { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 assert(_impl == null); | 627 assert(_impl == null); |
| 588 _impl = d; | 628 _impl = d; |
| 589 } | 629 } |
| 590 | 630 |
| 591 String toString() { | 631 String toString() { |
| 592 var superString = super.toString(); | 632 var superString = super.toString(); |
| 593 return "AssetUnpackerStub($superString)"; | 633 return "AssetUnpackerStub($superString)"; |
| 594 } | 634 } |
| 595 | 635 |
| 596 int get version => 0; | 636 int get version => 0; |
| 637 |
| 638 service_describer.ServiceDescription get serviceDescription => |
| 639 new _AssetUnpackerServiceDescription(); |
| 597 } | 640 } |
| 598 | 641 |
| 599 | 642 |
| 643 |
| 644 |
| OLD | NEW |