Make every port implement MainThreadSharedTimer instead of using global functions
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Oct 2015 13:25:26 +0000 (13:25 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Oct 2015 13:25:26 +0000 (13:25 +0000)
commit3fbfc21624a544d092eb6ec934ef2f2731782018
treed35b1b34c778e7cf06f2555d9de6369349579b5a
parentf4229260726a92e52a5a03beba6c0f2a73626a13
Make every port implement MainThreadSharedTimer instead of using global functions
https://bugs.webkit.org/show_bug.cgi?id=150498

Reviewed by Darin Adler.

Move MainThreadSharedTimer to its own files and add the common
implementation there.

* CMakeLists.txt: Add MainThreadSharedTimer.cpp.
* PlatformEfl.cmake: Update filenames.
* PlatformGTK.cmake: Ditto.
* PlatformMac.cmake: Ditto.
* PlatformWin.cmake: Ditto.
* platform/MainThreadSharedTimer.cpp: Copied from Source/WebCore/platform/efl/SharedTimerEfl.cpp.
(WebCore::MainThreadSharedTimer::singleton):
(WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
(WebCore::MainThreadSharedTimer::setFiredFunction):
(WebCore::MainThreadSharedTimer::fired):
* platform/MainThreadSharedTimer.h: Copied from Source/WebCore/platform/gtk/SharedTimerGtk.cpp.
* platform/SharedTimer.h: Remove MainThreadSharedTimer
implementation and reindent the code.
(WebCore::SharedTimer::SharedTimer):
(WebCore::SharedTimer::~SharedTimer):
(WebCore::SharedTimer::invalidate):
* platform/ThreadTimers.cpp:
(WebCore::ThreadTimers::ThreadTimers): Use MainThreadSharedTimer::singleton().
(WebCore::ThreadTimers::setSharedTimer): Use a lambda function
instead of a pointer to a static method.
(WebCore::ThreadTimers::sharedTimerFired): Deleted.
* platform/ThreadTimers.h: Removed unsused static method sharedTimerFired.
* platform/cf/MainThreadSharedTimerCF.cpp: Renamed from Source/WebCore/platform/cf/SharedTimerCF.cpp.
(WebCore::applicationDidBecomeActive):
(WebCore::setupPowerObserver):
(WebCore::timerFired):
(WebCore::restartSharedTimer):
(WebCore::MainThreadSharedTimer::invalidate):
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::stop):
* platform/efl/MainThreadSharedTimerEfl.cpp: Renamed from Source/WebCore/platform/efl/SharedTimerEfl.cpp.
(WebCore::timerEvent):
(WebCore::MainThreadSharedTimer::stop):
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::invalidate):
* platform/gtk/MainThreadSharedTimerGtk.cpp: Renamed from Source/WebCore/platform/gtk/SharedTimerGtk.cpp.
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::stop):
(WebCore::MainThreadSharedTimer::invalidate):
* platform/win/MainThreadSharedTimerWin.cpp: Renamed from Source/WebCore/platform/win/SharedTimerWin.cpp.
(WebCore::TimerWindowWndProc):
(WebCore::initializeOffScreenTimerWindow):
(WebCore::queueTimerProc):
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::stop):
(WebCore::MainThreadSharedTimer::invalidate):
* workers/WorkerRunLoop.cpp: Update WorkerSharedTimer
implementation to use std::function instead of a pointer. Also
mark the class as final and the virtual implementations as override.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebCore/PlatformMac.cmake
Source/WebCore/PlatformWin.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/MainThreadSharedTimer.cpp [new file with mode: 0644]
Source/WebCore/platform/MainThreadSharedTimer.h [new file with mode: 0644]
Source/WebCore/platform/SharedTimer.h
Source/WebCore/platform/ThreadTimers.cpp
Source/WebCore/platform/ThreadTimers.h
Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp [moved from Source/WebCore/platform/cf/SharedTimerCF.cpp with 89% similarity]
Source/WebCore/platform/efl/MainThreadSharedTimerEfl.cpp [moved from Source/WebCore/platform/efl/SharedTimerEfl.cpp with 74% similarity]
Source/WebCore/platform/gtk/MainThreadSharedTimerGtk.cpp [moved from Source/WebCore/platform/gtk/SharedTimerGtk.cpp with 82% similarity]
Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp [moved from Source/WebCore/platform/win/SharedTimerWin.cpp with 93% similarity]
Source/WebCore/workers/WorkerRunLoop.cpp