OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analysis.server; | 5 library analysis.server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:core' hide Resource; | 9 import 'dart:core' hide Resource; |
10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 */ | 721 */ |
722 List<CompilationUnit> getResolvedCompilationUnits(String path) { | 722 List<CompilationUnit> getResolvedCompilationUnits(String path) { |
723 List<CompilationUnit> units = <CompilationUnit>[]; | 723 List<CompilationUnit> units = <CompilationUnit>[]; |
724 ContextSourcePair contextSource = getContextSourcePair(path); | 724 ContextSourcePair contextSource = getContextSourcePair(path); |
725 // prepare AnalysisContext | 725 // prepare AnalysisContext |
726 AnalysisContext context = contextSource.context; | 726 AnalysisContext context = contextSource.context; |
727 if (context == null) { | 727 if (context == null) { |
728 return units; | 728 return units; |
729 } | 729 } |
730 // add a unit for each unit/library combination | 730 // add a unit for each unit/library combination |
731 runWithWorkingCacheSize(context, () { | 731 runWithActiveContext(context, () { |
732 Source unitSource = contextSource.source; | 732 Source unitSource = contextSource.source; |
733 List<Source> librarySources = context.getLibrariesContaining(unitSource); | 733 List<Source> librarySources = context.getLibrariesContaining(unitSource); |
734 for (Source librarySource in librarySources) { | 734 for (Source librarySource in librarySources) { |
735 CompilationUnit unit = | 735 CompilationUnit unit = |
736 context.resolveCompilationUnit2(unitSource, librarySource); | 736 context.resolveCompilationUnit2(unitSource, librarySource); |
737 if (unit != null) { | 737 if (unit != null) { |
738 units.add(unit); | 738 units.add(unit); |
739 } | 739 } |
740 } | 740 } |
741 }); | 741 }); |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 List<Source> librarySources = context.getLibrariesContaining(source); | 1461 List<Source> librarySources = context.getLibrariesContaining(source); |
1462 if (librarySources.isEmpty) { | 1462 if (librarySources.isEmpty) { |
1463 return null; | 1463 return null; |
1464 } | 1464 } |
1465 // if library has not been resolved yet, the unit will be resolved later | 1465 // if library has not been resolved yet, the unit will be resolved later |
1466 Source librarySource = librarySources[0]; | 1466 Source librarySource = librarySources[0]; |
1467 if (context.getResult(librarySource, LIBRARY_ELEMENT6) == null) { | 1467 if (context.getResult(librarySource, LIBRARY_ELEMENT6) == null) { |
1468 return null; | 1468 return null; |
1469 } | 1469 } |
1470 // if library has been already resolved, resolve unit | 1470 // if library has been already resolved, resolve unit |
1471 return runWithWorkingCacheSize(context, () { | 1471 return runWithActiveContext(context, () { |
1472 return context.resolveCompilationUnit2(source, librarySource); | 1472 return context.resolveCompilationUnit2(source, librarySource); |
1473 }); | 1473 }); |
1474 } | 1474 } |
1475 | 1475 |
1476 _scheduleAnalysisImplementedNotification() async { | 1476 _scheduleAnalysisImplementedNotification() async { |
1477 Set<String> files = analysisServices[AnalysisService.IMPLEMENTED]; | 1477 Set<String> files = analysisServices[AnalysisService.IMPLEMENTED]; |
1478 if (files != null) { | 1478 if (files != null) { |
1479 scheduleImplementedNotification(this, files); | 1479 scheduleImplementedNotification(this, files); |
1480 } | 1480 } |
1481 } | 1481 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 /** | 1796 /** |
1797 * The [PerformanceTag] for time spent in server request handlers. | 1797 * The [PerformanceTag] for time spent in server request handlers. |
1798 */ | 1798 */ |
1799 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1799 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
1800 | 1800 |
1801 /** | 1801 /** |
1802 * The [PerformanceTag] for time spent in split store microtasks. | 1802 * The [PerformanceTag] for time spent in split store microtasks. |
1803 */ | 1803 */ |
1804 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1804 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
1805 } | 1805 } |
OLD | NEW |