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

Unified Diff: third_party/mojo/src/mojo/public/dart/src/timer_queue.dart

Issue 1157843002: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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: third_party/mojo/src/mojo/public/dart/src/timer_queue.dart
diff --git a/third_party/mojo/src/mojo/public/dart/src/timer_queue.dart b/third_party/mojo/src/mojo/public/dart/src/timer_queue.dart
deleted file mode 100644
index 01c2493da204ed948fcfcb39c8542e6bf1245f6b..0000000000000000000000000000000000000000
--- a/third_party/mojo/src/mojo/public/dart/src/timer_queue.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2014 The Chromium Authors. 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 internal;
-
-class Timeout implements Comparable<Timeout> {
- int deadline; // milliseconds since the Unix epoch.
- SendPort port;
-
- Timeout(this.port, this.deadline);
-
- int compareTo(Timeout other) => deadline - other.deadline;
-}
-
-class TimerQueue {
- SplayTreeSet _set;
- Timeout _nextTimer;
-
- TimerQueue() : _set = new SplayTreeSet();
-
- void updateTimer(SendPort port, int deadline) {
- var removedTimeout = null;
- _set.removeWhere((timeout) {
- if (timeout.port == port) {
- removedTimeout = timeout;
- return true;
- }
- return false;
- });
-
- if ((removedTimeout == null) && (deadline >= 0)) {
- _set.add(new Timeout(port, deadline));
- } else {
- if (deadline > 0) {
- removedTimeout.deadline = deadline;
- _set.add(removedTimeout);
- }
- }
-
- if (_set.isNotEmpty) {
- _nextTimer = _set.first;
- } else {
- _nextTimer = null;
- }
- }
-
- void removeCurrent() => updateTimer(currentPort, -1);
-
- bool get hasTimer => _nextTimer != null;
- int get currentTimeout => _nextTimer.deadline;
- SendPort get currentPort => _nextTimer.port;
-}
« no previous file with comments | « third_party/mojo/src/mojo/public/dart/src/stub.dart ('k') | third_party/mojo/src/mojo/public/dart/src/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698