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

Side by Side Diff: lib/isolate/dart2js/compiler_hooks.dart

Issue 10830230: Add Timer implementation for dart2js. Also moves tests to appropriate location. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 // This file contains functions that are used in the code generated by 5 // This file contains functions that are used in the code generated by
6 // the dart2js compiler. 6 // the dart2js compiler.
7 7
8 /** 8 /**
9 * Wrapper that takes the dart entry point and runs it within an isolate. The 9 * Wrapper that takes the dart entry point and runs it within an isolate. The
10 * dart2js compiler will inject a call of the form 10 * dart2js compiler will inject a call of the form
11 * [: startRootIsolate(main); :] when it determines that this wrapping 11 * [: startRootIsolate(main); :] when it determines that this wrapping
12 * is needed. For single-isolate applications (e.g. hello world), this 12 * is needed. For single-isolate applications (e.g. hello world), this
13 * call is not emitted. 13 * call is not emitted.
14 */ 14 */
15 void startRootIsolate(entry) { 15 void startRootIsolate(entry) {
16 _globalState = new _Manager(); 16 _globalState = new _Manager();
17 17
18 // Don't start the main loop again, if we are in a worker. 18 // Don't start the main loop again, if we are in a worker.
19 if (_globalState.isWorker) return; 19 if (_globalState.isWorker) return;
20 final rootContext = new _IsolateContext(); 20 final rootContext = new _IsolateContext();
21 _globalState.rootContext = rootContext; 21 _globalState.rootContext = rootContext;
22 _fillStatics(rootContext); 22 _fillStatics(rootContext);
23 23
24 // BUG(5151491): Setting currentContext should not be necessary, but 24 // BUG(5151491): Setting currentContext should not be necessary, but
25 // because closures passed to the DOM as event handlers do not bind their 25 // because closures passed to the DOM as event handlers do not bind their
26 // isolate automatically we try to give them a reasonable context to live in 26 // isolate automatically we try to give them a reasonable context to live in
27 // by having a "default" isolate (the first one created). 27 // by having a "default" isolate (the first one created).
28 _globalState.currentContext = rootContext; 28 _globalState.currentContext = rootContext;
29 29
30 if (_window != null) {
31 rootContext.eval(() => _setTimerFactoryClosure( _timerFactory));
32 }
30 rootContext.eval(entry); 33 rootContext.eval(entry);
31 _globalState.topEventLoop.run(); 34 _globalState.topEventLoop.run();
32 } 35 }
OLDNEW
« no previous file with comments | « no previous file | lib/isolate/dart2js/isolateimpl.dart » ('j') | lib/isolate/dart2js/isolateimpl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698