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

Unified Diff: tools/dom/src/Timer.dart

Issue 13515004: Remove pseudo-shared Timer implementation. (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 side-by-side diff with in-line comments
Download patch
Index: tools/dom/src/Timer.dart
diff --git a/tools/dom/src/Timer.dart b/tools/dom/src/Timer.dart
deleted file mode 100644
index 604899bc47759e7076c04959f63cbe451e6a8352..0000000000000000000000000000000000000000
--- a/tools/dom/src/Timer.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of html;
-
-class _Timer implements Timer {
- final canceller;
-
- _Timer(this.canceller);
-
- void cancel() { canceller(); }
-}
-
-get _timerFactoryClosure => (int milliSeconds, void callback(Timer timer), bool repeating) {
- var maker;
- var canceller;
- if (repeating) {
- maker = window._setInterval;
- canceller = window._clearInterval;
- } else {
- maker = window._setTimeout;
- canceller = window._clearTimeout;
- }
- Timer timer;
- final int id = maker(() { callback(timer); }, milliSeconds);
- timer = new _Timer(() { canceller(id); });
- return timer;
-};
-
-class _PureIsolateTimer implements Timer {
- final ReceivePort _port = new ReceivePort();
- SendPort _sendPort; // Effectively final.
-
- static SendPort _SEND_PORT;
-
- _PureIsolateTimer(int milliSeconds, callback, repeating) {
- _sendPort = _port.toSendPort();
- _port.receive((msg, replyTo) {
- assert(msg == _TIMER_PING);
- callback(this);
- if (!repeating) _cancel();
- });
-
- _send([_NEW_TIMER, milliSeconds, repeating]);
- }
-
- void cancel() {
- _cancel();
- _send([_CANCEL_TIMER]);
- }
-
- void _cancel() {
- _port.close();
- }
-
- _send(msg) {
- _sendToHelperIsolate(msg, _sendPort);
- }
-}
-
-get _pureIsolateTimerFactoryClosure =>
- ((int milliSeconds, void callback(Timer time), bool repeating) =>
- new _PureIsolateTimer(milliSeconds, callback, repeating));

Powered by Google App Engine
This is Rietveld 408576698