Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: sky/sdk/lib/mojo/asset_bundle.dart

Issue 1193763004: Expose the asset_bundle service in SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: use source_set Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/services/BUILD.gn ('k') | sky/shell/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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'; 7 import 'dart:typed_data';
8 8
9 import 'package:mojo/core.dart' as core; 9 import 'package:mojo/core.dart' as core;
10 import 'package:mojom/mojo/asset_bundle/asset_bundle.mojom.dart'; 10 import 'package:mojom/mojo/asset_bundle/asset_bundle.mojom.dart';
(...skipping 18 matching lines...) Expand all
29 Future<sky.Image> fetchImage(String path) async { 29 Future<sky.Image> fetchImage(String path) async {
30 core.MojoDataPipeConsumer assetData = 30 core.MojoDataPipeConsumer assetData =
31 (await _bundle.ptr.getAsStream(path)).assetData; 31 (await _bundle.ptr.getAsStream(path)).assetData;
32 return await _decodeImage(assetData); 32 return await _decodeImage(assetData);
33 } 33 }
34 34
35 AssetBundleProxy _bundle; 35 AssetBundleProxy _bundle;
36 } 36 }
37 37
38 Future<AssetBundle> fetchAssetBundle(String url) async { 38 Future<AssetBundle> fetchAssetBundle(String url) async {
39 assert(false); // mojo:asset_bundle doesn't exist yet, see https://codereview. chromium.org/1176153007
40 core.MojoDataPipeConsumer bundleData = (await fetchUrl(url)).body; 39 core.MojoDataPipeConsumer bundleData = (await fetchUrl(url)).body;
41 40
42 AssetUnpackerProxy unpacker = new AssetUnpackerProxy.unbound(); 41 AssetUnpackerProxy unpacker = new AssetUnpackerProxy.unbound();
43 shell.requestService("mojo:asset_bundle", unpacker); 42 shell.requestService("mojo:asset_bundle", unpacker);
44 AssetBundleProxy bundle = new AssetBundleProxy.unbound(); 43 AssetBundleProxy bundle = new AssetBundleProxy.unbound();
45 unpacker.ptr.unpackZipStream(bundleData, bundle); 44 unpacker.ptr.unpackZipStream(bundleData, bundle);
46 unpacker.close(); 45 unpacker.close();
47 46
48 return new AssetBundle(bundle); 47 return new AssetBundle(bundle);
49 } 48 }
OLDNEW
« no previous file with comments | « mojo/services/BUILD.gn ('k') | sky/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698