| 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 "bin/eventhandler.h" | 5 #include "bin/eventhandler.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <pthread.h> | 8 #include <pthread.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| 11 #include <sys/event.h> | 11 #include <sys/event.h> |
| 12 #include <sys/time.h> | 12 #include <sys/time.h> |
| 13 #include <unistd.h> | 13 #include <unistd.h> |
| 14 | 14 |
| 15 #include "bin/dartutils.h" | 15 #include "bin/dartutils.h" |
| 16 #include "bin/fdutils.h" | 16 #include "bin/fdutils.h" |
| 17 #include "bin/hashmap.h" | 17 #include "bin/hashmap.h" |
| 18 #include "platform/thread.h" |
| 18 #include "platform/utils.h" | 19 #include "platform/utils.h" |
| 19 | 20 |
| 20 | 21 |
| 21 int64_t GetCurrentTimeMilliseconds() { | 22 int64_t GetCurrentTimeMilliseconds() { |
| 22 struct timeval tv; | 23 struct timeval tv; |
| 23 if (gettimeofday(&tv, NULL) < 0) { | 24 if (gettimeofday(&tv, NULL) < 0) { |
| 24 UNREACHABLE(); | 25 UNREACHABLE(); |
| 25 return 0; | 26 return 0; |
| 26 } | 27 } |
| 27 return ((static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec) / 1000; | 28 return ((static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec) / 1000; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { | 403 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { |
| 403 // The hashmap does not support keys with value 0. | 404 // The hashmap does not support keys with value 0. |
| 404 return reinterpret_cast<void*>(fd + 1); | 405 return reinterpret_cast<void*>(fd + 1); |
| 405 } | 406 } |
| 406 | 407 |
| 407 | 408 |
| 408 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 409 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 409 // The hashmap does not support keys with value 0. | 410 // The hashmap does not support keys with value 0. |
| 410 return dart::Utils::WordHash(fd + 1); | 411 return dart::Utils::WordHash(fd + 1); |
| 411 } | 412 } |
| OLD | NEW |