OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 @patch | 5 @patch |
6 class Asset { | 6 class Asset { |
7 /// Call to request assets from the embedder. | 7 /// Call to request assets from the embedder. |
8 @patch | 8 @patch |
9 static HashMap<String, Asset> request() { | 9 static HashMap<String, Asset> request() { |
10 HashMap<String, Asset> assets = new HashMap<String, Asset>(); | |
11 Uint8List tarBytes = _requestAssets(); | 10 Uint8List tarBytes = _requestAssets(); |
12 if (tarBytes == null) { | 11 if (tarBytes == null) { |
13 return assets; | 12 return null; |
14 } | 13 } |
15 List assetList = _decodeAssets(tarBytes); | 14 List assetList = _decodeAssets(tarBytes); |
| 15 HashMap<String, Asset> assets = new HashMap<String, Asset>(); |
16 for (int i = 0; i < assetList.length; i += 2) { | 16 for (int i = 0; i < assetList.length; i += 2) { |
17 var a = new Asset(assetList[i], assetList[i + 1]); | 17 var a = new Asset(assetList[i], assetList[i + 1]); |
18 assets[a.name] = a; | 18 assets[a.name] = a; |
19 } | 19 } |
20 return assets; | 20 return assets; |
21 } | 21 } |
22 } | 22 } |
23 | 23 |
24 List _decodeAssets(Uint8List data) native "VMService_DecodeAssets"; | 24 List _decodeAssets(Uint8List data) native "VMService_DecodeAssets"; |
25 | 25 |
(...skipping 13 matching lines...) Expand all Loading... |
39 void onServerAddressChange(String address) | 39 void onServerAddressChange(String address) |
40 native "VMService_OnServerAddressChange"; | 40 native "VMService_OnServerAddressChange"; |
41 @patch | 41 @patch |
42 bool _vmListenStream(String streamId) native "VMService_ListenStream"; | 42 bool _vmListenStream(String streamId) native "VMService_ListenStream"; |
43 @patch | 43 @patch |
44 void _vmCancelStream(String streamId) native "VMService_CancelStream"; | 44 void _vmCancelStream(String streamId) native "VMService_CancelStream"; |
45 @patch | 45 @patch |
46 Uint8List _requestAssets() native "VMService_RequestAssets"; | 46 Uint8List _requestAssets() native "VMService_RequestAssets"; |
47 @patch | 47 @patch |
48 void _spawnUriNotify(obj, String token) native "VMService_spawnUriNotify"; | 48 void _spawnUriNotify(obj, String token) native "VMService_spawnUriNotify"; |
OLD | NEW |