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

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

Issue 2011543002: Canonicalize uris in C++ instead of Dart for the standalone embedder. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | runtime/include/dart_api.h » ('J')
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 } 318 }
319 if (_traceLoading) { 319 if (_traceLoading) {
320 _log("Resolved '$uri' to '$resolvedUri'."); 320 _log("Resolved '$uri' to '$resolvedUri'.");
321 } 321 }
322 return resolvedUri; 322 return resolvedUri;
323 } 323 }
324 324
325 325
326 // Resolves the script uri in the current working directory iff the given uri 326 // Resolves the script uri in the current working directory iff the given uri
327 // did not specify a scheme (e.g. a path to a script file on the command line). 327 // did not specify a scheme (e.g. a path to a script file on the command line).
328 Uri _resolveScriptUri(String scriptName) { 328 Uri _resolveScriptUri(String scriptName) {
Cutch 2016/05/24 23:53:46 We need to get rid of this function too. If new AP
turnidge 2016/05/31 18:25:27 I would rather hold off on exposing the api in tha
329 if (_traceLoading) { 329 if (_traceLoading) {
330 _log("Resolving script: $scriptName"); 330 _log("Resolving script: $scriptName");
331 } 331 }
332 if (_workingDirectory == null) { 332 if (_workingDirectory == null) {
333 throw 'No current working directory set.'; 333 throw 'No current working directory set.';
334 } 334 }
335 scriptName = _sanitizeWindowsPath(scriptName); 335 scriptName = _sanitizeWindowsPath(scriptName);
336 336
337 var scriptUri = Uri.parse(scriptName); 337 var scriptUri = Uri.parse(scriptName);
338 if (scriptUri.scheme == '') { 338 if (scriptUri.scheme == '') {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 if (tag == _Dart_kScriptTag) { 684 if (tag == _Dart_kScriptTag) {
685 resourceUri = _resolveScriptUri(uri); 685 resourceUri = _resolveScriptUri(uri);
686 uri = resourceUri.toString(); 686 uri = resourceUri.toString();
687 } else { 687 } else {
688 resourceUri = Uri.parse(uri); 688 resourceUri = Uri.parse(uri);
689 } 689 }
690 _loadData(tag, uri, resourceUri, libraryUri); 690 _loadData(tag, uri, resourceUri, libraryUri);
691 } 691 }
692 692
693 693
694 // Embedder Entrypoint:
695 // Function called by standalone embedder to resolve uris when the VM requests
696 // Dart_kCanonicalizeUrl from the tag handler.
697 String _resolveUri(String base, String userString) {
698 if (!_setupCompleted) {
699 _setupHooks();
700 }
701 if (_traceLoading) {
702 _log('Resolving: $userString from $base');
703 }
704 var baseUri = Uri.parse(base);
705 var result = baseUri.resolve(userString).toString();
706 if (_traceLoading) {
707 _log('Resolved $userString in $base to $result');
708 }
709 return result;
710 }
711
712
713 // Handling of access to the package root or package map from user code. 694 // Handling of access to the package root or package map from user code.
714 _triggerPackageResolution(action) { 695 _triggerPackageResolution(action) {
715 if (_packagesReady) { 696 if (_packagesReady) {
716 // Packages are ready. Execute the action now. 697 // Packages are ready. Execute the action now.
717 action(); 698 action();
718 } else { 699 } else {
719 if (_pendingPackageLoads.isEmpty) { 700 if (_pendingPackageLoads.isEmpty) {
720 // Package resolution has not been setup yet, and this is the first 701 // Package resolution has not been setup yet, and this is the first
721 // request for package resolution & loading. 702 // request for package resolution & loading.
722 _requestPackagesMap(); 703 _requestPackagesMap();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 853
873 // Register callbacks and hooks with the rest of the core libraries. 854 // Register callbacks and hooks with the rest of the core libraries.
874 _setupHooks() { 855 _setupHooks() {
875 _setupCompleted = true; 856 _setupCompleted = true;
876 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; 857 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes;
877 858
878 VMLibraryHooks.packageRootUriFuture = _getPackageRootFuture; 859 VMLibraryHooks.packageRootUriFuture = _getPackageRootFuture;
879 VMLibraryHooks.packageConfigUriFuture = _getPackageConfigFuture; 860 VMLibraryHooks.packageConfigUriFuture = _getPackageConfigFuture;
880 VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture; 861 VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture;
881 } 862 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | runtime/include/dart_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698