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

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

Issue 1640773005: Make it possible to share the embedder's dart sources for the vmservice (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « runtime/vm/service_isolate.cc ('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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 continue; 52 continue;
53 } 53 }
54 assets[asset.name] = asset; 54 assets[asset.name] = asset;
55 } 55 }
56 return assets; 56 return assets;
57 } 57 }
58 58
59 String toString() => '$name ($mimeType)'; 59 String toString() => '$name ($mimeType)';
60 } 60 }
61 61
62 HashMap<String, Asset> _assets;
63 HashMap<String, Asset> get assets {
64 if (_assets == null) {
65 try {
66 _assets = Asset.request();
67 } catch (e) {
68 print('Could not load Observatory assets: $e');
69 }
70 }
71 return _assets;
72 }
62 73
63 class _ByteStream { 74 class _ByteStream {
64 final Uint8List bytes; 75 final Uint8List bytes;
65 final int offset; 76 final int offset;
66 int get length => bytes.length - offset; 77 int get length => bytes.length - offset;
67 int _cursor = 0; 78 int _cursor = 0;
68 79
69 _ByteStream(this.bytes, [this.offset = 0]); 80 _ByteStream(this.bytes, [this.offset = 0]);
70 81
71 void reset() { 82 void reset() {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 int type = _readType(_bs); 207 int type = _readType(_bs);
197 _bs.seekToNextBlock(tarHeaderSize); 208 _bs.seekToNextBlock(tarHeaderSize);
198 if (type != tarHeaderFileType) { 209 if (type != tarHeaderFileType) {
199 _skipContents(_bs, size); 210 _skipContents(_bs, size);
200 return null; 211 return null;
201 } 212 }
202 Uint8List bytes = _readContents(_bs, size); 213 Uint8List bytes = _readContents(_bs, size);
203 return new Asset(filename, bytes); 214 return new Asset(filename, bytes);
204 } 215 }
205 } 216 }
OLDNEW
« no previous file with comments | « runtime/vm/service_isolate.cc ('k') | sdk/lib/vmservice/vmservice.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698