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

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: fixz release build Created 4 years, 6 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 673 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698