| 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <poll.h> | 6 #include <poll.h> |
| 7 #include <pthread.h> | 7 #include <pthread.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/time.h> | 10 #include <sys/time.h> |
| 11 #include <unistd.h> | 11 #include <unistd.h> |
| 12 | 12 |
| 13 #include "bin/eventhandler.h" | 13 #include "bin/eventhandler.h" |
| 14 #include "bin/fdutils.h" | 14 #include "bin/fdutils.h" |
| 15 #include "bin/hashmap.h" | 15 #include "bin/hashmap.h" |
| 16 #include "bin/utils.h" | 16 #include "platform/utils.h" |
| 17 | 17 |
| 18 | 18 |
| 19 int64_t GetCurrentTimeMilliseconds() { | 19 int64_t GetCurrentTimeMilliseconds() { |
| 20 struct timeval tv; | 20 struct timeval tv; |
| 21 if (gettimeofday(&tv, NULL) < 0) { | 21 if (gettimeofday(&tv, NULL) < 0) { |
| 22 UNREACHABLE(); | 22 UNREACHABLE(); |
| 23 return 0; | 23 return 0; |
| 24 } | 24 } |
| 25 return ((static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec) / 1000; | 25 return ((static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec) / 1000; |
| 26 } | 26 } |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { | 380 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { |
| 381 // The hashmap does not support keys with value 0. | 381 // The hashmap does not support keys with value 0. |
| 382 return reinterpret_cast<void*>(fd + 1); | 382 return reinterpret_cast<void*>(fd + 1); |
| 383 } | 383 } |
| 384 | 384 |
| 385 | 385 |
| 386 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 386 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 387 // The hashmap does not support keys with value 0. | 387 // The hashmap does not support keys with value 0. |
| 388 return dart::Utils::WordHash(fd + 1); | 388 return dart::Utils::WordHash(fd + 1); |
| 389 } | 389 } |
| OLD | NEW |