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

Side by Side Diff: pkg/analysis_server/lib/src/plugin/plugin_manager.dart

Issue 3001133002: Handle watch events that arrive before plugin start-up (Closed)
Patch Set: Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:io' show Platform, Process, ProcessResult; 8 import 'dart:io' show Platform, Process, ProcessResult;
9 9
10 import 'package:analysis_server/src/plugin/notification_manager.dart'; 10 import 'package:analysis_server/src/plugin/notification_manager.dart';
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 bool matches(String pattern) => 416 bool matches(String pattern) =>
417 new Glob(resourceProvider.pathContext.separator, pattern) 417 new Glob(resourceProvider.pathContext.separator, pattern)
418 .matches(filePath); 418 .matches(filePath);
419 419
420 WatchEvent event = null; 420 WatchEvent event = null;
421 List<Future<Response>> responses = <Future<Response>>[]; 421 List<Future<Response>> responses = <Future<Response>>[];
422 for (PluginInfo plugin in _pluginMap.values) { 422 for (PluginInfo plugin in _pluginMap.values) {
423 PluginSession session = plugin.currentSession; 423 PluginSession session = plugin.currentSession;
424 if (session != null && 424 if (session != null &&
425 plugin.isAnalyzing(filePath) && 425 plugin.isAnalyzing(filePath) &&
426 session.interestingFiles != null &&
426 session.interestingFiles.any(matches)) { 427 session.interestingFiles.any(matches)) {
428 // The list of interesting file globs is `null` if the plugin has not
429 // yet responded to the plugin.versionCheck request. If that happens
430 // then the plugin hasn't had a chance to analyze anything yet, and
431 // hence it does not needed to get watch events.
427 event ??= _convertWatchEvent(watchEvent); 432 event ??= _convertWatchEvent(watchEvent);
428 AnalysisHandleWatchEventsParams params = 433 AnalysisHandleWatchEventsParams params =
429 new AnalysisHandleWatchEventsParams([event]); 434 new AnalysisHandleWatchEventsParams([event]);
430 responses.add(session.sendRequest(params)); 435 responses.add(session.sendRequest(params));
431 } 436 }
432 } 437 }
433 return responses; 438 return responses;
434 } 439 }
435 440
436 /** 441 /**
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 * The completer that will be used to complete the future when the response is 1038 * The completer that will be used to complete the future when the response is
1034 * received from the plugin. 1039 * received from the plugin.
1035 */ 1040 */
1036 final Completer<Response> completer; 1041 final Completer<Response> completer;
1037 1042
1038 /** 1043 /**
1039 * Initialize a pending request. 1044 * Initialize a pending request.
1040 */ 1045 */
1041 _PendingRequest(this.method, this.requestTime, this.completer); 1046 _PendingRequest(this.method, this.requestTime, this.completer);
1042 } 1047 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698