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

Unified Diff: pkg/analysis_server/lib/src/domain_completion.dart

Issue 889583004: fix race condition when recording computeCache performance (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/analysis_server/lib/src/get_handler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domain_completion.dart
diff --git a/pkg/analysis_server/lib/src/domain_completion.dart b/pkg/analysis_server/lib/src/domain_completion.dart
index e6a57b456717bf2bc00a81943dae91f842397b3e..2c5f52873f323b64f04974193dd407eae433f583 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -63,7 +63,7 @@ class CompletionDomainHandler implements RequestHandler {
/**
* Performance for the last priority change event.
*/
- CompletionPerformance priorityChangedPerformance;
+ CompletionPerformance computeCachePerformance;
/**
* Initialize a new request handler for the given [server].
@@ -136,23 +136,23 @@ class CompletionDomainHandler implements RequestHandler {
*/
void priorityChanged(PriorityChangeEvent event) {
Source source = event.firstSource;
- priorityChangedPerformance = new CompletionPerformance();
- priorityChangedPerformance.source = source;
- if (source != null) {
- AnalysisContext context = server.getAnalysisContextForSource(source);
- if (context != null) {
- String computeTag = 'computeCache';
- priorityChangedPerformance.logStartTime(computeTag);
- CompletionManager manager = completionManagerFor(context, source);
- manager.computeCache().then((bool success) {
- priorityChangedPerformance.logElapseTime(computeTag);
- priorityChangedPerformance.complete(
- 'priorityChanged caching: $success');
- });
- return;
- }
+ CompletionPerformance performance = new CompletionPerformance();
+ computeCachePerformance = performance;
+ if (source == null) {
+ performance.complete('priorityChanged caching: no source');
+ return;
+ }
+ performance.source = source;
+ AnalysisContext context = server.getAnalysisContextForSource(source);
+ if (context != null) {
+ String computeTag = 'computeCache';
+ performance.logStartTime(computeTag);
+ CompletionManager manager = completionManagerFor(context, source);
+ manager.computeCache().then((bool success) {
+ performance.logElapseTime(computeTag);
+ performance.complete('priorityChanged caching: $success');
+ });
}
- priorityChangedPerformance.complete();
}
/**
@@ -204,10 +204,6 @@ class CompletionDomainHandler implements RequestHandler {
void recordRequest(CompletionPerformance performance, AnalysisContext context,
Source source, int offset) {
performance.source = source;
- if (priorityChangedPerformance != null &&
- priorityChangedPerformance.source != source) {
- priorityChangedPerformance = null;
- }
if (performanceListMaxLength == 0 || context == null || source == null) {
return;
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/get_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698