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

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

Issue 869153003: Prioritize analysis operations for contexts with priority files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
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 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';
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 ServerOperation peek() { 57 ServerOperation peek() {
58 for (Queue<ServerOperation> queue in _queues) { 58 for (Queue<ServerOperation> queue in _queues) {
59 if (!queue.isEmpty) { 59 if (!queue.isEmpty) {
60 return queue.first; 60 return queue.first;
61 } 61 }
62 } 62 }
63 return null; 63 return null;
64 } 64 }
65 65
66 /** 66 /**
67 * Reschedules queued operations according their current priorities.
68 */
69 void reschedule() {
70 // prepare all operations
71 List<ServerOperation> operations = <ServerOperation>[];
72 for (Queue<ServerOperation> queue in _queues) {
73 operations.addAll(queue);
74 queue.clear();
75 }
76 // add all operations
77 operations.forEach(add);
78 }
79
80 /**
67 * Returns the next operation to perform or `null` if empty. 81 * Returns the next operation to perform or `null` if empty.
68 */ 82 */
69 ServerOperation take() { 83 ServerOperation take() {
70 for (Queue<ServerOperation> queue in _queues) { 84 for (Queue<ServerOperation> queue in _queues) {
71 if (!queue.isEmpty) { 85 if (!queue.isEmpty) {
72 return queue.removeFirst(); 86 return queue.removeFirst();
73 } 87 }
74 } 88 }
75 return null; 89 return null;
76 } 90 }
77 } 91 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation_analysis.dart ('k') | pkg/analysis_server/test/mocks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698