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

Unified Diff: runtime/bin/eventhandler_linux.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_linux.h ('k') | runtime/bin/eventhandler_macos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_linux.cc
diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc
index 9ed591afcebf4be27620095bb8fb7766d6195db6..2b623915f432ab4211a89cd622707d5272cc80ad 100644
--- a/runtime/bin/eventhandler_linux.cc
+++ b/runtime/bin/eventhandler_linux.cc
@@ -111,8 +111,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;
// The initial size passed to epoll_create is ignore on newer (>=
// 2.6.8) Linux versions
@@ -198,12 +196,12 @@ bool EventHandlerImplementation::GetInterruptMessage(InterruptMessage* msg) {
return (total_read == kInterruptMessageSize) ? true : false;
}
+
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 {
@@ -365,21 +363,23 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* 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());
+ // Remove current from queue.
+ timeout_queue_.RemoveCurrent();
}
}
}
« no previous file with comments | « runtime/bin/eventhandler_linux.h ('k') | runtime/bin/eventhandler_macos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698