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

Side by Side Diff: tool/input_sdk/patch/async_patch.dart

Issue 1152333009: Delete dart2js specific private library code (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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
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 // Patch file for the dart:async library. 5 // Patch file for the dart:async library.
6 6
7 import 'dart:_js_helper' show 7 import 'dart:_js_helper' show
8 patch, 8 patch,
9 Primitives, 9 Primitives,
10 convertDartClosureToJS, 10 convertDartClosureToJS;
11 requiresPreamble;
12 import 'dart:_isolate_helper' show 11 import 'dart:_isolate_helper' show
13 IsolateNatives, 12 IsolateNatives,
14 TimerImpl, 13 TimerImpl,
15 leaveJsAsync, 14 leaveJsAsync,
16 enterJsAsync, 15 enterJsAsync,
17 isWorker; 16 isWorker;
18 17
19 import 'dart:_foreign_helper' show JS; 18 import 'dart:_foreign_helper' show JS;
20 19
21 @patch 20 @patch
22 class _AsyncRun { 21 class _AsyncRun {
23 @patch 22 @patch
24 static void _scheduleImmediate(void callback()) { 23 static void _scheduleImmediate(void callback()) {
25 scheduleImmediateClosure(callback); 24 scheduleImmediateClosure(callback);
26 } 25 }
27 26
28 // Lazily initialized. 27 // Lazily initialized.
29 static final Function scheduleImmediateClosure = 28 static final Function scheduleImmediateClosure =
30 _initializeScheduleImmediate(); 29 _initializeScheduleImmediate();
31 30
32 static Function _initializeScheduleImmediate() { 31 static Function _initializeScheduleImmediate() {
33 requiresPreamble();
34 if (JS('', 'self.scheduleImmediate') != null) { 32 if (JS('', 'self.scheduleImmediate') != null) {
35 return _scheduleImmediateJsOverride; 33 return _scheduleImmediateJsOverride;
36 } 34 }
37 if (JS('', 'self.MutationObserver') != null && 35 if (JS('', 'self.MutationObserver') != null &&
38 JS('', 'self.document') != null) { 36 JS('', 'self.document') != null) {
39 // Use mutationObservers. 37 // Use mutationObservers.
40 var div = JS('', 'self.document.createElement("div")'); 38 var div = JS('', 'self.document.createElement("div")');
41 var span = JS('', 'self.document.createElement("span")'); 39 var span = JS('', 'self.document.createElement("span")');
42 var storedCallback; 40 var storedCallback;
43 41
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 @patch 114 @patch
117 static Timer _createPeriodicTimer(Duration duration, 115 static Timer _createPeriodicTimer(Duration duration,
118 void callback(Timer timer)) { 116 void callback(Timer timer)) {
119 int milliseconds = duration.inMilliseconds; 117 int milliseconds = duration.inMilliseconds;
120 if (milliseconds < 0) milliseconds = 0; 118 if (milliseconds < 0) milliseconds = 0;
121 return new TimerImpl.periodic(milliseconds, callback); 119 return new TimerImpl.periodic(milliseconds, callback);
122 } 120 }
123 } 121 }
124 122
125 bool get _hasDocument => JS('String', 'typeof document') == 'object'; 123 bool get _hasDocument => JS('String', 'typeof document') == 'object';
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698