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

Side by Side Diff: pkg/compiler/lib/src/dart2js.dart

Issue 2897903003: Support loading binary data in dart2js (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.cmdline; 5 library dart2js.cmdline;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 import 'dart:convert' show UTF8, LineSplitter; 8 import 'dart:convert' show UTF8, LineSplitter;
9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr;
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void setBazelPaths(String argument) { 194 void setBazelPaths(String argument) {
195 String paths = extractParameter(argument); 195 String paths = extractParameter(argument);
196 bazelPaths = <String>[]..addAll(paths.split(',')); 196 bazelPaths = <String>[]..addAll(paths.split(','));
197 } 197 }
198 198
199 void setResolveOnly(String argument) { 199 void setResolveOnly(String argument) {
200 resolveOnly = true; 200 resolveOnly = true;
201 passThrough(argument); 201 passThrough(argument);
202 } 202 }
203 203
204 String getDepsOutput(Map<Uri, SourceFile> sourceFiles) { 204 String getDepsOutput(Map<Uri, api.Input> sourceFiles) {
205 var filenames = sourceFiles.keys.map((uri) => '$uri').toList(); 205 var filenames = sourceFiles.keys.map((uri) => '$uri').toList();
206 filenames.sort(); 206 filenames.sort();
207 return filenames.join("\n"); 207 return filenames.join("\n");
208 } 208 }
209 209
210 implyCompilation(String argument) { 210 implyCompilation(String argument) {
211 optionsImplyCompilation.add(argument); 211 optionsImplyCompilation.add(argument);
212 passThrough(argument); 212 passThrough(argument);
213 } 213 }
214 214
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 compileFunc = generateSerializedDataForDartCore; 1030 compileFunc = generateSerializedDataForDartCore;
1031 } 1031 }
1032 1032
1033 class _CompilerInput implements api.CompilerInput { 1033 class _CompilerInput implements api.CompilerInput {
1034 final api.CompilerInput _input; 1034 final api.CompilerInput _input;
1035 final Map<Uri, String> _data; 1035 final Map<Uri, String> _data;
1036 1036
1037 _CompilerInput(this._input, this._data); 1037 _CompilerInput(this._input, this._data);
1038 1038
1039 @override 1039 @override
1040 Future readFromUri(Uri uri) { 1040 Future<api.Input> readFromUri(Uri uri,
1041 {api.InputKind inputKind: api.InputKind.utf8}) {
1041 String data = _data[uri]; 1042 String data = _data[uri];
1042 if (data != null) { 1043 if (data != null) {
1043 return new Future.value(data); 1044 return new Future.value(new StringSourceFile.fromUri(uri, data));
1044 } 1045 }
1045 return _input.readFromUri(uri); 1046 return _input.readFromUri(uri, inputKind: inputKind);
1046 } 1047 }
1047 } 1048 }
1048 1049
1049 class _SerializedData { 1050 class _SerializedData {
1050 final Uri uri; 1051 final Uri uri;
1051 final String data; 1052 final String data;
1052 1053
1053 _SerializedData(this.uri, this.data); 1054 _SerializedData(this.uri, this.data);
1054 } 1055 }
1055 1056
(...skipping 23 matching lines...) Expand all
1079 @override 1080 @override
1080 void add(String event) { 1081 void add(String event) {
1081 sb.write(event); 1082 sb.write(event);
1082 } 1083 }
1083 1084
1084 @override 1085 @override
1085 void close() { 1086 void close() {
1086 // Do nothing. 1087 // Do nothing.
1087 } 1088 }
1088 } 1089 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698