Chromium Code Reviews| 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 | 9 |
| 10 import 'package:analysis_server/src/analysis_logger.dart'; | 10 import 'package:analysis_server/src/analysis_logger.dart'; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 AnalysisContext context = directory.context; | 203 AnalysisContext context = directory.context; |
| 204 List<Source> sourceList = sourceMap[context]; | 204 List<Source> sourceList = sourceMap[context]; |
| 205 if (sourceList == null) { | 205 if (sourceList == null) { |
| 206 sourceList = Source.EMPTY_ARRAY; | 206 sourceList = Source.EMPTY_ARRAY; |
| 207 } | 207 } |
| 208 context.analysisPriorityOrder = sourceList; | 208 context.analysisPriorityOrder = sourceList; |
| 209 }); | 209 }); |
| 210 } | 210 } |
| 211 | 211 |
| 212 /** | 212 /** |
| 213 * Use the given updaters to update the values of the options in every | |
| 214 * existing analysis context. | |
| 215 */ | |
| 216 void updateOptions(List<OptionUpdater> optionUpdaters) { | |
|
Paul Berry
2014/06/17 20:40:54
Passing in a list of closures seems like overkill
Brian Wilkerson
2014/06/17 21:30:12
That was my first thought as well. Unfortunately,
Paul Berry
2014/06/17 22:24:56
Actually I was thinking of something along these l
Brian Wilkerson
2014/06/18 17:01:30
Unfortunately, every context needs its own separat
| |
| 217 // TODO(brianwilkerson) Figure out how to update the defaults for newly | |
|
Paul Berry
2014/06/17 20:40:54
You should be able to take care of this in Analysi
Brian Wilkerson
2014/06/17 21:30:12
Thanks. Done, but not tested. This solved one test
| |
| 218 // create contexts. | |
| 219 folderMap.forEach((Folder folder, ContextDirectory directory) { | |
| 220 AnalysisContext context = directory.context; | |
| 221 AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(context.analysi sOptions); | |
| 222 optionUpdaters.forEach((OptionUpdater optionUpdater) { | |
| 223 optionUpdater(options); | |
| 224 }); | |
| 225 context.analysisOptions = options; | |
| 226 }); | |
| 227 } | |
| 228 | |
| 229 /** | |
| 213 * Adds the given [ServerOperation] to the queue, but does not schedule | 230 * Adds the given [ServerOperation] to the queue, but does not schedule |
| 214 * operations execution. | 231 * operations execution. |
| 215 */ | 232 */ |
| 216 void addOperation(ServerOperation operation) { | 233 void addOperation(ServerOperation operation) { |
| 217 operationQueue.add(operation); | 234 operationQueue.add(operation); |
| 218 } | 235 } |
| 219 | 236 |
| 220 /** | 237 /** |
| 221 * The socket from which requests are being read has been closed. | 238 * The socket from which requests are being read has been closed. |
| 222 */ | 239 */ |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 // new PackageUriResolver(), | 550 // new PackageUriResolver(), |
| 534 ]); | 551 ]); |
| 535 } | 552 } |
| 536 | 553 |
| 537 /** | 554 /** |
| 538 * Return the [AnalysisContext] of this folder. | 555 * Return the [AnalysisContext] of this folder. |
| 539 */ | 556 */ |
| 540 AnalysisContext get context => _context; | 557 AnalysisContext get context => _context; |
| 541 } | 558 } |
| 542 | 559 |
| 560 typedef void OptionUpdater(AnalysisOptionsImpl options); | |
| 543 | 561 |
| 544 /** | 562 /** |
| 545 * An enumeration of the services provided by the server domain. | 563 * An enumeration of the services provided by the server domain. |
| 546 */ | 564 */ |
| 547 class ServerService extends Enum2<ServerService> { | 565 class ServerService extends Enum2<ServerService> { |
| 548 static const ServerService STATUS = const ServerService('STATUS', 0); | 566 static const ServerService STATUS = const ServerService('STATUS', 0); |
| 549 | 567 |
| 550 static const List<ServerService> VALUES = const [STATUS]; | 568 static const List<ServerService> VALUES = const [STATUS]; |
| 551 | 569 |
| 552 const ServerService(String name, int ordinal) : super(name, ordinal); | 570 const ServerService(String name, int ordinal) : super(name, ordinal); |
| 553 } | 571 } |
| OLD | NEW |