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

Unified Diff: sdk/lib/html/dartium/html_dartium.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:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 3021b8557ea2edff8d8cc752c8e519a8561565ce..0f9f3a85bc691e2c7badb43ef94f13b3311d925d 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -33216,69 +33216,6 @@ class Rect {
Point get bottomRight => new Point(this.left + this.width,
this.top + this.height);
}
-// 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.
-
-
-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));
// Copyright (c) 2013, 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.
@@ -34558,3 +34495,62 @@ final _pureIsolatePrintClosure = (s) {
};
final _forwardingPrintClosure = _Utils.forwardingPrint;
+
+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