Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 } else { | 628 } else { |
| 629 result = baseUri.resolve(userString).toString(); | 629 result = baseUri.resolve(userString).toString(); |
| 630 } | 630 } |
| 631 if (_traceLoading) { | 631 if (_traceLoading) { |
| 632 _log('Resolved $userString in $base to $result'); | 632 _log('Resolved $userString in $base to $result'); |
| 633 } | 633 } |
| 634 return result; | 634 return result; |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 // Handling of Resource class by dispatching to the load port. | |
| 639 Future<List<int>> _resourceReadAsBytes(Uri uri) { | |
| 640 var completer = new Completer<List<int>>(); | |
| 641 // Request the load of the resource associating the completer as the context | |
| 642 // for the load. | |
| 643 _loadData(_Dart_kResourceLoad, uri.toString(), uri, completer); | |
|
Ivan Posva
2015/10/05 12:49:19
This was the only active use of the _Dart_kResourc
| |
| 644 // Return the future that will be triggered once the resource has been loaded. | |
| 645 return completer.future; | |
| 646 } | |
| 647 | |
| 648 | |
| 649 // Embedder Entrypoint (gen_snapshot): | 638 // Embedder Entrypoint (gen_snapshot): |
| 650 // Resolve relative paths relative to working directory. | 639 // Resolve relative paths relative to working directory. |
| 651 String _resolveInWorkingDirectory(String fileName) { | 640 String _resolveInWorkingDirectory(String fileName) { |
| 652 if (!_setupCompleted) { | 641 if (!_setupCompleted) { |
| 653 _setupHooks(); | 642 _setupHooks(); |
| 654 } | 643 } |
| 655 if (_workingDirectory == null) { | 644 if (_workingDirectory == null) { |
| 656 throw 'No current working directory set.'; | 645 throw 'No current working directory set.'; |
| 657 } | 646 } |
| 658 var name = _sanitizeWindowsPath(fileName); | 647 var name = _sanitizeWindowsPath(fileName); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 754 path = _filePathFromUri(path); | 743 path = _filePathFromUri(path); |
| 755 var filename = _platformExtensionFileName(name); | 744 var filename = _platformExtensionFileName(name); |
| 756 | 745 |
| 757 return [path, filename, name]; | 746 return [path, filename, name]; |
| 758 } | 747 } |
| 759 | 748 |
| 760 | 749 |
| 761 // Register callbacks and hooks with the rest of the core libraries. | 750 // Register callbacks and hooks with the rest of the core libraries. |
| 762 _setupHooks() { | 751 _setupHooks() { |
| 763 _setupCompleted = true; | 752 _setupCompleted = true; |
| 764 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; | |
| 765 } | 753 } |
| OLD | NEW |