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

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

Issue 2655893002: VM eventhandler: Update epoll/kqueue even if the only event is an error (Closed)
Patch Set: No notifications on empty event mask Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/bin/eventhandler_fuchsia.cc » ('j') | 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 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #if defined(TARGET_OS_ANDROID) 8 #if defined(TARGET_OS_ANDROID)
9 9
10 #include "bin/eventhandler.h" 10 #include "bin/eventhandler.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 void EventHandlerImplementation::HandleEvents(struct epoll_event* events, 330 void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
331 int size) { 331 int size) {
332 bool interrupt_seen = false; 332 bool interrupt_seen = false;
333 for (int i = 0; i < size; i++) { 333 for (int i = 0; i < size; i++) {
334 if (events[i].data.ptr == NULL) { 334 if (events[i].data.ptr == NULL) {
335 interrupt_seen = true; 335 interrupt_seen = true;
336 } else { 336 } else {
337 DescriptorInfo* di = 337 DescriptorInfo* di =
338 reinterpret_cast<DescriptorInfo*>(events[i].data.ptr); 338 reinterpret_cast<DescriptorInfo*>(events[i].data.ptr);
339 const intptr_t old_mask = di->Mask(); 339 const intptr_t old_mask = di->Mask();
340 intptr_t event_mask = GetPollEvents(events[i].events, di); 340 const intptr_t event_mask = GetPollEvents(events[i].events, di);
341 if ((event_mask & (1 << kErrorEvent)) != 0) { 341 if ((event_mask & (1 << kErrorEvent)) != 0) {
342 di->NotifyAllDartPorts(event_mask); 342 di->NotifyAllDartPorts(event_mask);
343 } 343 UpdateEpollInstance(old_mask, di);
344 event_mask &= ~(1 << kErrorEvent); 344 } else if (event_mask != 0) {
345
346 if (event_mask != 0) {
347 Dart_Port port = di->NextNotifyDartPort(event_mask); 345 Dart_Port port = di->NextNotifyDartPort(event_mask);
348 ASSERT(port != 0); 346 ASSERT(port != 0);
349 UpdateEpollInstance(old_mask, di); 347 UpdateEpollInstance(old_mask, di);
350 DartUtils::PostInt32(port, event_mask); 348 DartUtils::PostInt32(port, event_mask);
351 } 349 }
352 } 350 }
353 } 351 }
354 if (interrupt_seen) { 352 if (interrupt_seen) {
355 // Handle after socket events, so we avoid closing a socket before we handle 353 // Handle after socket events, so we avoid closing a socket before we handle
356 // the current events. 354 // the current events.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // The hashmap does not support keys with value 0. 440 // The hashmap does not support keys with value 0.
443 return dart::Utils::WordHash(fd + 1); 441 return dart::Utils::WordHash(fd + 1);
444 } 442 }
445 443
446 } // namespace bin 444 } // namespace bin
447 } // namespace dart 445 } // namespace dart
448 446
449 #endif // defined(TARGET_OS_ANDROID) 447 #endif // defined(TARGET_OS_ANDROID)
450 448
451 #endif // !defined(DART_IO_DISABLED) 449 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/eventhandler_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698