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

Unified Diff: lib/isolate/frog/isolateimpl.dart

Issue 9677019: Enable isolate tests with leg and legium. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frog/leg/lib/uri_toremove.dart ('k') | lib/isolate/isolate_leg.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/isolate/frog/isolateimpl.dart
===================================================================
--- lib/isolate/frog/isolateimpl.dart (revision 5409)
+++ lib/isolate/frog/isolateimpl.dart (working copy)
@@ -197,6 +197,16 @@
}
}
+// We don't want to import the DOM library just because of window.setTimeout,
+// so we reconstruct the Window class here. The only conflict that could happen
+// with the other DOMWindow class would be because of subclasses.
+// Currently, none of the two Dart classes have subclasses.
+typedef void _TimeoutHandler();
+class _Window native "@*DOMWindow" {
+ int setTimeout(_TimeoutHandler handler, int timeout) native;
+}
+_Window get _window() native
+ """return typeof window != 'undefined' ? window : (void 0);""";
/** Represent the event loop on a javascript thread (DOM or worker). */
class _EventLoop {
@@ -224,23 +234,16 @@
return true;
}
- /** Function equivalent to [:window.setTimeout:] when available, or null. */
- static Function _wrapSetTimeout() native """
- return typeof window != 'undefined' ?
- function(a, b) { window.setTimeout(a, b); } : undefined;
- """;
-
/**
* Runs multiple iterations of the run-loop. If possible, each iteration is
* run asynchronously.
*/
void _runHelper() {
- final setTimeout = _wrapSetTimeout();
- if (setTimeout != null) {
+ if (_window != null) {
// Run each iteration from the browser's top event loop.
void next() {
if (!runIteration()) return;
- setTimeout(next, 0);
+ _window.setTimeout(next, 0);
}
next();
} else {
« no previous file with comments | « frog/leg/lib/uri_toremove.dart ('k') | lib/isolate/isolate_leg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698