diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-05 14:34:32 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-05 14:34:32 -0800 |
commit | 635860845790a19bf50bbc51ba8fb66a96dde068 (patch) | |
tree | ef6ad9ff73a5b57f65249d4232a202fa77e6a140 /WebCore/platform/win/SharedTimerWin.cpp | |
parent | 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (diff) | |
download | external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.zip external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.gz external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.bz2 |
auto import from //depot/cupcake/@136594
Diffstat (limited to 'WebCore/platform/win/SharedTimerWin.cpp')
-rw-r--r-- | WebCore/platform/win/SharedTimerWin.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/WebCore/platform/win/SharedTimerWin.cpp b/WebCore/platform/win/SharedTimerWin.cpp index b611659..da27a53 100644 --- a/WebCore/platform/win/SharedTimerWin.cpp +++ b/WebCore/platform/win/SharedTimerWin.cpp @@ -27,9 +27,9 @@ #include "SharedTimer.h" #include "Page.h" -#include "SystemTime.h" #include "Widget.h" #include <wtf/Assertions.h> +#include <wtf/CurrentTime.h> // Note: wx headers set defines that affect the configuration of windows.h // so we must include the wx header first to get unicode versions of functions, @@ -41,6 +41,10 @@ #include <windows.h> #include <mmsystem.h> +#if PLATFORM(WIN) +#include "PluginView.h" +#endif + // These aren't in winuser.h with the MSVS 2003 Platform SDK, // so use default values in that case. #ifndef USER_TIMER_MINIMUM @@ -55,10 +59,6 @@ #define QS_RAWINPUT 0x0400 #endif -#if PLATFORM(WIN) -#include "PluginView.h" -#endif - namespace WebCore { static UINT timerID; @@ -68,7 +68,6 @@ static HWND timerWindowHandle = 0; static UINT timerFiredMessage = 0; static HANDLE timerQueue; static HANDLE timer; -static Mutex timerMutex; static bool highResTimerActive; static bool processingCustomTimerMessage = false; static LONG pendingTimers; @@ -139,17 +138,8 @@ void setSharedTimerFiredFunction(void (*f)()) sharedTimerFiredFunction = f; } -static void clearTimer() -{ - MutexLocker locker(timerMutex); - if (timerQueue && timer) - DeleteTimerQueueTimer(timerQueue, timer, 0); - timer = 0; -} - static void NTAPI queueTimerProc(PVOID, BOOLEAN) { - clearTimer(); if (InterlockedIncrement(&pendingTimers) == 1) PostMessage(timerWindowHandle, timerFiredMessage, 0, 0); } @@ -196,11 +186,9 @@ void setSharedTimerFireTime(double fireTime) // Otherwise, delay the PostMessage via a CreateTimerQueueTimer if (!timerQueue) timerQueue = CreateTimerQueue(); - MutexLocker locker(timerMutex); if (timer) - timerSet = ChangeTimerQueueTimer(timerQueue, timer, intervalInMS, 0); - else - timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE); + DeleteTimerQueueTimer(timerQueue, timer, 0); + timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE); } } @@ -209,13 +197,19 @@ void setSharedTimerFireTime(double fireTime) KillTimer(timerWindowHandle, timerID); timerID = 0; } - } else + } else { timerID = SetTimer(timerWindowHandle, sharedTimerID, intervalInMS, 0); + timer = 0; + } } void stopSharedTimer() { - clearTimer(); + if (timerQueue && timer) { + DeleteTimerQueueTimer(timerQueue, timer, 0); + timer = 0; + } + if (timerID) { KillTimer(timerWindowHandle, timerID); timerID = 0; |