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

Side by Side Diff: runtime/bin/timer_impl.dart

Issue 9474004: Make FileInputStream and FileOutputStream actually asynchronous. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove accidental edit Created 8 years, 9 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class _Timer implements Timer { 5 class _Timer implements Timer {
6 // Set jitter to wake up timer events that would happen in _TIMER_JITTER ms. 6 // Set jitter to wake up timer events that would happen in _TIMER_JITTER ms.
7 static final int _TIMER_JITTER = 0; 7 static final int _TIMER_JITTER = 0;
8 8
9 // Disables the timer. 9 // Disables the timer.
10 static final int _NO_TIMER = -1; 10 static final int _NO_TIMER = -1;
11 11
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 break; 135 break;
136 } 136 }
137 } 137 }
138 138
139 // Trigger all of the pending timers. New timers added as part of the 139 // Trigger all of the pending timers. New timers added as part of the
140 // callbacks will be enqueued now and notified in the next spin at the 140 // callbacks will be enqueued now and notified in the next spin at the
141 // earliest. 141 // earliest.
142 _handling_callbacks = true; 142 _handling_callbacks = true;
143 try { 143 try {
144 for (var timer in pending_timers) { 144 for (var timer in pending_timers) {
145 timer._callback(timer); 145 // One of the timers in the pending_timers list can cancel
146 if (timer._repeating) { 146 // one of the later timers which will set the callback to
147 timer._advanceWakeupTime(); 147 // null.
148 timer._addTimerToList(); 148 if (timer._callback != null) {
149 timer._callback(timer);
150 if (timer._repeating) {
151 timer._advanceWakeupTime();
152 timer._addTimerToList();
153 }
149 } 154 }
150 } 155 }
151 } finally { 156 } finally {
152 _handling_callbacks = false; 157 _handling_callbacks = false;
153 } 158 }
154 _notifyEventHandler(); 159 _notifyEventHandler();
155 } 160 }
156 161
157 if(_receivePort === null) { 162 if(_receivePort === null) {
158 _receivePort = new ReceivePort(); 163 _receivePort = new ReceivePort();
(...skipping 14 matching lines...) Expand all
173 178
174 static ReceivePort _receivePort; 179 static ReceivePort _receivePort;
175 static bool _handling_callbacks = false; 180 static bool _handling_callbacks = false;
176 181
177 var _callback; 182 var _callback;
178 int _milliSeconds; 183 int _milliSeconds;
179 int _wakeupTime; 184 int _wakeupTime;
180 bool _repeating; 185 bool _repeating;
181 } 186 }
182 187
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698