OLD | NEW |
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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
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 intptr_t event_mask = GetPollEvents(events[i].events, di); | 340 intptr_t event_mask = GetPollEvents(events[i].events, di); |
| 341 if ((event_mask & (1 << kErrorEvent)) != 0) { |
| 342 di->NotifyAllDartPorts(event_mask); |
| 343 } |
| 344 event_mask &= ~(1 << kErrorEvent); |
| 345 |
340 if (event_mask != 0) { | 346 if (event_mask != 0) { |
341 intptr_t old_mask = di->Mask(); | |
342 Dart_Port port = di->NextNotifyDartPort(event_mask); | 347 Dart_Port port = di->NextNotifyDartPort(event_mask); |
343 ASSERT(port != 0); | 348 ASSERT(port != 0); |
344 UpdateEpollInstance(old_mask, di); | 349 UpdateEpollInstance(old_mask, di); |
345 DartUtils::PostInt32(port, event_mask); | 350 DartUtils::PostInt32(port, event_mask); |
346 } | 351 } |
347 } | 352 } |
348 } | 353 } |
349 if (interrupt_seen) { | 354 if (interrupt_seen) { |
350 // 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 |
351 // the current events. | 356 // the current events. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 // The hashmap does not support keys with value 0. | 442 // The hashmap does not support keys with value 0. |
438 return dart::Utils::WordHash(fd + 1); | 443 return dart::Utils::WordHash(fd + 1); |
439 } | 444 } |
440 | 445 |
441 } // namespace bin | 446 } // namespace bin |
442 } // namespace dart | 447 } // namespace dart |
443 | 448 |
444 #endif // defined(TARGET_OS_ANDROID) | 449 #endif // defined(TARGET_OS_ANDROID) |
445 | 450 |
446 #endif // !defined(DART_IO_DISABLED) | 451 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |