Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 844493005: Update cache size on analysis start/stop. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/operation/operation_analysis.dart
diff --git a/pkg/analysis_server/lib/src/operation/operation_analysis.dart b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
index facf3688b389cf311141d802af2dc2cf92525c6d..403356a2e56b978541ea8edcd1e2203552112628 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -106,6 +106,9 @@ void sendAnalysisNotificationOverrides(AnalysisServer server, String file,
* Instances of [PerformAnalysisOperation] perform a single analysis task.
*/
class PerformAnalysisOperation extends ServerOperation {
+ static const int IDLE_CACHE_SIZE = AnalysisOptionsImpl.DEFAULT_CACHE_SIZE;
+ static const int WORKING_CACHE_SIZE = 512;
+
final AnalysisContext context;
final bool isContinue;
@@ -130,10 +133,14 @@ class PerformAnalysisOperation extends ServerOperation {
// AnalysisResult result = context.performAnalysisTask((taskDescription) {
// sendStatusNotification(context.toString(), taskDescription);
// });
+ if (!isContinue) {
+ _setCacheSize(WORKING_CACHE_SIZE);
+ }
// prepare results
AnalysisResult result = context.performAnalysisTask();
List<ChangeNotice> notices = result.changeNotices;
if (notices == null) {
+ _setCacheSize(IDLE_CACHE_SIZE);
server.sendContextAnalysisDoneNotifications(
context,
AnalysisDoneReason.COMPLETE);
@@ -146,6 +153,12 @@ class PerformAnalysisOperation extends ServerOperation {
server.addOperation(new PerformAnalysisOperation(context, true));
}
+ void _setCacheSize(int cacheSize) {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(context.analysisOptions);
+ options.cacheSize = cacheSize;
+ context.analysisOptions = options;
+ }
+
/**
* Send the information in the given list of notices back to the client.
*/
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698