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

Side by Side Diff: runtime/bin/eventhandler_linux.cc

Issue 83483003: Fix re-adding to epoll, when event is unhandled. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include "bin/eventhandler.h" 8 #include "bin/eventhandler.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 void EventHandlerImplementation::HandleEvents(struct epoll_event* events, 335 void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
336 int size) { 336 int size) {
337 bool interrupt_seen = false; 337 bool interrupt_seen = false;
338 for (int i = 0; i < size; i++) { 338 for (int i = 0; i < size; i++) {
339 if (events[i].data.ptr == NULL) { 339 if (events[i].data.ptr == NULL) {
340 interrupt_seen = true; 340 interrupt_seen = true;
341 } else { 341 } else {
342 SocketData* sd = reinterpret_cast<SocketData*>(events[i].data.ptr); 342 SocketData* sd = reinterpret_cast<SocketData*>(events[i].data.ptr);
343 intptr_t event_mask = GetPollEvents(events[i].events, sd); 343 intptr_t event_mask = GetPollEvents(events[i].events, sd);
344 if (event_mask != 0) { 344 if (event_mask == 0) {
345 // Event not handled, re-add to epoll.
346 UpdateEpollInstance(epoll_fd_, sd);
347 } else {
345 Dart_Port port = sd->port(); 348 Dart_Port port = sd->port();
346 ASSERT(port != 0); 349 ASSERT(port != 0);
347 DartUtils::PostInt32(port, event_mask); 350 DartUtils::PostInt32(port, event_mask);
348 } 351 }
349 } 352 }
350 } 353 }
351 if (interrupt_seen) { 354 if (interrupt_seen) {
352 // Handle after socket events, so we avoid closing a socket before we handle 355 // Handle after socket events, so we avoid closing a socket before we handle
353 // the current events. 356 // the current events.
354 HandleInterruptFd(); 357 HandleInterruptFd();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 440
438 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { 441 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
439 // The hashmap does not support keys with value 0. 442 // The hashmap does not support keys with value 0.
440 return dart::Utils::WordHash(fd + 1); 443 return dart::Utils::WordHash(fd + 1);
441 } 444 }
442 445
443 } // namespace bin 446 } // namespace bin
444 } // namespace dart 447 } // namespace dart
445 448
446 #endif // defined(TARGET_OS_LINUX) 449 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698