[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

kbalazs at webkit.org kbalazs at webkit.org
Wed Dec 22 16:38:28 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 86bc4a71d0c702dbfd000536da5606eb1f401f49
Author: kbalazs at webkit.org <kbalazs at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 29 19:44:44 2010 +0000

    2010-11-29  Balazs Kelemen  <kbalazs at webkit.org>
    
            Reviewed by Adam Roben.
    
            [WK2] Support repeating timers
            https://bugs.webkit.org/show_bug.cgi?id=50024
    
            Added boolean member for TimerBase on PLATFORM(WIN)
            and PLATFORM(QT) to be able to differentiate between
            repeating and one shot operating mode. Change the confusing
            signature of TimerBase::start: use a bool for selecting
            operating mode.
            * Platform/RunLoop.h:
            (RunLoop::TimerBase::startRepeating):
            (RunLoop::TimerBase::startOneShot):
            * Platform/mac/RunLoopMac.mm:
            (RunLoop::TimerBase::start):
            * Platform/qt/RunLoopQt.cpp:
            (RunLoop::TimerBase::timerFired): Only stop the timer if it
            is not in repeating mode.
            (RunLoop::TimerBase::TimerBase):
            (RunLoop::TimerBase::start):
            * Platform/win/RunLoopWin.cpp:
            (RunLoop::TimerBase::timerFired):  Only stop the timer if it
            is not in repeating mode.
            (RunLoop::TimerBase::TimerBase):
            (RunLoop::TimerBase::start):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72816 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 27819a0..d274f74 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,31 @@
+2010-11-29  Balazs Kelemen  <kbalazs at webkit.org>
+
+        Reviewed by Adam Roben.
+
+        [WK2] Support repeating timers
+        https://bugs.webkit.org/show_bug.cgi?id=50024
+
+        Added boolean member for TimerBase on PLATFORM(WIN)
+        and PLATFORM(QT) to be able to differentiate between
+        repeating and one shot operating mode. Change the confusing
+        signature of TimerBase::start: use a bool for selecting
+        operating mode.
+        * Platform/RunLoop.h:
+        (RunLoop::TimerBase::startRepeating):
+        (RunLoop::TimerBase::startOneShot):
+        * Platform/mac/RunLoopMac.mm:
+        (RunLoop::TimerBase::start):
+        * Platform/qt/RunLoopQt.cpp:
+        (RunLoop::TimerBase::timerFired): Only stop the timer if it
+        is not in repeating mode.
+        (RunLoop::TimerBase::TimerBase): 
+        (RunLoop::TimerBase::start):
+        * Platform/win/RunLoopWin.cpp:
+        (RunLoop::TimerBase::timerFired):  Only stop the timer if it
+        is not in repeating mode.
+        (RunLoop::TimerBase::TimerBase):
+        (RunLoop::TimerBase::start):
+
 2010-11-29  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/Platform/RunLoop.h b/WebKit2/Platform/RunLoop.h
index 5d96983..bf77763 100644
--- a/WebKit2/Platform/RunLoop.h
+++ b/WebKit2/Platform/RunLoop.h
@@ -54,8 +54,8 @@ public:
         TimerBase(RunLoop*);
         virtual ~TimerBase();
 
-        void startRepeating(double repeatInterval) { start(repeatInterval, repeatInterval); }
-        void startOneShot(double interval) { start(interval, 0); }
+        void startRepeating(double repeatInterval) { start(repeatInterval, true); }
+        void startOneShot(double interval) { start(interval, false); }
 
         void stop();
         bool isActive() const;
@@ -63,19 +63,21 @@ public:
         virtual void fired() = 0;
 
     private:
-        void start(double nextFireInterval, double repeatInterval);
+        void start(double nextFireInterval, bool repeat);
 
         RunLoop* m_runLoop;
 
 #if PLATFORM(WIN)
         static void timerFired(RunLoop*, uint64_t ID);
         uint64_t m_ID;
+        bool m_isRepeating;
 #elif PLATFORM(MAC)
         static void timerFired(CFRunLoopTimerRef, void*);
         CFRunLoopTimerRef m_timer;
 #elif PLATFORM(QT)
         static void timerFired(RunLoop*, int ID);
         int m_ID;
+        bool m_isRepeating;
 #endif
     };
 
diff --git a/WebKit2/Platform/mac/RunLoopMac.mm b/WebKit2/Platform/mac/RunLoopMac.mm
index 60387c4..ca044f3 100644
--- a/WebKit2/Platform/mac/RunLoopMac.mm
+++ b/WebKit2/Platform/mac/RunLoopMac.mm
@@ -104,12 +104,13 @@ RunLoop::TimerBase::~TimerBase()
     stop();
 }
 
-void RunLoop::TimerBase::start(double nextFireInterval, double repeatInterval)
+void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
 {
     if (m_timer)
         stop();
 
     CFRunLoopTimerContext context = { 0, this, 0, 0, 0 };
+    CFTimeInterval repeatInterval = repeat ? nextFireInterval : 0;
     m_timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + nextFireInterval, repeatInterval, 0, 0, timerFired, &context);
     CFRunLoopAddTimer(m_runLoop->m_runLoop, m_timer, kCFRunLoopCommonModes);
 }
diff --git a/WebKit2/Platform/qt/RunLoopQt.cpp b/WebKit2/Platform/qt/RunLoopQt.cpp
index 495398d..d7d859d 100644
--- a/WebKit2/Platform/qt/RunLoopQt.cpp
+++ b/WebKit2/Platform/qt/RunLoopQt.cpp
@@ -92,14 +92,20 @@ void RunLoop::TimerBase::timerFired(RunLoop* runLoop, int ID)
     ASSERT(it != runLoop->m_activeTimers.end());
     TimerBase* timer = it->second;
 
-    // FIMXE: Support repeating timers.
-    timer->stop();
+    if (!timer->m_isRepeating) {
+        // Stop the timer (calling stop would need another hash table lookup).
+        runLoop->m_activeTimers.remove(it);
+        runLoop->m_timerObject->killTimer(timer->m_ID);
+        timer->m_ID = 0;
+    }
+
     timer->fired();
 }
 
 RunLoop::TimerBase::TimerBase(RunLoop* runLoop)
     : m_runLoop(runLoop)
     , m_ID(0)
+    , m_isRepeating(false)
 {
 }
 
@@ -108,11 +114,11 @@ RunLoop::TimerBase::~TimerBase()
     stop();
 }
 
-void RunLoop::TimerBase::start(double nextFireInterval, double /*repeatInterval*/)
+void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
 {
-    // FIMXE: Support repeating timers.
     stop();
     int millis = static_cast<int>(nextFireInterval * 1000);
+    m_isRepeating = repeat;
     m_ID = m_runLoop->m_timerObject->startTimer(millis);
     ASSERT(m_ID);
     m_runLoop->m_activeTimers.set(m_ID, this);
diff --git a/WebKit2/Platform/win/RunLoopWin.cpp b/WebKit2/Platform/win/RunLoopWin.cpp
index dba9535..4dfb4b5 100644
--- a/WebKit2/Platform/win/RunLoopWin.cpp
+++ b/WebKit2/Platform/win/RunLoopWin.cpp
@@ -121,10 +121,10 @@ void RunLoop::TimerBase::timerFired(RunLoop* runLoop, uint64_t ID)
     ASSERT(it != runLoop->m_activeTimers.end());
     TimerBase* timer = it->second;
 
-    // FIMXE: Support repeating timers.
-
-    runLoop->m_activeTimers.remove(it);
-    ::KillTimer(runLoop->m_runLoopMessageWindow, ID);
+    if (!timer->m_isRepeating) {
+        runLoop->m_activeTimers.remove(it);
+        ::KillTimer(runLoop->m_runLoopMessageWindow, ID);
+    }
 
     timer->fired();
 }
@@ -138,6 +138,7 @@ static uint64_t generateTimerID()
 RunLoop::TimerBase::TimerBase(RunLoop* runLoop)
     : m_runLoop(runLoop)
     , m_ID(generateTimerID())
+    , m_isRepeating(false)
 {
 }
 
@@ -146,11 +147,9 @@ RunLoop::TimerBase::~TimerBase()
     stop();
 }
 
-void RunLoop::TimerBase::start(double nextFireInterval, double repeatInterval)
+void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
 {
-    // FIXME: Support repeating timers.
-    ASSERT_ARG(repeatInterval, !repeatInterval);
-
+    m_isRepeating = repeat;
     m_runLoop->m_activeTimers.set(m_ID, this);
     ::SetTimer(m_runLoop->m_runLoopMessageWindow, m_ID, nextFireInterval, 0);
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list