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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 int result = | 401 int result = |
402 dart::Thread::Start(&EventHandlerImplementation::EventHandlerEntry, | 402 dart::Thread::Start(&EventHandlerImplementation::EventHandlerEntry, |
403 reinterpret_cast<uword>(handler)); | 403 reinterpret_cast<uword>(handler)); |
404 if (result != 0) { | 404 if (result != 0) { |
405 FATAL1("Failed to start event handler thread %d", result); | 405 FATAL1("Failed to start event handler thread %d", result); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 | 409 |
410 void EventHandlerImplementation::Shutdown() { | 410 void EventHandlerImplementation::Shutdown() { |
411 SendData(kShutdownId, 0, 0); | 411 Notify(kShutdownId, 0, 0); |
412 } | 412 } |
413 | 413 |
414 | 414 |
415 void EventHandlerImplementation::SendData(intptr_t id, | 415 void EventHandlerImplementation::Notify(intptr_t id, |
416 Dart_Port dart_port, | 416 Dart_Port dart_port, |
417 int64_t data) { | 417 int64_t data) { |
418 WakeupHandler(id, dart_port, data); | 418 WakeupHandler(id, dart_port, data); |
419 } | 419 } |
420 | 420 |
421 | 421 |
422 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { | 422 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { |
423 // The hashmap does not support keys with value 0. | 423 // The hashmap does not support keys with value 0. |
424 return reinterpret_cast<void*>(fd + 1); | 424 return reinterpret_cast<void*>(fd + 1); |
425 } | 425 } |
426 | 426 |
427 | 427 |
428 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 428 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
429 // The hashmap does not support keys with value 0. | 429 // The hashmap does not support keys with value 0. |
430 return dart::Utils::WordHash(fd + 1); | 430 return dart::Utils::WordHash(fd + 1); |
431 } | 431 } |
432 | 432 |
433 } // namespace bin | 433 } // namespace bin |
434 } // namespace dart | 434 } // namespace dart |
435 | 435 |
436 #endif // defined(TARGET_OS_MACOS) | 436 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |