| 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 solveserved. Use of this source code is governed by a | 2 // for details. All rights solveserved. 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; | 339 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; |
| 340 | 340 |
| 341 VMLibraryHooks.packageRootUriFuture = _getPackageRootFuture; | 341 VMLibraryHooks.packageRootUriFuture = _getPackageRootFuture; |
| 342 VMLibraryHooks.packageConfigUriFuture = _getPackageConfigFuture; | 342 VMLibraryHooks.packageConfigUriFuture = _getPackageConfigFuture; |
| 343 VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture; | 343 VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture; |
| 344 } | 344 } |
| 345 | 345 |
| 346 // Handling of Resource class by dispatching to the load port. | 346 // Handling of Resource class by dispatching to the load port. |
| 347 Future<List<int>> _resourceReadAsBytes(Uri uri) async { | 347 Future<List<int>> _resourceReadAsBytes(Uri uri) async { |
| 348 List response = await _makeLoaderRequest(_Dart_kResourceLoad, uri.toString()); | 348 List response = await _makeLoaderRequest(_Dart_kResourceLoad, uri.toString()); |
| 349 if (response[3] is String) { | 349 if (response[4] is String) { |
| 350 // Throw the error. | 350 // Throw the error. |
| 351 throw response[3]; | 351 throw response[4]; |
| 352 } else { | 352 } else { |
| 353 return response[3]; | 353 return response[4]; |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 | 356 |
| 357 Future<Uri> _getPackageRootFuture() { | 357 Future<Uri> _getPackageRootFuture() { |
| 358 if (_traceLoading) { | 358 if (_traceLoading) { |
| 359 _log("Request for package root from user code."); | 359 _log("Request for package root from user code."); |
| 360 } | 360 } |
| 361 return _makeLoaderRequest(_Dart_kGetPackageRootUri, null); | 361 return _makeLoaderRequest(_Dart_kGetPackageRootUri, null); |
| 362 } | 362 } |
| 363 | 363 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 386 if (_traceLoading) { | 386 if (_traceLoading) { |
| 387 _log("Exception when resolving package URI: $packageUri"); | 387 _log("Exception when resolving package URI: $packageUri"); |
| 388 } | 388 } |
| 389 result = null; | 389 result = null; |
| 390 } | 390 } |
| 391 if (_traceLoading) { | 391 if (_traceLoading) { |
| 392 _log("Resolved '$packageUri' to '$result'"); | 392 _log("Resolved '$packageUri' to '$result'"); |
| 393 } | 393 } |
| 394 return result; | 394 return result; |
| 395 } | 395 } |
| OLD | NEW |