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

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

Issue 1739913003: Start work to remove the context manager callbacks (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | pkg/analysis_server/lib/src/context_manager.dart » ('j') | 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) 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:math' show max; 10 import 'dart:math' show max;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 /** 273 /**
274 * If the "analysis.analyzedFiles" notification is currently being subscribed 274 * If the "analysis.analyzedFiles" notification is currently being subscribed
275 * to (see [generalAnalysisServices]), and at least one such notification has 275 * to (see [generalAnalysisServices]), and at least one such notification has
276 * been sent since the subscription was enabled, the set of analyzed files 276 * been sent since the subscription was enabled, the set of analyzed files
277 * that was delivered in the most recently sent notification. Otherwise 277 * that was delivered in the most recently sent notification. Otherwise
278 * `null`. 278 * `null`.
279 */ 279 */
280 Set<String> prevAnalyzedFiles; 280 Set<String> prevAnalyzedFiles;
281 281
282 /** 282 /**
283 * The default options used to create new analysis contexts. 283 * The default options used to create new analysis contexts. This object is
284 * also referenced by the ContextManager.
284 */ 285 */
285 AnalysisOptionsImpl defaultContextOptions = new AnalysisOptionsImpl(); 286 final AnalysisOptionsImpl defaultContextOptions = new AnalysisOptionsImpl();
286 287
287 /** 288 /**
288 * The controller for sending [ContextsChangedEvent]s. 289 * The controller for sending [ContextsChangedEvent]s.
289 */ 290 */
290 StreamController<ContextsChangedEvent> _onContextsChangedController = 291 StreamController<ContextsChangedEvent> _onContextsChangedController =
291 new StreamController<ContextsChangedEvent>.broadcast(); 292 new StreamController<ContextsChangedEvent>.broadcast();
292 293
293 /** 294 /**
294 * Initialize a newly created server to receive requests from and send 295 * Initialize a newly created server to receive requests from and send
295 * responses to the given [channel]. 296 * responses to the given [channel].
(...skipping 11 matching lines...) Expand all
307 this.serverPlugin, 308 this.serverPlugin,
308 this.options, 309 this.options,
309 this.defaultSdkCreator, 310 this.defaultSdkCreator,
310 this.instrumentationService, 311 this.instrumentationService,
311 {ResolverProvider packageResolverProvider: null, 312 {ResolverProvider packageResolverProvider: null,
312 EmbeddedResolverProvider embeddedResolverProvider: null, 313 EmbeddedResolverProvider embeddedResolverProvider: null,
313 this.rethrowExceptions: true}) 314 this.rethrowExceptions: true})
314 : index = _index, 315 : index = _index,
315 searchEngine = _index != null ? createSearchEngine(_index) : null { 316 searchEngine = _index != null ? createSearchEngine(_index) : null {
316 _performance = performanceDuringStartup; 317 _performance = performanceDuringStartup;
318 defaultContextOptions.incremental = true;
319 defaultContextOptions.incrementalApi =
320 options.enableIncrementalResolutionApi;
321 defaultContextOptions.incrementalValidation =
322 options.enableIncrementalResolutionValidation;
323 defaultContextOptions.generateImplicitErrors = false;
317 operationQueue = new ServerOperationQueue(); 324 operationQueue = new ServerOperationQueue();
318 contextManager = new ContextManagerImpl( 325 contextManager = new ContextManagerImpl(
319 resourceProvider, 326 resourceProvider,
320 packageResolverProvider, 327 packageResolverProvider,
321 embeddedResolverProvider, 328 embeddedResolverProvider,
322 packageMapProvider, 329 packageMapProvider,
323 instrumentationService); 330 instrumentationService,
331 defaultContextOptions);
324 ServerContextManagerCallbacks contextManagerCallbacks = 332 ServerContextManagerCallbacks contextManagerCallbacks =
325 new ServerContextManagerCallbacks(this, resourceProvider); 333 new ServerContextManagerCallbacks(this, resourceProvider);
326 contextManager.callbacks = contextManagerCallbacks; 334 contextManager.callbacks = contextManagerCallbacks;
327 defaultContextOptions.incremental = true;
328 defaultContextOptions.incrementalApi =
329 options.enableIncrementalResolutionApi;
330 defaultContextOptions.incrementalValidation =
331 options.enableIncrementalResolutionValidation;
332 defaultContextOptions.generateImplicitErrors = false;
333 _noErrorNotification = options.noErrorNotification; 335 _noErrorNotification = options.noErrorNotification;
334 AnalysisEngine.instance.logger = new AnalysisLogger(this); 336 AnalysisEngine.instance.logger = new AnalysisLogger(this);
335 _onAnalysisStartedController = new StreamController.broadcast(); 337 _onAnalysisStartedController = new StreamController.broadcast();
336 _onFileAnalyzedController = new StreamController.broadcast(); 338 _onFileAnalyzedController = new StreamController.broadcast();
337 _onPriorityChangeController = 339 _onPriorityChangeController =
338 new StreamController<PriorityChangeEvent>.broadcast(); 340 new StreamController<PriorityChangeEvent>.broadcast();
339 running = true; 341 running = true;
340 onAnalysisStarted.first.then((_) { 342 onAnalysisStarted.first.then((_) {
341 onAnalysisComplete.then((_) { 343 onAnalysisComplete.then((_) {
342 performanceAfterStartup = new ServerPerformance(); 344 performanceAfterStartup = new ServerPerformance();
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 AnalysisEngine.instance.logger.logError( 1476 AnalysisEngine.instance.logger.logError(
1475 'Invalid glob pattern: "$pattern"', 1477 'Invalid glob pattern: "$pattern"',
1476 new CaughtException(exception, stackTrace)); 1478 new CaughtException(exception, stackTrace));
1477 } 1479 }
1478 } 1480 }
1479 } 1481 }
1480 return _analyzedFilesGlobs; 1482 return _analyzedFilesGlobs;
1481 } 1483 }
1482 1484
1483 @override 1485 @override
1484 AnalysisOptions get defaultAnalysisOptions =>
1485 analysisServer.defaultContextOptions;
1486
1487 @override
1488 AnalysisContext addContext( 1486 AnalysisContext addContext(
1489 Folder folder, AnalysisOptions options, FolderDisposition disposition) { 1487 Folder folder, AnalysisOptions options, FolderDisposition disposition) {
1490 InternalAnalysisContext context = 1488 InternalAnalysisContext context =
1491 AnalysisEngine.instance.createAnalysisContext(); 1489 AnalysisEngine.instance.createAnalysisContext();
1492 context.contentCache = analysisServer.overlayState; 1490 context.contentCache = analysisServer.overlayState;
1493 analysisServer.folderMap[folder] = context; 1491 analysisServer.folderMap[folder] = context;
1494 _locateEmbedderYamls(context, disposition); 1492 _locateEmbedderYamls(context, disposition);
1495 context.sourceFactory = 1493 context.sourceFactory =
1496 _createSourceFactory(context, options, disposition, folder); 1494 _createSourceFactory(context, options, disposition, folder);
1497 context.analysisOptions = options; 1495 context.analysisOptions = options;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 /** 1725 /**
1728 * The [PerformanceTag] for time spent in server request handlers. 1726 * The [PerformanceTag] for time spent in server request handlers.
1729 */ 1727 */
1730 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1728 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1731 1729
1732 /** 1730 /**
1733 * The [PerformanceTag] for time spent in split store microtasks. 1731 * The [PerformanceTag] for time spent in split store microtasks.
1734 */ 1732 */
1735 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1733 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1736 } 1734 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698