| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 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. | 164 // is smaller than 512, we don't need a thread lock. |
| 165 // See: http://linux.die.net/man/7/pipe, section 'Pipe_buf'. | 165 // See: http://linux.die.net/man/7/pipe, section 'Pipe_buf'. |
| 166 ASSERT(kInterruptMessageSize < PIPE_BUF); |
| 166 intptr_t result = | 167 intptr_t result = |
| 167 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); | 168 FDUtils::WriteToBlocking(interrupt_fds_[1], &msg, kInterruptMessageSize); |
| 168 if (result != kInterruptMessageSize) { | 169 if (result != kInterruptMessageSize) { |
| 169 if (result == -1) { | 170 if (result == -1) { |
| 170 perror("Interrupt message failure:"); | 171 perror("Interrupt message failure:"); |
| 171 } | 172 } |
| 172 FATAL1("Interrupt message failure. Wrote %d bytes.", result); | 173 FATAL1("Interrupt message failure. Wrote %d bytes.", result); |
| 173 } | 174 } |
| 174 } | 175 } |
| 175 | 176 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 445 |
| 445 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 446 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 446 // The hashmap does not support keys with value 0. | 447 // The hashmap does not support keys with value 0. |
| 447 return dart::Utils::WordHash(fd + 1); | 448 return dart::Utils::WordHash(fd + 1); |
| 448 } | 449 } |
| 449 | 450 |
| 450 } // namespace bin | 451 } // namespace bin |
| 451 } // namespace dart | 452 } // namespace dart |
| 452 | 453 |
| 453 #endif // defined(TARGET_OS_ANDROID) | 454 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |