https://bugs.webkit.org/show_bug.cgi?id=135132
<rdar://problem/
17719832>
Reviewed by Simon Fraser.
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::ProcessThrottler):
(WebKit::ProcessThrottler::suspendTimerFired):
* UIProcess/ProcessThrottler.h:
* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::ViewGestureController):
(WebKit::ViewGestureController::swipeSnapshotWatchdogTimerFired):
* UIProcess/mac/ViewGestureController.h:
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::ViewGestureController):
(WebKit::ViewGestureController::swipeSnapshotWatchdogTimerFired):
We can't use WebCore timers in the UI process because of coexistence concerns
(they fire on the Web Thread if there is one!), so use RunLoop::Timer instead.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171317
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-07-21 Timothy Horton <timothy_horton@apple.com>
+
+ Random crashes on the Web Thread due to Timers firing on the wrong thread in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=135132
+ <rdar://problem/17719832>
+
+ Reviewed by Simon Fraser.
+
+ * UIProcess/ProcessThrottler.cpp:
+ (WebKit::ProcessThrottler::ProcessThrottler):
+ (WebKit::ProcessThrottler::suspendTimerFired):
+ * UIProcess/ProcessThrottler.h:
+ * UIProcess/ios/ViewGestureControllerIOS.mm:
+ (WebKit::ViewGestureController::ViewGestureController):
+ (WebKit::ViewGestureController::swipeSnapshotWatchdogTimerFired):
+ * UIProcess/mac/ViewGestureController.h:
+ * UIProcess/mac/ViewGestureControllerMac.mm:
+ (WebKit::ViewGestureController::ViewGestureController):
+ (WebKit::ViewGestureController::swipeSnapshotWatchdogTimerFired):
+ We can't use WebCore timers in the UI process because of coexistence concerns
+ (they fire on the Web Thread if there is one!), so use RunLoop::Timer instead.
+
2014-07-21 Andy Estes <aestes@apple.com>
[iOS] Handle QuickLook ResourceLoaders in the web process
ProcessThrottler::ProcessThrottler(WebProcessProxy* process)
: m_process(process)
, m_weakPtrFactory(this)
- , m_suspendTimer(this, &ProcessThrottler::suspendTimerFired)
+ , m_suspendTimer(RunLoop::main(), this, &ProcessThrottler::suspendTimerFired)
, m_foregroundCount(0)
, m_backgroundCount(0)
, m_suspendMessageCount(0)
m_assertion = std::make_unique<ProcessAndUIAssertion>(pid, assertionState());
}
-void ProcessThrottler::suspendTimerFired(WebCore::Timer<ProcessThrottler>*)
+void ProcessThrottler::suspendTimerFired()
{
updateAssertionNow();
}
#include "ProcessAssertion.h"
-#include <WebCore/Timer.h>
+#include <wtf/RunLoop.h>
#include <wtf/WeakPtr.h>
namespace WebKit {
AssertionState assertionState();
void updateAssertion();
void updateAssertionNow();
- void suspendTimerFired(WebCore::Timer<ProcessThrottler>*);
+ void suspendTimerFired();
WebProcessProxy* m_process;
WeakPtrFactory<ProcessThrottler> m_weakPtrFactory;
std::unique_ptr<ProcessAndUIAssertion> m_assertion;
- WebCore::Timer<ProcessThrottler> m_suspendTimer;
+ RunLoop::Timer<ProcessThrottler> m_suspendTimer;
unsigned m_foregroundCount;
unsigned m_backgroundCount;
int m_suspendMessageCount;
ViewGestureController::ViewGestureController(WebPageProxy& webPageProxy)
: m_webPageProxy(webPageProxy)
, m_activeGestureType(ViewGestureType::None)
- , m_swipeWatchdogTimer(this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
+ , m_swipeWatchdogTimer(RunLoop::main(), this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
, m_snapshotRemovalTargetRenderTreeSize(0)
, m_shouldRemoveSnapshotWhenTargetRenderTreeSizeHit(false)
{
removeSwipeSnapshot();
}
-void ViewGestureController::swipeSnapshotWatchdogTimerFired(Timer<ViewGestureController>*)
+void ViewGestureController::swipeSnapshotWatchdogTimerFired()
{
removeSwipeSnapshot();
}
#include "MessageReceiver.h"
#include "WeakObjCPtr.h"
#include <WebCore/FloatRect.h>
-#include <WebCore/Timer.h>
#include <wtf/RetainPtr.h>
+#include <wtf/RunLoop.h>
OBJC_CLASS CALayer;
virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
void removeSwipeSnapshot();
- void swipeSnapshotWatchdogTimerFired(WebCore::Timer<ViewGestureController>*);
+ void swipeSnapshotWatchdogTimerFired();
#if PLATFORM(MAC)
// Message handlers.
WebPageProxy& m_webPageProxy;
ViewGestureType m_activeGestureType;
- WebCore::Timer<ViewGestureController> m_swipeWatchdogTimer;
+ RunLoop::Timer<ViewGestureController> m_swipeWatchdogTimer;
#if USE(IOSURFACE)
RefPtr<WebCore::IOSurface> m_currentSwipeSnapshotSurface;
ViewGestureController::ViewGestureController(WebPageProxy& webPageProxy)
: m_webPageProxy(webPageProxy)
, m_activeGestureType(ViewGestureType::None)
- , m_swipeWatchdogTimer(this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
+ , m_swipeWatchdogTimer(RunLoop::main(), this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
, m_lastMagnificationGestureWasSmartMagnification(false)
, m_visibleContentRectIsValid(false)
, m_frameHandlesMagnificationGesture(false)
removeSwipeSnapshot();
}
-void ViewGestureController::swipeSnapshotWatchdogTimerFired(WebCore::Timer<ViewGestureController>*)
+void ViewGestureController::swipeSnapshotWatchdogTimerFired()
{
removeSwipeSnapshot();
}