| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 import 'dart:typed_data'; | |
| 8 | 7 |
| 9 import 'package:mojo/core.dart' as core; | 8 import 'package:mojo/core.dart' as core; |
| 10 import 'package:mojom/mojo/asset_bundle/asset_bundle.mojom.dart'; | 9 import 'package:mojom/mojo/asset_bundle/asset_bundle.mojom.dart'; |
| 11 | 10 |
| 12 import 'shell.dart' as shell; | 11 import 'shell.dart' as shell; |
| 13 import 'net/fetch.dart'; | 12 import 'net/fetch.dart'; |
| 14 | 13 |
| 15 Future<sky.Image> _decodeImage(core.MojoDataPipeConsumer assetData) { | 14 Future<sky.Image> _decodeImage(core.MojoDataPipeConsumer assetData) { |
| 16 Completer<sky.Image> completer = new Completer(); | 15 Completer<sky.Image> completer = new Completer(); |
| 17 new sky.ImageDecoder(assetData.handle.h, completer.complete); | 16 new sky.ImageDecoder(assetData.handle.h, completer.complete); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 39 core.MojoDataPipeConsumer bundleData = (await fetchUrl(url)).body; | 38 core.MojoDataPipeConsumer bundleData = (await fetchUrl(url)).body; |
| 40 | 39 |
| 41 AssetUnpackerProxy unpacker = new AssetUnpackerProxy.unbound(); | 40 AssetUnpackerProxy unpacker = new AssetUnpackerProxy.unbound(); |
| 42 shell.requestService("mojo:asset_bundle", unpacker); | 41 shell.requestService("mojo:asset_bundle", unpacker); |
| 43 AssetBundleProxy bundle = new AssetBundleProxy.unbound(); | 42 AssetBundleProxy bundle = new AssetBundleProxy.unbound(); |
| 44 unpacker.ptr.unpackZipStream(bundleData, bundle); | 43 unpacker.ptr.unpackZipStream(bundleData, bundle); |
| 45 unpacker.close(); | 44 unpacker.close(); |
| 46 | 45 |
| 47 return new AssetBundle(bundle); | 46 return new AssetBundle(bundle); |
| 48 } | 47 } |
| OLD | NEW |