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

Side by Side Diff: sdk/lib/vmservice/asset.dart

Issue 1474603003: Move tar archive parsing to C++ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years 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 | « runtime/vm/bootstrap_natives.h ('k') | sdk/lib/vmservice/vmservice.dart » ('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 (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 part of dart._vmservice; 5 part of dart._vmservice;
6 6
7 class Asset { 7 class Asset {
8 final String name; 8 final String name;
9 final Uint8List data; 9 final Uint8List data;
10 10
(...skipping 20 matching lines...) Expand all
31 case 'jpeg': 31 case 'jpeg':
32 return 'image/jpeg'; 32 return 'image/jpeg';
33 case 'svg': 33 case 'svg':
34 return 'image/svg+xml'; 34 return 'image/svg+xml';
35 default: 35 default:
36 return 'text/plain'; 36 return 'text/plain';
37 } 37 }
38 } 38 }
39 39
40 /// Call to request assets from the embedder. 40 /// Call to request assets from the embedder.
41 static Map<String, Asset> request() { 41 static HashMap<String, Asset> request() {
42 Map<String, Asset> assets = new Map<String, Asset>(); 42 HashMap<String, Asset> assets = new HashMap<String, Asset>();
43 Uint8List tarBytes = _requestAssets(); 43 Uint8List tarBytes = _requestAssets();
44 if (tarBytes == null) { 44 if (tarBytes == null) {
45 return assets; 45 return assets;
46 } 46 }
47 _TarArchive archive = new _TarArchive(tarBytes); 47 _TarArchive archive = new _TarArchive(tarBytes);
48 while (archive.hasNext()) { 48 while (archive.hasNext()) {
49 Asset asset = archive.next(); 49 Asset asset = archive.next();
50 if (asset == null) { 50 if (asset == null) {
51 // Skip over special files. 51 // Skip over special files.
52 continue; 52 continue;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 int type = _readType(_bs); 196 int type = _readType(_bs);
197 _bs.seekToNextBlock(tarHeaderSize); 197 _bs.seekToNextBlock(tarHeaderSize);
198 if (type != tarHeaderFileType) { 198 if (type != tarHeaderFileType) {
199 _skipContents(_bs, size); 199 _skipContents(_bs, size);
200 return null; 200 return null;
201 } 201 }
202 Uint8List bytes = _readContents(_bs, size); 202 Uint8List bytes = _readContents(_bs, size);
203 return new Asset(filename, bytes); 203 return new Asset(filename, bytes);
204 } 204 }
205 } 205 }
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | sdk/lib/vmservice/vmservice.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698