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

Unified Diff: runtime/bin/eventhandler_macos.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_macos.h ('k') | runtime/bin/eventhandler_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_macos.cc
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index 826e6000341e1f90adbec778f8d673490cf707e1..9a60d6f0037e547f891872d35dc1c3a363639862 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -130,8 +130,6 @@ EventHandlerImplementation::EventHandlerImplementation()
FDUtils::SetNonBlocking(interrupt_fds_[0]);
FDUtils::SetCloseOnExec(interrupt_fds_[0]);
FDUtils::SetCloseOnExec(interrupt_fds_[1]);
- timeout_ = kInfinityTimeout;
- timeout_port_ = 0;
shutdown_ = false;
kqueue_fd_ = TEMP_FAILURE_RETRY(kqueue());
@@ -215,8 +213,7 @@ void EventHandlerImplementation::HandleInterruptFd() {
InterruptMessage msg;
while (GetInterruptMessage(&msg)) {
if (msg.id == kTimerId) {
- timeout_ = msg.data;
- timeout_port_ = msg.dart_port;
+ timeout_queue_.UpdateTimeout(msg.dart_port, msg.data);
} else if (msg.id == kShutdownId) {
shutdown_ = true;
} else {
@@ -360,21 +357,22 @@ void EventHandlerImplementation::HandleEvents(struct kevent* events,
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;
}
void EventHandlerImplementation::HandleTimeout() {
- if (timeout_ != kInfinityTimeout) {
- int64_t millis = timeout_ - TimerUtils::GetCurrentTimeMilliseconds();
+ if (timeout_queue_.HasTimeout()) {
+ int64_t millis = timeout_queue_.CurrentTimeout() -
+ TimerUtils::GetCurrentTimeMilliseconds();
if (millis <= 0) {
- DartUtils::PostNull(timeout_port_);
- timeout_ = kInfinityTimeout;
- timeout_port_ = 0;
+ DartUtils::PostNull(timeout_queue_.CurrentPort());
+ timeout_queue_.RemoveCurrent();
}
}
}
« no previous file with comments | « runtime/bin/eventhandler_macos.h ('k') | runtime/bin/eventhandler_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698