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

Side by Side Diff: pkg/scheduled_test/lib/src/task.dart

Issue 164883002: pkg/scheduled_test: formatter (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 task; 5 library task;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:stack_trace/stack_trace.dart'; 10 import 'package:stack_trace/stack_trace.dart';
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 int _id; 57 int _id;
58 58
59 /// A Future that will complete to the return value of [fn] once this task 59 /// A Future that will complete to the return value of [fn] once this task
60 /// finishes running. 60 /// finishes running.
61 Future get result => _resultCompleter.future; 61 Future get result => _resultCompleter.future;
62 final _resultCompleter = new Completer(); 62 final _resultCompleter = new Completer();
63 63
64 final Chain stackChain; 64 final Chain stackChain;
65 65
66 Task(fn(), String description, TaskQueue queue) 66 Task(fn(), String description, TaskQueue queue)
67 : this._(fn, description, queue, null, queue.contents.length); 67 : this._(fn, description, queue, null, queue.contents.length);
68 68
69 Task._child(fn(), String description, Task parent) 69 Task._child(fn(), String description, Task parent)
70 : this._(fn, description, parent.queue, parent, parent.children.length); 70 : this._(fn, description, parent.queue, parent, parent.children.length);
71 71
72 Task._(fn(), this.description, TaskQueue queue, this.parent, this._id) 72 Task._(fn(), this.description, TaskQueue queue, this.parent, this._id)
73 : queue = queue, 73 : queue = queue,
74 stackChain = new Chain.current() { 74 stackChain = new Chain.current() {
75 this.fn = () { 75 this.fn = () {
76 if (state != TaskState.WAITING) { 76 if (state != TaskState.WAITING) {
77 throw new StateError("Can't run $state task '$this'."); 77 throw new StateError("Can't run $state task '$this'.");
78 } 78 }
79 79
80 _state = TaskState.RUNNING; 80 _state = TaskState.RUNNING;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 final String name; 149 final String name;
150 150
151 /// Whether the state indicates that the task has finished running. This is 151 /// Whether the state indicates that the task has finished running. This is
152 /// true for both the [SUCCESS] and [ERROR] states. 152 /// true for both the [SUCCESS] and [ERROR] states.
153 bool get isDone => this == SUCCESS || this == ERROR; 153 bool get isDone => this == SUCCESS || this == ERROR;
154 154
155 const TaskState._(this.name); 155 const TaskState._(this.name);
156 156
157 String toString() => name; 157 String toString() => name;
158 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698