Changeset 142454 in webkit


Ignore:
Timestamp:
Feb 11, 2013 4:44:34 AM (11 years ago)
Author:
Christophe Dumez
Message:

[EFL] Stop using smart pointers for Ecore_Timer
https://bugs.webkit.org/show_bug.cgi?id=109409

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Stop using a smart pointer for Ecore_Timer in RunLoop::TimerBase. This
is a bad idea because the timer handle becomes invalid as soon as the
timer callback returns ECORE_CALLBACK_CANCEL. This may lead to crashes
on destruction because OwnPtr calls ecore_timer_del() on an invalid
handle.

No new tests, already covered by exiting tests.

  • platform/RunLoop.h:

(TimerBase):

  • platform/efl/RunLoopEfl.cpp:

(WebCore::RunLoop::TimerBase::timerFired):
(WebCore::RunLoop::TimerBase::start):
(WebCore::RunLoop::TimerBase::stop):

Source/WTF:

Remove support in OwnPtr for EFL's Ecore_Timer. It is a bad idea to use
OwnPtr for Ecore_Timer because the timer handle may become invalid.

  • wtf/OwnPtrCommon.h:

(WTF):

  • wtf/efl/OwnPtrEfl.cpp:
Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r142434 r142454  
     12013-02-11  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        [EFL] Stop using smart pointers for Ecore_Timer
     4        https://bugs.webkit.org/show_bug.cgi?id=109409
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Remove support in OwnPtr for EFL's Ecore_Timer. It is a bad idea to use
     9        OwnPtr for Ecore_Timer because the timer handle may become invalid.
     10
     11        * wtf/OwnPtrCommon.h:
     12        (WTF):
     13        * wtf/efl/OwnPtrEfl.cpp:
     14
    1152013-02-11  Abhishek Arya  <inferno@chromium.org>
    216
  • trunk/Source/WTF/wtf/OwnPtrCommon.h

    r138326 r142454  
    4646typedef struct _Eina_Module Eina_Module;
    4747#if USE(EO)
    48 typedef struct _Eo Ecore_Timer;
    4948typedef struct _Eo Evas_Object;
    5049#else
    51 typedef struct _Ecore_Timer Ecore_Timer;
    5250typedef struct _Evas_Object Evas_Object;
    5351#endif
     
    8078    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_IMF_Context*);
    8179    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Pipe*);
    82     WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Timer*);
    8380    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Eina_Hash*);
    8481    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Eina_Module*);
  • trunk/Source/WTF/wtf/efl/OwnPtrEfl.cpp

    r133041 r142454  
    6464}
    6565
    66 void deleteOwnedPtr(Ecore_Timer* ptr)
    67 {
    68     if (ptr)
    69         ecore_timer_del(ptr);
    70 }
    71 
    7266void deleteOwnedPtr(Ecore_IMF_Context* ptr)
    7367{
  • trunk/Source/WebCore/ChangeLog

    r142452 r142454  
     12013-02-11  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        [EFL] Stop using smart pointers for Ecore_Timer
     4        https://bugs.webkit.org/show_bug.cgi?id=109409
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Stop using a smart pointer for Ecore_Timer in RunLoop::TimerBase. This
     9        is a bad idea because the timer handle becomes invalid as soon as the
     10        timer callback returns ECORE_CALLBACK_CANCEL. This may lead to crashes
     11        on destruction because OwnPtr calls ecore_timer_del() on an invalid
     12        handle.
     13
     14        No new tests, already covered by exiting tests.
     15
     16        * platform/RunLoop.h:
     17        (TimerBase):
     18        * platform/efl/RunLoopEfl.cpp:
     19        (WebCore::RunLoop::TimerBase::timerFired):
     20        (WebCore::RunLoop::TimerBase::start):
     21        (WebCore::RunLoop::TimerBase::stop):
     22
    1232013-02-11  Vladislav Kaznacheev  <kaznacheev@chromium.org>
    224
  • trunk/Source/WebCore/platform/RunLoop.h

    r139985 r142454  
    106106#elif PLATFORM(EFL)
    107107        static bool timerFired(void* data);
    108         OwnPtr<Ecore_Timer> m_timer;
     108        Ecore_Timer* m_timer;
    109109        bool m_isRepeating;
    110110#endif
  • trunk/Source/WebCore/platform/efl/RunLoopEfl.cpp

    r142087 r142454  
    8787
    8888RunLoop::TimerBase::TimerBase(RunLoop*)
    89     : m_isRepeating(false)
     89    : m_timer(0)
     90    , m_isRepeating(false)
    9091{
    9192}
     
    103104
    104105    if (!timer->m_isRepeating) {
    105         timer->m_timer = nullptr;
     106        timer->m_timer = 0;
    106107        return ECORE_CALLBACK_CANCEL;
    107108    }
     
    112113void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
    113114{
     115    if (isActive())
     116        stop();
     117
    114118    m_isRepeating = repeat;
    115     m_timer = adoptPtr(ecore_timer_add(nextFireInterval, reinterpret_cast<Ecore_Task_Cb>(timerFired), this));
     119    ASSERT(!m_timer);
     120    m_timer = ecore_timer_add(nextFireInterval, reinterpret_cast<Ecore_Task_Cb>(timerFired), this);
    116121}
    117122
    118123void RunLoop::TimerBase::stop()
    119124{
    120     m_timer = nullptr;
     125    if (m_timer) {
     126        ecore_timer_del(m_timer);
     127        m_timer = 0;
     128    }
    121129}
    122130
Note: See TracChangeset for help on using the changeset viewer.