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 operation.queue; | 5 library operation.queue; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
10 import 'package:analysis_server/src/operation/operation.dart'; | 10 import 'package:analysis_server/src/operation/operation.dart'; |
11 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
12 | 12 |
13 | |
14 /** | 13 /** |
15 * A queue of operations in an [AnalysisServer]. | 14 * A queue of operations in an [AnalysisServer]. |
16 */ | 15 */ |
17 class ServerOperationQueue { | 16 class ServerOperationQueue { |
18 final List<Queue<ServerOperation>> _queues = <Queue<ServerOperation>>[]; | 17 final List<Queue<ServerOperation>> _queues = <Queue<ServerOperation>>[]; |
19 | 18 |
20 ServerOperationQueue() { | 19 ServerOperationQueue() { |
21 for (int i = 0; i < ServerOperationPriority.COUNT; i++) { | 20 for (int i = 0; i < ServerOperationPriority.COUNT; i++) { |
22 var queue = new DoubleLinkedQueue<ServerOperation>(); | 21 var queue = new DoubleLinkedQueue<ServerOperation>(); |
23 _queues.add(queue); | 22 _queues.add(queue); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 for (var operation in queue) { | 111 for (var operation in queue) { |
113 if (test(operation)) { | 112 if (test(operation)) { |
114 queue.remove(operation); | 113 queue.remove(operation); |
115 return operation; | 114 return operation; |
116 } | 115 } |
117 } | 116 } |
118 } | 117 } |
119 return null; | 118 return null; |
120 } | 119 } |
121 } | 120 } |
OLD | NEW |