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

Unified Diff: pkg/compiler/lib/src/library_loader.dart

Issue 2897903003: Support loading binary data in dart2js (Closed)
Patch Set: Updated cf. comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/io/source_file.dart ('k') | pkg/compiler/lib/src/old_to_new_api.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/library_loader.dart
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index 52cc0dbea9a1361a9abf5ebb5ded761511bf7ab2..745608b681ba39fd435a40bbc0736b7b1f468b58 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -30,6 +30,7 @@ import 'elements/modelx.dart'
SyntheticImportElement;
import 'enqueue.dart' show DeferredAction;
import 'environment.dart';
+import 'io/source_file.dart' show Binary;
import 'kernel/element_map_impl.dart' show KernelToElementMapImpl;
import 'patch_parser.dart' show PatchParserTask;
import 'resolved_uri_translator.dart';
@@ -839,13 +840,9 @@ class DillLibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
'Invalid uri: $resolvedUri');
Uri readableUri = uriTranslator.translate(null, resolvedUri, null);
return measure(() async {
- Script script = await scriptLoader.readScript(readableUri, null);
+ Binary binary = await scriptLoader.readBinary(readableUri, null);
ir.Program program = new ir.Program();
- // Hack because the existing file has a terminating 0 and the
- // BinaryBuilder doesn't expect that.
- var bytes = new List<int>.from(script.file.slowUtf8ZeroTerminatedBytes());
- bytes.removeLast();
- new BinaryBuilder(bytes).readProgram(program);
+ new BinaryBuilder(binary.data).readProgram(program);
return measure(() {
return createLoadedLibraries(program);
});
@@ -1657,6 +1654,10 @@ abstract class ScriptLoader {
/// Load script from a readable [uri], report any errors using the location of
/// the given [spannable].
Future<Script> readScript(Uri uri, [Spannable spannable]);
+
+ /// Load a binary from a readable [uri], report any errors using the location
+ /// of the given [spannable].
+ Future<Binary> readBinary(Uri uri, [Spannable spannable]);
}
/// API used by the library loader to synchronously scan a library or
« no previous file with comments | « pkg/compiler/lib/src/io/source_file.dart ('k') | pkg/compiler/lib/src/old_to_new_api.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698