Skip to content

Commit

Permalink
Remove DeprecatedGlobalSettings::shouldUseHighResolutionTimers()
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265748

Reviewed by Don Olmstead.

This appears to be unused.

* Source/WebCore/page/DeprecatedGlobalSettings.cpp:
(WebCore::DeprecatedGlobalSettings::setShouldUseHighResolutionTimers): Deleted.
* Source/WebCore/page/DeprecatedGlobalSettings.h:
(WebCore::DeprecatedGlobalSettings::shouldUseHighResolutionTimers): Deleted.
* Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):

Canonical link: https://commits.webkit.org/271439@main
  • Loading branch information
annevk committed Dec 3, 2023
1 parent b4b36d9 commit 481ac16
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 42 deletions.
7 changes: 0 additions & 7 deletions Source/WebCore/page/DeprecatedGlobalSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ void DeprecatedGlobalSettings::setMediaSourceInlinePaintingEnabled(bool isEnable
}
#endif

#if PLATFORM(WIN)
void DeprecatedGlobalSettings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
{
shared().m_shouldUseHighResolutionTimers = shouldUseHighResolutionTimers;
}
#endif

#if USE(AVFOUNDATION)
void DeprecatedGlobalSettings::setAVFoundationEnabled(bool enabled)
{
Expand Down
8 changes: 0 additions & 8 deletions Source/WebCore/page/DeprecatedGlobalSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ namespace WebCore {

class DeprecatedGlobalSettings {
public:
#if PLATFORM(WIN)
WEBCORE_EXPORT static void setShouldUseHighResolutionTimers(bool);
static bool shouldUseHighResolutionTimers() { return shared().m_shouldUseHighResolutionTimers; }
#endif

#if USE(AVFOUNDATION)
WEBCORE_EXPORT static void setAVFoundationEnabled(bool);
static bool isAVFoundationEnabled() { return shared().m_AVFoundationEnabled; }
Expand Down Expand Up @@ -184,9 +179,6 @@ class DeprecatedGlobalSettings {
bool m_mockScrollbarsEnabled { false };
bool m_usesOverlayScrollbars { false };

#if PLATFORM(WIN)
bool m_shouldUseHighResolutionTimers { true };
#endif
#if PLATFORM(IOS_FAMILY)
bool m_networkDataUsageTrackingEnabled { false };
String m_networkInterfaceName;
Expand Down
52 changes: 25 additions & 27 deletions Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,35 +133,33 @@ void MainThreadSharedTimer::setFireInterval(Seconds intervalInSeconds)
initializeOffScreenTimerWindow();
bool timerSet = false;

if (DeprecatedGlobalSettings::shouldUseHighResolutionTimers()) {
if (interval < highResolutionThresholdMsec) {
if (!highResTimerActive) {
highResTimerActive = true;
timeBeginPeriod(timerResolution);
}
SetTimer(timerWindowHandle, endHighResTimerID, stopHighResTimerInMsec, 0);
if (interval < highResolutionThresholdMsec) {
if (!highResTimerActive) {
highResTimerActive = true;
timeBeginPeriod(timerResolution);
}
SetTimer(timerWindowHandle, endHighResTimerID, stopHighResTimerInMsec, 0);
}

DWORD queueStatus = LOWORD(GetQueueStatus(QS_PAINT | QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT));

// Win32 has a tri-level queue with application messages > user input > WM_PAINT/WM_TIMER.

// If the queue doesn't contains input events, we use a higher priorty timer event posting mechanism.
if (!(queueStatus & (QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT))) {
if (intervalInMS < USER_TIMER_MINIMUM && !processingCustomTimerMessage && !(queueStatus & QS_PAINT)) {
// Call PostMessage immediately if the timer is already expired, unless a paint is pending.
// (we prioritize paints over timers)
if (InterlockedIncrement(&pendingTimers) == 1)
PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
timerSet = true;
} else {
// Otherwise, delay the PostMessage via a CreateTimerQueueTimer
if (!timerQueue)
timerQueue = CreateTimerQueue();
if (timer)
DeleteTimerQueueTimer(timerQueue, timer, 0);
timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE);
}
DWORD queueStatus = LOWORD(GetQueueStatus(QS_PAINT | QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT));

// Win32 has a tri-level queue with application messages > user input > WM_PAINT/WM_TIMER.

// If the queue doesn't contains input events, we use a higher priorty timer event posting mechanism.
if (!(queueStatus & (QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT))) {
if (intervalInMS < USER_TIMER_MINIMUM && !processingCustomTimerMessage && !(queueStatus & QS_PAINT)) {
// Call PostMessage immediately if the timer is already expired, unless a paint is pending.
// (we prioritize paints over timers)
if (InterlockedIncrement(&pendingTimers) == 1)
PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
timerSet = true;
} else {
// Otherwise, delay the PostMessage via a CreateTimerQueueTimer
if (!timerQueue)
timerQueue = CreateTimerQueue();
if (timer)
DeleteTimerQueueTimer(timerQueue, timer, 0);
timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE);
}
}

Expand Down

0 comments on commit 481ac16

Please sign in to comment.