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

Side by Side Diff: runtime/bin/builtin.dart

Issue 1403693002: - Implement package map parameter when spawning isolate. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 5 years, 2 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 | « no previous file | runtime/bin/dartutils.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 builtin; 5 library builtin;
6 // NOTE: Do not import 'dart:io' in builtin. 6 // NOTE: Do not import 'dart:io' in builtin.
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:_internal'; 9 import 'dart:_internal';
10 import 'dart:isolate'; 10 import 'dart:isolate';
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 _log("Skipping dummy deferred request."); 507 _log("Skipping dummy deferred request.");
508 } 508 }
509 }); 509 });
510 510
511 if (_traceLoading) { 511 if (_traceLoading) {
512 _log("Requested packages map at '$packagesUri'."); 512 _log("Requested packages map at '$packagesUri'.");
513 } 513 }
514 } 514 }
515 515
516 516
517 // Embedder Entrypoint:
518 // Add mapping from package name to URI.
519 void _addPackageMapEntry(String key, String value) {
520 if (!_setupCompleted) {
521 _setupHooks();
522 }
523 if (_traceLoading) {
524 _log("Adding packages map entry: $key -> $value");
525 }
526 if (_packageRoot != null) {
527 if (_traceLoading) {
528 _log("_packageRoot already set: $_packageRoot");
529 }
530 throw "Cannot add package map entry to an exisiting package root.";
531 }
532 if (_packagesPort != null) {
533 if (_traceLoading) {
534 _log("Package map load request already pending.");
535 }
536 throw "Cannot add package map entry during package map resolution.";
537 }
538 if (_packageMap == null) {
539 _packageMap = new Map<String, Uri>();
540 }
541 _packageMap[key] = _workingDirectory.resolve(value);
542 }
543
544
517 void _asyncLoadError(_LoadRequest req, _LoadError error, StackTrace stack) { 545 void _asyncLoadError(_LoadRequest req, _LoadError error, StackTrace stack) {
518 if (_traceLoading) { 546 if (_traceLoading) {
519 _log("_asyncLoadError(${req._uri}), error: $error\nstack: $stack"); 547 _log("_asyncLoadError(${req._uri}), error: $error\nstack: $stack");
520 } 548 }
521 if (req._tag == _Dart_kResourceLoad) { 549 if (req._tag == _Dart_kResourceLoad) {
522 Completer c = req._context; 550 Completer c = req._context;
523 c.completeError(error, stack); 551 c.completeError(error, stack);
524 } else { 552 } else {
525 String libraryUri = req._context; 553 String libraryUri = req._context;
526 if (req._tag == _Dart_kImportTag) { 554 if (req._tag == _Dart_kImportTag) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 827 }
800 828
801 829
802 // Register callbacks and hooks with the rest of the core libraries. 830 // Register callbacks and hooks with the rest of the core libraries.
803 _setupHooks() { 831 _setupHooks() {
804 _setupCompleted = true; 832 _setupCompleted = true;
805 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; 833 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes;
806 VMLibraryHooks.getPackageRoot = _getPackageRoot; 834 VMLibraryHooks.getPackageRoot = _getPackageRoot;
807 VMLibraryHooks.getPackageMap = _getPackageMap; 835 VMLibraryHooks.getPackageMap = _getPackageMap;
808 } 836 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698