| 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 leg_apiimpl; | 5 library leg_apiimpl; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import '../compiler_new.dart' as api; | 10 import '../compiler_new.dart' as api; |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 }); | 479 }); |
| 480 } catch (ex, s) { | 480 } catch (ex, s) { |
| 481 diagnoseCrashInUserCode( | 481 diagnoseCrashInUserCode( |
| 482 'Uncaught exception in diagnostic handler', ex, s); | 482 'Uncaught exception in diagnostic handler', ex, s); |
| 483 rethrow; | 483 rethrow; |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 | 486 |
| 487 Future callUserProvider(Uri uri) { | 487 Future callUserProvider(Uri uri) { |
| 488 try { | 488 try { |
| 489 return userProviderTask.measure(() => provider.readFromUri(uri)); | 489 return userProviderTask.measureIo(() => provider.readFromUri(uri)); |
| 490 } catch (ex, s) { | 490 } catch (ex, s) { |
| 491 diagnoseCrashInUserCode('Uncaught exception in input provider', ex, s); | 491 diagnoseCrashInUserCode('Uncaught exception in input provider', ex, s); |
| 492 rethrow; | 492 rethrow; |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 | 495 |
| 496 Future<Packages> callUserPackagesDiscovery(Uri uri) { | 496 Future<Packages> callUserPackagesDiscovery(Uri uri) { |
| 497 try { | 497 try { |
| 498 return userPackagesDiscoveryTask.measure( | 498 return userPackagesDiscoveryTask.measureIo( |
| 499 () => packagesDiscoveryProvider(uri)); | 499 () => packagesDiscoveryProvider(uri)); |
| 500 } catch (ex, s) { | 500 } catch (ex, s) { |
| 501 diagnoseCrashInUserCode('Uncaught exception in package discovery', ex, s); | 501 diagnoseCrashInUserCode('Uncaught exception in package discovery', ex, s); |
| 502 rethrow; | 502 rethrow; |
| 503 } | 503 } |
| 504 } | 504 } |
| 505 | 505 |
| 506 void diagnoseCrashInUserCode(String message, exception, stackTrace) { | 506 void diagnoseCrashInUserCode(String message, exception, stackTrace) { |
| 507 hasCrashed = true; | 507 hasCrashed = true; |
| 508 print('$message: ${tryToString(exception)}'); | 508 print('$message: ${tryToString(exception)}'); |
| 509 print(tryToString(stackTrace)); | 509 print(tryToString(stackTrace)); |
| 510 } | 510 } |
| 511 | 511 |
| 512 fromEnvironment(String name) => environment[name]; | 512 fromEnvironment(String name) => environment[name]; |
| 513 | 513 |
| 514 library_info.LibraryInfo lookupLibraryInfo(String libraryName) { | 514 library_info.LibraryInfo lookupLibraryInfo(String libraryName) { |
| 515 return library_info.libraries[libraryName]; | 515 return library_info.libraries[libraryName]; |
| 516 } | 516 } |
| 517 } | 517 } |
| OLD | NEW |