| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.src.task.driver; | 5 library analyzer.src.task.driver; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/context/cache.dart'; | 10 import 'package:analyzer/src/context/cache.dart'; |
| 11 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; | 11 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; |
| 12 import 'package:analyzer/src/generated/java_engine.dart'; | 12 import 'package:analyzer/src/generated/java_engine.dart'; |
| 13 import 'package:analyzer/src/generated/resolver.dart'; | 13 import 'package:analyzer/src/generated/resolver.dart'; |
| 14 import 'package:analyzer/src/task/inputs.dart'; | 14 import 'package:analyzer/src/task/inputs.dart'; |
| 15 import 'package:analyzer/src/task/manager.dart'; | 15 import 'package:analyzer/src/task/manager.dart'; |
| 16 import 'package:analyzer/task/model.dart'; | 16 import 'package:analyzer/task/model.dart'; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * An object that is used to cause analysis to be performed until all of the | 19 * An object that is used to cause analysis to be performed until all of the |
| 20 * required analysis information has been computed. | 20 * required analysis information has been computed. |
| 21 */ | 21 */ |
| 22 class AnalysisDriver { | 22 class AnalysisDriver { |
| 23 /** | 23 /** |
| 24 * The task manager used to figure out how to compute analysis results. | 24 * The task manager used to figure out how to compute analysis results. |
| 25 */ | 25 */ |
| 26 final TaskManager taskManager; | 26 final TaskManager taskManager; |
| 27 | 27 |
| 28 // /** |
| 29 // * The list of [WorkManager] used to figure out which analysis results to |
| 30 // * compute. |
| 31 // */ |
| 32 // final List<WorkManager> workManagers; |
| 33 |
| 28 /** | 34 /** |
| 29 * The context in which analysis is to be performed. | 35 * The context in which analysis is to be performed. |
| 30 */ | 36 */ |
| 31 final InternalAnalysisContext context; | 37 final InternalAnalysisContext context; |
| 32 | 38 |
| 33 /** | 39 /** |
| 34 * The work order that was previously computed but that has not yet been | 40 * The work order that was previously computed but that has not yet been |
| 35 * completed. | 41 * completed. |
| 36 */ | 42 */ |
| 37 WorkOrder currentWorkOrder; | 43 WorkOrder currentWorkOrder; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 TaskDescriptor descriptor = currentItem.descriptor; | 468 TaskDescriptor descriptor = currentItem.descriptor; |
| 463 AnalysisTarget target = currentItem.target; | 469 AnalysisTarget target = currentItem.target; |
| 464 for (WorkItem item in pendingItems) { | 470 for (WorkItem item in pendingItems) { |
| 465 if (item.descriptor == descriptor && item.target == target) { | 471 if (item.descriptor == descriptor && item.target == target) { |
| 466 return true; | 472 return true; |
| 467 } | 473 } |
| 468 } | 474 } |
| 469 return false; | 475 return false; |
| 470 } | 476 } |
| 471 } | 477 } |
| 478 |
| 479 /** |
| 480 * [AnalysisDriver] uses [WorkManager]s to select results to compute. |
| 481 * |
| 482 * They know specific of the targets and results they care about, |
| 483 * so they can request analysis results in optimal order. |
| 484 */ |
| 485 abstract class WorkManager { |
| 486 /** |
| 487 * Return the next [TargetedResult] that this work manager wants to be |
| 488 * computed, or `null` if this manager doesn't need any new results. |
| 489 */ |
| 490 TargetedResult getNextResult(); |
| 491 |
| 492 /** |
| 493 * Notifies the manager that the given [outputs] were produced for |
| 494 * the given [target]. |
| 495 */ |
| 496 void resultsComputed( |
| 497 AnalysisTarget target, Map<ResultDescriptor, dynamic> outputs); |
| 498 } |
| OLD | NEW |