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 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
7 | 7 |
8 #include "bin/eventhandler.h" | 8 #include "bin/eventhandler.h" |
9 #include "bin/eventhandler_android.h" | 9 #include "bin/eventhandler_android.h" |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 | 127 |
128 | 128 |
129 void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, | 129 void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, |
130 DescriptorInfo *di) { | 130 DescriptorInfo *di) { |
131 intptr_t new_mask = di->Mask(); | 131 intptr_t new_mask = di->Mask(); |
132 if (old_mask != 0 && new_mask == 0) { | 132 if (old_mask != 0 && new_mask == 0) { |
133 RemoveFromEpollInstance(epoll_fd_, di); | 133 RemoveFromEpollInstance(epoll_fd_, di); |
134 } else if (old_mask == 0 && new_mask != 0) { | 134 } else if (old_mask == 0 && new_mask != 0) { |
135 AddToEpollInstance(epoll_fd_, di); | 135 AddToEpollInstance(epoll_fd_, di); |
136 } else if (old_mask != 0 && new_mask != 0) { | 136 } else if (old_mask != 0 && new_mask != 0 && old_mask != new_mask) { |
137 if (di->IsListeningSocket()) { | 137 ASSERT(!di->IsListeningSocket()); |
138 ASSERT(old_mask == new_mask); | 138 RemoveFromEpollInstance(epoll_fd_, di); |
139 } else { | 139 AddToEpollInstance(epoll_fd_, di); |
140 RemoveFromEpollInstance(epoll_fd_, di); | |
141 AddToEpollInstance(epoll_fd_, di); | |
142 } | |
143 } | 140 } |
144 } | 141 } |
145 | 142 |
146 | 143 |
147 DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( | 144 DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( |
148 intptr_t fd, bool is_listening) { | 145 intptr_t fd, bool is_listening) { |
149 ASSERT(fd >= 0); | 146 ASSERT(fd >= 0); |
150 HashMap::Entry* entry = socket_map_.Lookup( | 147 HashMap::Entry* entry = socket_map_.Lookup( |
151 GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd), true); | 148 GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd), true); |
152 ASSERT(entry != NULL); | 149 ASSERT(entry != NULL); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 405 |
409 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 406 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
410 // The hashmap does not support keys with value 0. | 407 // The hashmap does not support keys with value 0. |
411 return dart::Utils::WordHash(fd + 1); | 408 return dart::Utils::WordHash(fd + 1); |
412 } | 409 } |
413 | 410 |
414 } // namespace bin | 411 } // namespace bin |
415 } // namespace dart | 412 } // namespace dart |
416 | 413 |
417 #endif // defined(TARGET_OS_ANDROID) | 414 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |