| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 void EventHandlerImplementation::Start(EventHandler* handler) { | 337 void EventHandlerImplementation::Start(EventHandler* handler) { |
| 338 int result = dart::Thread::Start(&EventHandlerImplementation::Poll, | 338 int result = dart::Thread::Start(&EventHandlerImplementation::Poll, |
| 339 reinterpret_cast<uword>(handler)); | 339 reinterpret_cast<uword>(handler)); |
| 340 if (result != 0) { | 340 if (result != 0) { |
| 341 FATAL1("Failed to start event handler thread %d", result); | 341 FATAL1("Failed to start event handler thread %d", result); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 void EventHandlerImplementation::Shutdown() { | 346 void EventHandlerImplementation::Shutdown() { |
| 347 SendData(kShutdownId, 0, 0); | 347 Notify(kShutdownId, 0, 0); |
| 348 } | 348 } |
| 349 | 349 |
| 350 | 350 |
| 351 void EventHandlerImplementation::SendData(intptr_t id, | 351 void EventHandlerImplementation::Notify(intptr_t id, |
| 352 Dart_Port dart_port, | 352 Dart_Port dart_port, |
| 353 intptr_t data) { | 353 intptr_t data) { |
| 354 WakeupHandler(id, dart_port, data); | 354 WakeupHandler(id, dart_port, data); |
| 355 } | 355 } |
| 356 | 356 |
| 357 | 357 |
| 358 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { | 358 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { |
| 359 // The hashmap does not support keys with value 0. | 359 // The hashmap does not support keys with value 0. |
| 360 return reinterpret_cast<void*>(fd + 1); | 360 return reinterpret_cast<void*>(fd + 1); |
| 361 } | 361 } |
| 362 | 362 |
| 363 | 363 |
| 364 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 364 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 365 // The hashmap does not support keys with value 0. | 365 // The hashmap does not support keys with value 0. |
| 366 return dart::Utils::WordHash(fd + 1); | 366 return dart::Utils::WordHash(fd + 1); |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace bin | 369 } // namespace bin |
| 370 } // namespace dart | 370 } // namespace dart |
| 371 | 371 |
| 372 #endif // defined(TARGET_OS_ANDROID) | 372 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |