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

Side by Side Diff: tools/dom/src/Timer.dart

Issue 13148003: Quick fix. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 html; 5 part of html;
6 6
7 // TODO(antonm): support not DOM isolates too. 7 // TODO(antonm): support not DOM isolates too.
8 class _Timer implements Timer { 8 class _Timer implements Timer {
9 final canceller; 9 final canceller;
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 callback(this); 45 callback(this);
46 if (!repeating) _cancel(); 46 if (!repeating) _cancel();
47 }); 47 });
48 _HELPER_ISOLATE_PORT.then((port) { 48 _HELPER_ISOLATE_PORT.then((port) {
49 port.send([_NEW_TIMER, milliSeconds, repeating], _sendPort); 49 port.send([_NEW_TIMER, milliSeconds, repeating], _sendPort);
50 }); 50 });
51 } 51 }
52 52
53 void cancel() { 53 void cancel() {
54 _cancel(); 54 _cancel();
55 _HELPER_ISOLATE_PORT.send([_CANCEL_TIMER], _sendPort); 55 _HELPER_ISOLATE_PORT.then((port) {
56 port.send([_CANCEL_TIMER], _sendPort);
57 });
56 } 58 }
57 59
58 void _cancel() { 60 void _cancel() {
59 _port.close(); 61 _port.close();
60 } 62 }
61 63
62 static final Future<SendPort> _HELPER_ISOLATE_PORT = 64 static final Future<SendPort> _HELPER_ISOLATE_PORT =
63 spawnDomFunction(_helperIsolateMain); 65 spawnDomFunction(_helperIsolateMain);
64 } 66 }
65 67
(...skipping 11 matching lines...) Expand all
77 new Timer(duration, callback); 79 new Timer(duration, callback);
78 } else if (cmd == _CANCEL_TIMER) { 80 } else if (cmd == _CANCEL_TIMER) {
79 _TIMER_REGISTRY.remove(replyTo).cancel(); 81 _TIMER_REGISTRY.remove(replyTo).cancel();
80 } 82 }
81 }); 83 });
82 } 84 }
83 85
84 get _pureIsolateTimerFactoryClosure => 86 get _pureIsolateTimerFactoryClosure =>
85 ((int milliSeconds, void callback(Timer time), bool repeating) => 87 ((int milliSeconds, void callback(Timer time), bool repeating) =>
86 new _PureIsolateTimer(milliSeconds, callback, repeating)); 88 new _PureIsolateTimer(milliSeconds, callback, repeating));
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698