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

Side by Side Diff: tools/dom/src/Microtask.dart

Issue 13044010: dom: more final more of the time (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: and more Created 7 years, 8 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) 2012, 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 part of html; 5 part of html;
6 6
7 typedef void _MicrotaskCallback(); 7 typedef void _MicrotaskCallback();
8 8
9 /** 9 /**
10 * This class attempts to invoke a callback as soon as the current event stack 10 * This class attempts to invoke a callback as soon as the current event stack
11 * unwinds, but before the browser repaints. 11 * unwinds, but before the browser repaints.
12 */ 12 */
13 abstract class _MicrotaskScheduler { 13 abstract class _MicrotaskScheduler {
14 bool _nextMicrotaskFrameScheduled = false; 14 bool _nextMicrotaskFrameScheduled = false;
15 _MicrotaskCallback _callback; 15 final _MicrotaskCallback _callback;
16 16
17 _MicrotaskScheduler(this._callback); 17 _MicrotaskScheduler(this._callback);
18 18
19 /** 19 /**
20 * Creates the best possible microtask scheduler for the current platform. 20 * Creates the best possible microtask scheduler for the current platform.
21 */ 21 */
22 factory _MicrotaskScheduler.best(_MicrotaskCallback callback) { 22 factory _MicrotaskScheduler.best(_MicrotaskCallback callback) {
23 if (Window._supportsSetImmediate) { 23 if (Window._supportsSetImmediate) {
24 return new _SetImmediateScheduler(callback); 24 return new _SetImmediateScheduler(callback);
25 } else if (MutationObserver.supported) { 25 } else if (MutationObserver.supported) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 /** 147 /**
148 * Complete all pending microtasks. 148 * Complete all pending microtasks.
149 */ 149 */
150 void _completeMicrotasks() { 150 void _completeMicrotasks() {
151 var callbacks = _pendingMicrotasks; 151 var callbacks = _pendingMicrotasks;
152 _pendingMicrotasks = null; 152 _pendingMicrotasks = null;
153 for (var callback in callbacks) { 153 for (var callback in callbacks) {
154 callback(); 154 callback();
155 } 155 }
156 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698