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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 // Register callbacks and hooks with the rest of the core libraries. | 336 // Register callbacks and hooks with the rest of the core libraries. |
| 337 _setupHooks() { | 337 _setupHooks() { |
| 338 _setupCompleted = true; | 338 _setupCompleted = true; |
| 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 // Class used by Dartium to setup VMLibraryHooks. | |
| 347 class DartiumSetup { | |
| 348 static Uri resolvePackageUri(String resolvedUri) native "Utils_resolvePackageU ri"; | |
| 349 | |
| 350 static Uri _resolveUri(Uri packageUri) => resolvePackageUri(packageUri.toStrin g()); | |
| 351 | |
| 352 static void _setupHooks() { | |
| 353 _setupCompleted = true; | |
| 354 VMLibraryHooks.resolvePackageUriFuture = _resolveUri; | |
| 355 } | |
| 356 } | |
|
siva
2017/01/06 21:33:43
Why does this class have to be in builtin.dart?
It
terry
2017/01/06 21:41:17
I need to get to VMLibraryHooks which is in dart:_
siva
2017/01/06 21:42:53
import 'dart:internal'; should get you access to t
| |
| 357 | |
| 346 // Handling of Resource class by dispatching to the load port. | 358 // Handling of Resource class by dispatching to the load port. |
| 347 Future<List<int>> _resourceReadAsBytes(Uri uri) async { | 359 Future<List<int>> _resourceReadAsBytes(Uri uri) async { |
| 348 List response = await _makeLoaderRequest(_Dart_kResourceLoad, uri.toString()); | 360 List response = await _makeLoaderRequest(_Dart_kResourceLoad, uri.toString()); |
| 349 if (response[4] is String) { | 361 if (response[4] is String) { |
| 350 // Throw the error. | 362 // Throw the error. |
| 351 throw response[4]; | 363 throw response[4]; |
| 352 } else { | 364 } else { |
| 353 return response[4]; | 365 return response[4]; |
| 354 } | 366 } |
| 355 } | 367 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 386 if (_traceLoading) { | 398 if (_traceLoading) { |
| 387 _log("Exception when resolving package URI: $packageUri"); | 399 _log("Exception when resolving package URI: $packageUri"); |
| 388 } | 400 } |
| 389 result = null; | 401 result = null; |
| 390 } | 402 } |
| 391 if (_traceLoading) { | 403 if (_traceLoading) { |
| 392 _log("Resolved '$packageUri' to '$result'"); | 404 _log("Resolved '$packageUri' to '$result'"); |
| 393 } | 405 } |
| 394 return result; | 406 return result; |
| 395 } | 407 } |
| OLD | NEW |