Changeset 227934 in webkit


Ignore:
Timestamp:
Jan 31, 2018 3:08:44 PM (6 years ago)
Author:
rniwa@webkit.org
Message:

Add a release assertion to ensure timers are deleted in the right thread
https://bugs.webkit.org/show_bug.cgi?id=182351

Reviewed by David Kilzer.

Added a relese assertion in ~TimerBase that the current thread is the one in which the timer was created.

We use canAccessThreadLocalDataForThread for this purpose since the condition is more complicated
when WebThread is being used.

  • platform/Timer.cpp:

(WebCore::TimerBase::~TimerBase): Added the assertion.

  • platform/Timer.h:

(WebCore::TimerBase::m_thread): Always store the current thread in a timer.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r227932 r227934  
     12018-01-31  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Add a release assertion to ensure timers are deleted in the right thread
     4        https://bugs.webkit.org/show_bug.cgi?id=182351
     5
     6        Reviewed by David Kilzer.
     7
     8        Added a relese assertion in ~TimerBase that the current thread is the one in which the timer was created.
     9
     10        We use canAccessThreadLocalDataForThread for this purpose since the condition is more complicated
     11        when WebThread is being used.
     12
     13        * platform/Timer.cpp:
     14        (WebCore::TimerBase::~TimerBase): Added the assertion.
     15        * platform/Timer.h:
     16        (WebCore::TimerBase::m_thread): Always store the current thread in a timer.
     17
    1182018-01-31  Youenn Fablet  <youenn@apple.com>
    219
  • trunk/Source/WebCore/platform/Timer.cpp

    r225985 r227934  
    192192TimerBase::~TimerBase()
    193193{
     194    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(canAccessThreadLocalDataForThread(m_thread.get()));
    194195    stop();
    195196    ASSERT(!inHeap());
  • trunk/Source/WebCore/platform/Timer.h

    r225985 r227934  
    104104    Vector<TimerBase*>* m_cachedThreadGlobalTimerHeap { nullptr };
    105105
    106 #ifndef NDEBUG
    107106    Ref<Thread> m_thread { Thread::current() };
    108 #endif
    109107
    110108    friend class ThreadTimers;
Note: See TracChangeset for help on using the changeset viewer.