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

Side by Side Diff: sdk/lib/async/schedule_microtask.dart

Issue 217063004: "Reverting 34517" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of dart.async; 5 part of dart.async;
6 6
7 typedef void _AsyncCallback(); 7 typedef void _AsyncCallback();
8 8
9 class _AsyncCallbackEntry { 9 class _AsyncCallbackEntry {
10 final _AsyncCallback callback; 10 final _AsyncCallback callback;
(...skipping 13 matching lines...) Expand all
24 entry = _nextCallback = entry.next; 24 entry = _nextCallback = entry.next;
25 } 25 }
26 // Any new callback must register a callback function now. 26 // Any new callback must register a callback function now.
27 _lastCallback = null; 27 _lastCallback = null;
28 } 28 }
29 29
30 void _asyncRunCallback() { 30 void _asyncRunCallback() {
31 try { 31 try {
32 _asyncRunCallbackLoop(); 32 _asyncRunCallbackLoop();
33 } catch (e) { 33 } catch (e) {
34 print('microtask error ${e.stackTrace}'); // TODO(efortuna): Remove this.
35 _AsyncRun._scheduleImmediate(_asyncRunCallback); 34 _AsyncRun._scheduleImmediate(_asyncRunCallback);
36 _nextCallback = _nextCallback.next; 35 _nextCallback = _nextCallback.next;
37 rethrow; 36 rethrow;
38 } 37 }
39 } 38 }
40 39
41 void _scheduleAsyncCallback(callback) { 40 void _scheduleAsyncCallback(callback) {
42 // Optimizing a group of Timer.run callbacks to be executed in the 41 // Optimizing a group of Timer.run callbacks to be executed in the
43 // same Timer callback. 42 // same Timer callback.
44 if (_lastCallback == null) { 43 if (_lastCallback == null) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return; 81 return;
83 } 82 }
84 Zone.current.scheduleMicrotask( 83 Zone.current.scheduleMicrotask(
85 Zone.current.bindCallback(callback, runGuarded: true)); 84 Zone.current.bindCallback(callback, runGuarded: true));
86 } 85 }
87 86
88 class _AsyncRun { 87 class _AsyncRun {
89 /** Schedule the given callback before any other event in the event-loop. */ 88 /** Schedule the given callback before any other event in the event-loop. */
90 external static void _scheduleImmediate(void callback()); 89 external static void _scheduleImmediate(void callback());
91 } 90 }
OLDNEW
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698