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

Side by Side Diff: sdk/lib/_internal/lib/async_patch.dart

Issue 17064008: Revert "Zone support for Futures." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/enqueue.dart ('k') | sdk/lib/async/async.dart » ('j') | 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 // Patch file for the dart:async library. 5 // Patch file for the dart:async library.
6 6
7 import 'dart:_isolate_helper' show IsolateNatives, TimerImpl; 7 import 'dart:_isolate_helper' show IsolateNatives, TimerImpl;
8 import 'dart:_foreign_helper' show JS, DART_CLOSURE_TO_JS; 8 import 'dart:_foreign_helper' show JS, DART_CLOSURE_TO_JS;
9 9
10 patch Timer _createTimer(Duration duration, void callback()) { 10 patch class Timer {
11 int milliseconds = duration.inMilliseconds; 11 patch factory Timer(Duration duration, void callback()) {
12 if (milliseconds < 0) milliseconds = 0; 12 int milliseconds = duration.inMilliseconds;
13 return new TimerImpl(milliseconds, callback); 13 if (milliseconds < 0) milliseconds = 0;
14 } 14 return new TimerImpl(milliseconds, callback);
15 }
15 16
16 patch Timer _createPeriodicTimer(Duration duration, 17 patch factory Timer.periodic(Duration duration, void callback(Timer timer)) {
17 void callback(Timer timer)) { 18 int milliseconds = duration.inMilliseconds;
18 int milliseconds = duration.inMilliseconds; 19 if (milliseconds < 0) milliseconds = 0;
19 if (milliseconds < 0) milliseconds = 0; 20 return new TimerImpl.periodic(milliseconds, callback);
20 return new TimerImpl.periodic(milliseconds, callback); 21 }
21 } 22 }
22 23
23 patch class _AsyncRun { 24 patch class _AsyncRun {
24 patch static void _enqueueImmediate(void callback()) { 25 patch static void _enqueueImmediate(void callback()) {
25 // TODO(9002): don't use the Timer to enqueue the immediate callback. 26 // TODO(9002): don't use the Timer to enqueue the immediate callback.
26 _createTimer(Duration.ZERO, callback); 27 Timer.run(callback);
27 } 28 }
28 } 29 }
29 30
30 patch class DeferredLibrary { 31 patch class DeferredLibrary {
31 patch Future<bool> load() { 32 patch Future<bool> load() {
32 return _load(libraryName, uri); 33 return _load(libraryName, uri);
33 } 34 }
34 } 35 }
35 36
36 // TODO(ahe): This should not only apply to this isolate. 37 // TODO(ahe): This should not only apply to this isolate.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return completer.future; 76 return completer.future;
76 } 77 }
77 78
78 /// Used to implement deferred loading. Used as callback on "load" 79 /// Used to implement deferred loading. Used as callback on "load"
79 /// event above in [load]. 80 /// event above in [load].
80 _onDeferredLibraryLoad(Completer<bool> completer, event) { 81 _onDeferredLibraryLoad(Completer<bool> completer, event) {
81 completer.complete(true); 82 completer.complete(true);
82 } 83 }
83 84
84 bool get _hasDocument => JS('String', 'typeof document') == 'object'; 85 bool get _hasDocument => JS('String', 'typeof document') == 'object';
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/enqueue.dart ('k') | sdk/lib/async/async.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698