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

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

Issue 840953008: Alternate status page (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Sorted and formatted 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 /** 44 /**
45 * Removes all elements in the queue. 45 * Removes all elements in the queue.
46 */ 46 */
47 void clear() { 47 void clear() {
48 for (Queue<ServerOperation> queue in _queues) { 48 for (Queue<ServerOperation> queue in _queues) {
49 queue.clear(); 49 queue.clear();
50 } 50 }
51 } 51 }
52 52
53 /** 53 /**
54 * Return the next operation to perform, or `null` if the queue is empty. This
55 * method does not change the queue.
56 */
57 ServerOperation peek() {
58 for (Queue<ServerOperation> queue in _queues) {
59 if (!queue.isEmpty) {
60 return queue.first;
61 }
62 }
63 return null;
64 }
65
66 /**
54 * Returns the next operation to perform or `null` if empty. 67 * Returns the next operation to perform or `null` if empty.
55 */ 68 */
56 ServerOperation take() { 69 ServerOperation take() {
57 for (Queue<ServerOperation> queue in _queues) { 70 for (Queue<ServerOperation> queue in _queues) {
58 if (!queue.isEmpty) { 71 if (!queue.isEmpty) {
59 return queue.removeFirst(); 72 return queue.removeFirst();
60 } 73 }
61 } 74 }
62 return null; 75 return null;
63 } 76 }
64 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698