OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 14 matching lines...) Expand all Loading... |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "platform/Timer.h" | 28 #include "platform/Timer.h" |
29 | 29 |
30 #include "platform/PlatformThreadData.h" | 30 #include "platform/PlatformThreadData.h" |
31 #include "platform/ThreadTimers.h" | 31 #include "platform/ThreadTimers.h" |
32 #include "wtf/Atomics.h" | 32 #include "wtf/Atomics.h" |
33 #include "wtf/CurrentTime.h" | 33 #include "wtf/CurrentTime.h" |
34 #include "wtf/HashSet.h" | 34 #include "wtf/HashSet.h" |
| 35 #include <algorithm> |
35 #include <limits.h> | 36 #include <limits.h> |
| 37 #include <limits> |
36 #include <math.h> | 38 #include <math.h> |
37 #include <limits> | |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 class TimerHeapReference; | 42 class TimerHeapReference; |
42 | 43 |
43 // Timers are stored in a heap data structure, used to implement a priority queu
e. | 44 // Timers are stored in a heap data structure, used to implement a priority queu
e. |
44 // This allows us to efficiently determine which timer needs to fire the soonest
. | 45 // This allows us to efficiently determine which timer needs to fire the soonest
. |
45 // Then we set a single shared system timer to fire at that time. | 46 // Then we set a single shared system timer to fire at that time. |
46 // | 47 // |
47 // When a timer's "next fire time" changes, we need to move it around in the pri
ority queue. | 48 // When a timer's "next fire time" changes, we need to move it around in the pri
ority queue. |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 setNextFireTime(m_unalignedNextFireTime); | 400 setNextFireTime(m_unalignedNextFireTime); |
400 } | 401 } |
401 | 402 |
402 double TimerBase::nextUnalignedFireInterval() const | 403 double TimerBase::nextUnalignedFireInterval() const |
403 { | 404 { |
404 ASSERT(isActive()); | 405 ASSERT(isActive()); |
405 return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0
); | 406 return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0
); |
406 } | 407 } |
407 | 408 |
408 } // namespace blink | 409 } // namespace blink |
OLD | NEW |