Changeset 141248 in webkit


Ignore:
Timestamp:
Jan 30, 2013 3:58:08 AM (11 years ago)
Author:
Patrick Gansterer
Message:

Port SharedTimerWin.cpp to WinCE
https://bugs.webkit.org/show_bug.cgi?id=103724

Reviewed by Brent Fulgham.

Add #if !OS(WINCE) around some parts of the code, so it can be used by the WinCE port too.

  • PlatformWinCE.cmake:
  • platform/win/SharedTimerWin.cpp:

(WebCore):
(WebCore::TimerWindowWndProc):
(WebCore::initializeOffScreenTimerWindow):
(WebCore::setSharedTimerFireInterval):
(WebCore::stopSharedTimer):

  • platform/wince/SharedTimerWinCE.cpp: Removed.
Location:
trunk/Source/WebCore
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141245 r141248  
     12013-01-30  Patrick Gansterer  <paroga@webkit.org>
     2
     3        Port SharedTimerWin.cpp to WinCE
     4        https://bugs.webkit.org/show_bug.cgi?id=103724
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Add #if !OS(WINCE) around some parts of the code, so it can be used by the WinCE port too.
     9
     10        * PlatformWinCE.cmake:
     11        * platform/win/SharedTimerWin.cpp:
     12        (WebCore):
     13        (WebCore::TimerWindowWndProc):
     14        (WebCore::initializeOffScreenTimerWindow):
     15        (WebCore::setSharedTimerFireInterval):
     16        (WebCore::stopSharedTimer):
     17        * platform/wince/SharedTimerWinCE.cpp: Removed.
     18
    1192013-01-30  Andrey Lushnikov  <lushnikov@chromium.org>
    220
  • trunk/Source/WebCore/PlatformWinCE.cmake

    r136790 r141248  
    5454    platform/win/SearchPopupMenuWin.cpp
    5555    platform/win/SharedBufferWin.cpp
     56    platform/win/SharedTimerWin.cpp
    5657    platform/win/SoundWin.cpp
    5758    platform/win/SystemInfo.cpp
     
    6566    platform/wince/FileSystemWince.cpp
    6667    platform/wince/KURLWince.cpp
    67     platform/wince/SharedTimerWince.cpp
    6868
    6969    platform/network/win/CredentialStorageWin.cpp
  • trunk/Source/WebCore/platform/win/SharedTimerWin.cpp

    r91206 r141248  
    4141#endif
    4242
    43 #include <windows.h>
     43#include "WindowsExtras.h"
    4444#include <mmsystem.h>
    4545
     
    6767static void (*sharedTimerFiredFunction)();
    6868
     69static HANDLE timer;
    6970static HWND timerWindowHandle = 0;
     71const LPCWSTR kTimerWindowClassName = L"TimerWindowClass";
     72
     73#if !OS(WINCE)
    7074static UINT timerFiredMessage = 0;
    7175static HANDLE timerQueue;
    72 static HANDLE timer;
    7376static bool highResTimerActive;
    7477static bool processingCustomTimerMessage = false;
    7578static LONG pendingTimers;
    7679
    77 const LPCWSTR kTimerWindowClassName = L"TimerWindowClass";
    7880const int timerResolution = 1; // To improve timer resolution, we call timeBeginPeriod/timeEndPeriod with this value to increase timer resolution to 1ms.
    7981const int highResolutionThresholdMsec = 16; // Only activate high-res timer for sub-16ms timers (Windows can fire timers at 16ms intervals without changing the system resolution).
    8082const int stopHighResTimerInMsec = 300; // Stop high-res timer after 0.3 seconds to lessen power consumption (we don't use a smaller time since oscillating between high and low resolution breaks timer accuracy on XP).
     83#endif
    8184
    8285enum {
     
    98101#endif
    99102
    100     if (message == timerFiredMessage) {
     103    if (message == WM_TIMER) {
     104        if (wParam == sharedTimerID) {
     105            KillTimer(timerWindowHandle, sharedTimerID);
     106            sharedTimerFiredFunction();
     107        }
     108#if !OS(WINCE)
     109        else if (wParam == endHighResTimerID) {
     110            KillTimer(timerWindowHandle, endHighResTimerID);
     111            highResTimerActive = false;
     112            timeEndPeriod(timerResolution);
     113        }
     114    } else if (message == timerFiredMessage) {
    101115        InterlockedExchange(&pendingTimers, 0);
    102116        processingCustomTimerMessage = true;
    103117        sharedTimerFiredFunction();
    104118        processingCustomTimerMessage = false;
    105     } else if (message == WM_TIMER) {
    106         if (wParam == sharedTimerID) {
    107             KillTimer(timerWindowHandle, sharedTimerID);
    108             sharedTimerFiredFunction();
    109         } else if (wParam == endHighResTimerID) {
    110             KillTimer(timerWindowHandle, endHighResTimerID);
    111             highResTimerActive = false;
    112             timeEndPeriod(timerResolution);
    113         }
     119#endif
    114120    } else
    115121        return DefWindowProc(hWnd, message, wParam, lParam);
     
    122128    if (timerWindowHandle)
    123129        return;
    124    
     130
     131#if OS(WINCE)
     132    WNDCLASS wcex;
     133    memset(&wcex, 0, sizeof(WNDCLASS));
     134#else
    125135    WNDCLASSEX wcex;
    126136    memset(&wcex, 0, sizeof(WNDCLASSEX));
    127137    wcex.cbSize = sizeof(WNDCLASSEX);
     138#endif
     139
    128140    wcex.lpfnWndProc    = TimerWindowWndProc;
    129141    wcex.hInstance      = WebCore::instanceHandle();
    130142    wcex.lpszClassName  = kTimerWindowClassName;
     143#if OS(WINCE)
     144    RegisterClass(&wcex);
     145#else
    131146    RegisterClassEx(&wcex);
     147#endif
    132148
    133149    timerWindowHandle = CreateWindow(kTimerWindowClassName, 0, 0,
    134150       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_MESSAGE, 0, WebCore::instanceHandle(), 0);
     151
     152#if !OS(WINCE)
    135153    timerFiredMessage = RegisterWindowMessage(L"com.apple.WebKit.TimerFired");
     154#endif
    136155}
    137156
     
    141160}
    142161
     162#if !OS(WINCE)
    143163static void NTAPI queueTimerProc(PVOID, BOOLEAN)
    144164{
     
    146166        PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
    147167}
     168#endif
    148169
    149170void setSharedTimerFireInterval(double interval)
     
    161182    bool timerSet = false;
    162183
     184#if !OS(WINCE)
    163185    if (Settings::shouldUseHighResolutionTimers()) {
    164186        if (interval < highResolutionThresholdMsec) {
     
    192214        }
    193215    }
     216#endif // !OS(WINCE)
    194217
    195218    if (timerSet) {
     
    206229void stopSharedTimer()
    207230{
     231#if !OS(WINCE)
    208232    if (timerQueue && timer) {
    209233        DeleteTimerQueueTimer(timerQueue, timer, 0);
    210234        timer = 0;
    211235    }
     236#endif
    212237
    213238    if (timerID) {
Note: See TracChangeset for help on using the changeset viewer.