| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 // ---------------- | 186 // ---------------- |
| 187 | 187 |
| 188 TimerBase::TimerBase() | 188 TimerBase::TimerBase() |
| 189 : m_nextFireTime(0) | 189 : m_nextFireTime(0) |
| 190 , m_unalignedNextFireTime(0) | 190 , m_unalignedNextFireTime(0) |
| 191 , m_repeatInterval(0) | 191 , m_repeatInterval(0) |
| 192 , m_heapIndex(-1) | 192 , m_heapIndex(-1) |
| 193 , m_cachedThreadGlobalTimerHeap(0) | 193 , m_cachedThreadGlobalTimerHeap(0) |
| 194 #ifndef NDEBUG | 194 #if ENABLE(ASSERT) |
| 195 , m_thread(currentThread()) | 195 , m_thread(currentThread()) |
| 196 #endif | 196 #endif |
| 197 { | 197 { |
| 198 } | 198 } |
| 199 | 199 |
| 200 TimerBase::~TimerBase() | 200 TimerBase::~TimerBase() |
| 201 { | 201 { |
| 202 stop(); | 202 stop(); |
| 203 ASSERT(!inHeap()); | 203 ASSERT(!inHeap()); |
| 204 } | 204 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 return false; | 341 return false; |
| 342 unsigned childIndex1 = 2 * m_heapIndex + 1; | 342 unsigned childIndex1 = 2 * m_heapIndex + 1; |
| 343 unsigned childIndex2 = childIndex1 + 1; | 343 unsigned childIndex2 = childIndex1 + 1; |
| 344 return childHeapPropertyHolds(this, heap, childIndex1) && childHeapPropertyH
olds(this, heap, childIndex2); | 344 return childHeapPropertyHolds(this, heap, childIndex1) && childHeapPropertyH
olds(this, heap, childIndex2); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void TimerBase::updateHeapIfNeeded(double oldTime) | 347 void TimerBase::updateHeapIfNeeded(double oldTime) |
| 348 { | 348 { |
| 349 if (m_nextFireTime && hasValidHeapPosition()) | 349 if (m_nextFireTime && hasValidHeapPosition()) |
| 350 return; | 350 return; |
| 351 #ifndef NDEBUG | 351 #if ENABLE(ASSERT) |
| 352 int oldHeapIndex = m_heapIndex; | 352 int oldHeapIndex = m_heapIndex; |
| 353 #endif | 353 #endif |
| 354 if (!oldTime) | 354 if (!oldTime) |
| 355 heapInsert(); | 355 heapInsert(); |
| 356 else if (!m_nextFireTime) | 356 else if (!m_nextFireTime) |
| 357 heapDelete(); | 357 heapDelete(); |
| 358 else if (m_nextFireTime < oldTime) | 358 else if (m_nextFireTime < oldTime) |
| 359 heapDecreaseKey(); | 359 heapDecreaseKey(); |
| 360 else | 360 else |
| 361 heapIncreaseKey(); | 361 heapIncreaseKey(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 407 } |
| 408 | 408 |
| 409 double TimerBase::nextUnalignedFireInterval() const | 409 double TimerBase::nextUnalignedFireInterval() const |
| 410 { | 410 { |
| 411 ASSERT(isActive()); | 411 ASSERT(isActive()); |
| 412 return max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0); | 412 return max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0); |
| 413 } | 413 } |
| 414 | 414 |
| 415 } // namespace WebCore | 415 } // namespace WebCore |
| 416 | 416 |
| OLD | NEW |