Changeset 243022 in webkit
- Timestamp:
- Mar 15, 2019, 4:12:12 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243019 r243022 1 2019-03-15 Ryosuke Niwa <rniwa@webkit.org> 2 3 REGRESSION (r239814): Most classes that user Timer have 7 bytes of padding after the Timer 4 https://bugs.webkit.org/show_bug.cgi?id=194196 5 6 Reviewed by Simon Fraser. 7 8 Use std::nan as the value of m_unalignedNextFireTime to indicate the timer had been deleted 9 instead of having a dedicated boolean, which consumes 7 extra bytes for padding. 10 11 Note that some code in WebKit uses +Infinity as a fire time so we can't use that. 12 13 * platform/Timer.cpp: 14 (WebCore::TimerBase::TimerBase): 15 (WebCore::TimerBase::~TimerBase): 16 (WebCore::TimerBase::setNextFireTime): 17 (WebCore::TimerBase::nextUnalignedFireInterval const): 18 * platform/Timer.h: 19 1 20 2019-03-15 Sihui Liu <sihui_liu@apple.com> 2 21 -
trunk/Source/WebCore/platform/Timer.cpp
r241113 r243022 255 255 256 256 TimerBase::TimerBase() 257 : m_wasDeleted(false)258 257 { 259 258 } … … 265 264 stop(); 266 265 ASSERT(!inHeap()); 267 if (m_heapItem) {266 if (m_heapItem) 268 267 m_heapItem->clearTimer(); 269 m_heapItem = nullptr; 270 } 271 m_wasDeleted = true; 268 m_unalignedNextFireTime = MonotonicTime::nan(); 272 269 } 273 270 … … 468 465 ASSERT(canAccessThreadLocalDataForThread(m_thread.get())); 469 466 RELEASE_ASSERT(canAccessThreadLocalDataForThread(m_thread.get()) || shouldSuppressThreadSafetyCheck()); 470 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_wasDeleted); 471 472 if (m_unalignedNextFireTime != newTime) 467 bool timerHasBeenDeleted = std::isnan(m_unalignedNextFireTime); 468 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!timerHasBeenDeleted); 469 470 if (m_unalignedNextFireTime != newTime) { 471 RELEASE_ASSERT(!std::isnan(newTime)); 473 472 m_unalignedNextFireTime = newTime; 473 } 474 474 475 475 // Keep heap valid while changing the next-fire time. … … 518 518 { 519 519 ASSERT(isActive()); 520 return std::max(m_unalignedNextFireTime - MonotonicTime::now(), 0_s); 520 auto result = std::max(m_unalignedNextFireTime - MonotonicTime::now(), 0_s); 521 RELEASE_ASSERT(std::isfinite(result)); 522 return result; 521 523 } 522 524 -
trunk/Source/WebCore/platform/Timer.h
r241113 r243022 97 97 MonotonicTime m_unalignedNextFireTime; // m_nextFireTime not considering alignment interval 98 98 Seconds m_repeatInterval; // 0 if not repeating 99 bool m_wasDeleted { false };100 99 101 100 RefPtr<ThreadTimerHeapItem> m_heapItem;
Note:
See TracChangeset
for help on using the changeset viewer.