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

Unified Diff: runtime/bin/eventhandler_win.cc

Issue 17851004: One event handler for all isolates (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused line. Created 7 years, 5 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
« no previous file with comments | « runtime/bin/eventhandler_win.h ('k') | runtime/bin/isolate_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_win.cc
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index f1257c3ce5054c900dbf047ba5ad14a4600be95e..332f80f8731b815081b89952e165b2d3fd6cb7d6 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -670,8 +670,7 @@ void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) {
if (msg->id == kTimeoutId) {
// Change of timeout request. Just set the new timeout and port as the
// completion thread will use the new timeout value for its next wait.
- timeout_ = msg->data;
- timeout_port_ = msg->dart_port;
+ timeout_queue_.UpdateTimeout(msg->dart_port, msg->data);
} else if (msg->id == kShutdownId) {
shutdown_ = true;
} else {
@@ -864,10 +863,9 @@ void EventHandlerImplementation::HandleDisconnect(
}
void EventHandlerImplementation::HandleTimeout() {
- // TODO(sgjesse) check if there actually is a timeout.
- DartUtils::PostNull(timeout_port_);
- timeout_ = kInfinityTimeout;
- timeout_port_ = 0;
+ if (!timeout_queue_.HasTimeout()) return;
+ DartUtils::PostNull(timeout_queue_.CurrentPort());
+ timeout_queue_.RemoveCurrent();
}
@@ -909,8 +907,6 @@ EventHandlerImplementation::EventHandlerImplementation() {
if (completion_port_ == NULL) {
FATAL("Completion port creation failed");
}
- timeout_ = kInfinityTimeout;
- timeout_port_ = 0;
shutdown_ = false;
}
@@ -921,10 +917,11 @@ EventHandlerImplementation::~EventHandlerImplementation() {
int64_t EventHandlerImplementation::GetTimeout() {
- if (timeout_ == kInfinityTimeout) {
+ if (!timeout_queue_.HasTimeout()) {
return kInfinityTimeout;
}
- int64_t millis = timeout_ - TimerUtils::GetCurrentTimeMilliseconds();
+ int64_t millis = timeout_queue_.CurrentTimeout() -
+ TimerUtils::GetCurrentTimeMilliseconds();
return (millis < 0) ? 0 : millis;
}
« no previous file with comments | « runtime/bin/eventhandler_win.h ('k') | runtime/bin/isolate_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698