| 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 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 153 } |
| 154 | 154 |
| 155 | 155 |
| 156 void EventHandlerImplementation::WakeupHandler(intptr_t id, | 156 void EventHandlerImplementation::WakeupHandler(intptr_t id, |
| 157 Dart_Port dart_port, | 157 Dart_Port dart_port, |
| 158 int64_t data) { | 158 int64_t data) { |
| 159 InterruptMessage msg; | 159 InterruptMessage msg; |
| 160 msg.id = id; | 160 msg.id = id; |
| 161 msg.dart_port = dart_port; | 161 msg.dart_port = dart_port; |
| 162 msg.data = data; | 162 msg.data = data; |
| 163 // WriteToBlocking will write up to 512 bytes atomically, and since our msg |
| 164 // is smaller than 512, we don't need a thread lock. |
| 165 // See: http://linux.die.net/man/7/pipe, section 'Pipe_buf'. |
| 163 intptr_t result = | 166 intptr_t result = |
| 164 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); | 167 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); |
| 165 if (result != kInterruptMessageSize) { | 168 if (result != kInterruptMessageSize) { |
| 166 if (result == -1) { | 169 if (result == -1) { |
| 167 perror("Interrupt message failure:"); | 170 perror("Interrupt message failure:"); |
| 168 } | 171 } |
| 169 FATAL1("Interrupt message failure. Wrote %d bytes.", result); | 172 FATAL1("Interrupt message failure. Wrote %d bytes.", result); |
| 170 } | 173 } |
| 171 } | 174 } |
| 172 | 175 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 444 |
| 442 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 445 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 443 // The hashmap does not support keys with value 0. | 446 // The hashmap does not support keys with value 0. |
| 444 return dart::Utils::WordHash(fd + 1); | 447 return dart::Utils::WordHash(fd + 1); |
| 445 } | 448 } |
| 446 | 449 |
| 447 } // namespace bin | 450 } // namespace bin |
| 448 } // namespace dart | 451 } // namespace dart |
| 449 | 452 |
| 450 #endif // defined(TARGET_OS_ANDROID) | 453 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |