| 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:math' show max; | 9 import 'dart:math' show max; |
| 10 | 10 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 */ | 578 */ |
| 579 List<CompilationUnit> getResolvedCompilationUnits(String path) { | 579 List<CompilationUnit> getResolvedCompilationUnits(String path) { |
| 580 List<CompilationUnit> units = <CompilationUnit>[]; | 580 List<CompilationUnit> units = <CompilationUnit>[]; |
| 581 ContextSourcePair contextSource = getContextSourcePair(path); | 581 ContextSourcePair contextSource = getContextSourcePair(path); |
| 582 // prepare AnalysisContext | 582 // prepare AnalysisContext |
| 583 AnalysisContext context = contextSource.context; | 583 AnalysisContext context = contextSource.context; |
| 584 if (context == null) { | 584 if (context == null) { |
| 585 return units; | 585 return units; |
| 586 } | 586 } |
| 587 // add a unit for each unit/library combination | 587 // add a unit for each unit/library combination |
| 588 Source unitSource = contextSource.source; | 588 runWithWorkingCacheSize(context, () { |
| 589 List<Source> librarySources = context.getLibrariesContaining(unitSource); | 589 Source unitSource = contextSource.source; |
| 590 for (Source librarySource in librarySources) { | 590 List<Source> librarySources = context.getLibrariesContaining(unitSource); |
| 591 CompilationUnit unit = | 591 for (Source librarySource in librarySources) { |
| 592 context.resolveCompilationUnit2(unitSource, librarySource); | 592 CompilationUnit unit = |
| 593 if (unit != null) { | 593 context.resolveCompilationUnit2(unitSource, librarySource); |
| 594 units.add(unit); | 594 if (unit != null) { |
| 595 units.add(unit); |
| 596 } |
| 595 } | 597 } |
| 596 } | 598 }); |
| 597 // done | 599 // done |
| 598 return units; | 600 return units; |
| 599 } | 601 } |
| 600 | 602 |
| 601 /** | 603 /** |
| 602 * Handle a [request] that was read from the communication channel. | 604 * Handle a [request] that was read from the communication channel. |
| 603 */ | 605 */ |
| 604 void handleRequest(Request request) { | 606 void handleRequest(Request request) { |
| 605 _performance.logRequest(request); | 607 _performance.logRequest(request); |
| 606 runZoned(() { | 608 runZoned(() { |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 List<Source> librarySources = context.getLibrariesContaining(source); | 1178 List<Source> librarySources = context.getLibrariesContaining(source); |
| 1177 if (librarySources.isEmpty) { | 1179 if (librarySources.isEmpty) { |
| 1178 return null; | 1180 return null; |
| 1179 } | 1181 } |
| 1180 // if library has not been resolved yet, the unit will be resolved later | 1182 // if library has not been resolved yet, the unit will be resolved later |
| 1181 Source librarySource = librarySources[0]; | 1183 Source librarySource = librarySources[0]; |
| 1182 if (context.getLibraryElement(librarySource) == null) { | 1184 if (context.getLibraryElement(librarySource) == null) { |
| 1183 return null; | 1185 return null; |
| 1184 } | 1186 } |
| 1185 // if library has been already resolved, resolve unit | 1187 // if library has been already resolved, resolve unit |
| 1186 return context.resolveCompilationUnit2(source, librarySource); | 1188 return runWithWorkingCacheSize(context, () { |
| 1189 return context.resolveCompilationUnit2(source, librarySource); |
| 1190 }); |
| 1187 } | 1191 } |
| 1188 | 1192 |
| 1189 /** | 1193 /** |
| 1190 * Schedules [performOperation] exection. | 1194 * Schedules [performOperation] exection. |
| 1191 */ | 1195 */ |
| 1192 void _schedulePerformOperation() { | 1196 void _schedulePerformOperation() { |
| 1193 if (performOperationPending) { | 1197 if (performOperationPending) { |
| 1194 return; | 1198 return; |
| 1195 } | 1199 } |
| 1196 /* | 1200 /* |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 /** | 1497 /** |
| 1494 * The [PerformanceTag] for time spent in server request handlers. | 1498 * The [PerformanceTag] for time spent in server request handlers. |
| 1495 */ | 1499 */ |
| 1496 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1500 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1497 | 1501 |
| 1498 /** | 1502 /** |
| 1499 * The [PerformanceTag] for time spent in split store microtasks. | 1503 * The [PerformanceTag] for time spent in split store microtasks. |
| 1500 */ | 1504 */ |
| 1501 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1505 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1502 } | 1506 } |
| OLD | NEW |