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 dart2js.library_loader; | 5 library dart2js.library_loader; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'common/names.dart' show Uris; | 9 import 'common/names.dart' show Uris; |
10 import 'common/tasks.dart' show CompilerTask, GenericTask; | 10 import 'common/tasks.dart' show CompilerTask, GenericTask; |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 try { | 358 try { |
359 return reuseLibrary(library) | 359 return reuseLibrary(library) |
360 .then((bool reuse) => reuse ? library : null); | 360 .then((bool reuse) => reuse ? library : null); |
361 } catch (exception, trace) { | 361 } catch (exception, trace) { |
362 reporter.onCrashInUserCode( | 362 reporter.onCrashInUserCode( |
363 'Uncaught exception in reuseLibrary', exception, trace); | 363 'Uncaught exception in reuseLibrary', exception, trace); |
364 rethrow; | 364 rethrow; |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 List<Future<LibraryElement>> reusedLibrariesFuture = | 368 List<Future<LibraryElement>> reusedLibrariesFuture = measureSubtask( |
369 measureSubtask(_reuseLibrarySubtaskName, | 369 _reuseLibrarySubtaskName, |
370 () => libraryCanonicalUriMap.values.map(wrapper).toList()); | 370 () => libraryCanonicalUriMap.values.map(wrapper).toList()); |
371 | 371 |
372 return Future | 372 return Future |
373 .wait(reusedLibrariesFuture) | 373 .wait(reusedLibrariesFuture) |
374 .then((Iterable<LibraryElement> reusedLibraries) { | 374 .then((Iterable<LibraryElement> reusedLibraries) { |
375 resetImplementation(reusedLibraries.where((e) => e != null)); | 375 resetImplementation(reusedLibraries.where((e) => e != null)); |
376 }); | 376 }); |
377 }); | 377 }); |
378 } | 378 } |
379 | 379 |
380 Future<Null> resetLibraries( | 380 Future<Null> resetLibraries( |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 Future onLibrariesLoaded(LoadedLibraries results); | 1504 Future onLibrariesLoaded(LoadedLibraries results); |
1505 | 1505 |
1506 /// Called whenever a library element is created. | 1506 /// Called whenever a library element is created. |
1507 void onLibraryCreated(LibraryElement library); | 1507 void onLibraryCreated(LibraryElement library); |
1508 | 1508 |
1509 /// Called whenever a library is scanned from a script file. | 1509 /// Called whenever a library is scanned from a script file. |
1510 Future onLibraryScanned(LibraryElement library, LibraryLoader loader); | 1510 Future onLibraryScanned(LibraryElement library, LibraryLoader loader); |
1511 } | 1511 } |
1512 | 1512 |
1513 const _reuseLibrarySubtaskName = "Reuse library"; | 1513 const _reuseLibrarySubtaskName = "Reuse library"; |
OLD | NEW |