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

Side by Side Diff: tools/dom/templates/html/impl/impl_Window.darttemplate

Issue 27441002: Removing setImmediate and hiding WindowTimers interface (take 2) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: The fix Created 7 years, 2 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 | « tools/dom/templates/html/dartium/html_dartium.darttemplate ('k') | no next file » | 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) 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 $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 @DocsEditable 7 @DocsEditable
8 $if DART2JS 8 $if DART2JS
9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind ow,DOMWindow" { 9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind ow,DOMWindow" {
10 $else 10 $else
11 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 11 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
12 $endif 12 $endif
13 13
14 /** 14 /**
15 * Executes a [callback] after the immediate execution stack has completed.
16 *
17 * This differs from using Timer.run(callback)
18 * because Timer will run in about 4-15 milliseconds, depending on browser,
19 * depending on load. [setImmediate], in contrast, makes browser-specific
20 * changes in behavior to attempt to run immediately after the current
21 * frame unwinds, causing the future to complete after all processing has
22 * completed for the current event, but before any subsequent events.
23 */
24 void setImmediate(TimeoutHandler callback) {
25 _addMicrotaskCallback(callback);
26 }
27 /**
28 * Lookup a port by its [name]. Return null if no port is 15 * Lookup a port by its [name]. Return null if no port is
29 * registered under [name]. 16 * registered under [name].
30 */ 17 */
31 SendPortSync lookupPort(String name) { 18 SendPortSync lookupPort(String name) {
32 var portStr = document.documentElement.attributes['dart-port:$name']; 19 var portStr = document.documentElement.attributes['dart-port:$name'];
33 if (portStr == null) { 20 if (portStr == null) {
34 return null; 21 return null;
35 } 22 }
36 var port = JSON.decode(portStr); 23 var port = JSON.decode(portStr);
37 return _deserialize(port); 24 return _deserialize(port);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 @SupportedBrowser(SupportedBrowser.IE, '10.0') 202 @SupportedBrowser(SupportedBrowser.IE, '10.0')
216 @Experimental() 203 @Experimental()
217 IdbFactory get indexedDB => 204 IdbFactory get indexedDB =>
218 JS('IdbFactory|Null', // If not supported, returns `null`. 205 JS('IdbFactory|Null', // If not supported, returns `null`.
219 '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB', 206 '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
220 this, this, this); 207 this, this, this);
221 208
222 @DomName('Window.console') 209 @DomName('Window.console')
223 Console get console => Console._safeConsole; 210 Console get console => Console._safeConsole;
224 211
225 /// Checks if _setImmediate is supported.
226 static bool get _supportsSetImmediate =>
227 JS('bool', '!!(window.setImmediate)');
228
229 // Set immediate implementation for IE
230 void _setImmediate(void callback()) {
231 JS('void', '#.setImmediate(#)', this, convertDartClosureToJS(callback, 0));
232 }
233 $else 212 $else
234 /// Checks if _setImmediate is supported.
235 static bool get _supportsSetImmediate => false;
236
237 /// Dartium stub for IE's setImmediate.
238 void _setImmediate(void callback()) {
239 throw new UnsupportedError('setImmediate is not supported');
240 }
241
242 /** 213 /**
243 * Called to draw an animation frame and then request the window to repaint 214 * Called to draw an animation frame and then request the window to repaint
244 * after [callback] has finished (creating the animation). 215 * after [callback] has finished (creating the animation).
245 * 216 *
246 * Use this method only if you need to later call [cancelAnimationFrame]. If 217 * Use this method only if you need to later call [cancelAnimationFrame]. If
247 * not, the preferred Dart idiom is to set animation frames by calling 218 * not, the preferred Dart idiom is to set animation frames by calling
248 * [animationFrame], which returns a Future. 219 * [animationFrame], which returns a Future.
249 * 220 *
250 * Returns a non-zero valued integer to represent the request id for this 221 * Returns a non-zero valued integer to represent the request id for this
251 * request. This value only needs to be saved if you intend to call 222 * request. This value only needs to be saved if you intend to call
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 return wrapped.returnValue; 341 return wrapped.returnValue;
371 }); 342 });
372 343
373 return controller.stream; 344 return controller.stream;
374 } 345 }
375 346
376 String getEventType(EventTarget target) { 347 String getEventType(EventTarget target) {
377 return _eventType; 348 return _eventType;
378 } 349 }
379 } 350 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/dartium/html_dartium.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698