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

Unified Diff: runtime/bin/eventhandler_linux.cc

Issue 2996243003: Reapply "[vm] Prevent non-fatal errors from causing timers to be dropped." (Closed)
Patch Set: Created 3 years, 4 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/lib/timer_impl.dart » ('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 7217da1b86bbc5e45c947fbe9d17808b8e859ce4..091dd50254dd51c79bb4eb1cd752f19cad2edee0 100644
--- a/runtime/bin/eventhandler_linux.cc
+++ b/runtime/bin/eventhandler_linux.cc
@@ -200,15 +200,7 @@ void EventHandlerImplementation::HandleInterruptFd() {
for (ssize_t i = 0; i < bytes / kInterruptMessageSize; i++) {
if (msg[i].id == kTimerId) {
timeout_queue_.UpdateTimeout(msg[i].dart_port, msg[i].data);
- struct itimerspec it;
- memset(&it, 0, sizeof(it));
- if (timeout_queue_.HasTimeout()) {
- int64_t millis = timeout_queue_.CurrentTimeout();
- it.it_value.tv_sec = millis / 1000;
- it.it_value.tv_nsec = (millis % 1000) * 1000000;
- }
- VOID_NO_RETRY_EXPECTED(
- timerfd_settime(timer_fd_, TFD_TIMER_ABSTIME, &it, NULL));
+ UpdateTimerFd();
} else if (msg[i].id == kShutdownId) {
shutdown_ = true;
} else {
@@ -283,6 +275,18 @@ void EventHandlerImplementation::HandleInterruptFd() {
}
}
+void EventHandlerImplementation::UpdateTimerFd() {
+ struct itimerspec it;
+ memset(&it, 0, sizeof(it));
+ if (timeout_queue_.HasTimeout()) {
+ int64_t millis = timeout_queue_.CurrentTimeout();
+ it.it_value.tv_sec = millis / 1000;
+ it.it_value.tv_nsec = (millis % 1000) * 1000000;
+ }
+ VOID_NO_RETRY_EXPECTED(
+ timerfd_settime(timer_fd_, TFD_TIMER_ABSTIME, &it, NULL));
+}
+
#ifdef DEBUG_POLL
static void PrintEventMask(intptr_t fd, intptr_t events) {
Log::Print("%d ", fd);
@@ -351,6 +355,7 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
DartUtils::PostNull(timeout_queue_.CurrentPort());
timeout_queue_.RemoveCurrent();
}
+ UpdateTimerFd();
} else {
DescriptorInfo* di =
reinterpret_cast<DescriptorInfo*>(events[i].data.ptr);
« no previous file with comments | « runtime/bin/eventhandler_linux.h ('k') | runtime/lib/timer_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698