- Revision
- 171317
- Author
- [email protected]
- Date
- 2014-07-21 15:17:24 -0700 (Mon, 21 Jul 2014)
Log Message
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.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (171316 => 171317)
--- trunk/Source/WebKit2/ChangeLog 2014-07-21 20:47:03 UTC (rev 171316)
+++ trunk/Source/WebKit2/ChangeLog 2014-07-21 22:17:24 UTC (rev 171317)
@@ -1,3 +1,25 @@
+2014-07-21 Timothy Horton <[email protected]>
+
+ 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 <[email protected]>
[iOS] Handle QuickLook ResourceLoaders in the web process
Modified: trunk/Source/WebKit2/UIProcess/ProcessThrottler.cpp (171316 => 171317)
--- trunk/Source/WebKit2/UIProcess/ProcessThrottler.cpp 2014-07-21 20:47:03 UTC (rev 171316)
+++ trunk/Source/WebKit2/UIProcess/ProcessThrottler.cpp 2014-07-21 22:17:24 UTC (rev 171317)
@@ -65,7 +65,7 @@
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)
@@ -116,7 +116,7 @@
m_assertion = std::make_unique<ProcessAndUIAssertion>(pid, assertionState());
}
-void ProcessThrottler::suspendTimerFired(WebCore::Timer<ProcessThrottler>*)
+void ProcessThrottler::suspendTimerFired()
{
updateAssertionNow();
}
Modified: trunk/Source/WebKit2/UIProcess/ProcessThrottler.h (171316 => 171317)
--- trunk/Source/WebKit2/UIProcess/ProcessThrottler.h 2014-07-21 20:47:03 UTC (rev 171316)
+++ trunk/Source/WebKit2/UIProcess/ProcessThrottler.h 2014-07-21 22:17:24 UTC (rev 171317)
@@ -28,7 +28,7 @@
#include "ProcessAssertion.h"
-#include <WebCore/Timer.h>
+#include <wtf/RunLoop.h>
#include <wtf/WeakPtr.h>
namespace WebKit {
@@ -69,12 +69,12 @@
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;
Modified: trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (171316 => 171317)
--- trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm 2014-07-21 20:47:03 UTC (rev 171316)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm 2014-07-21 22:17:24 UTC (rev 171317)
@@ -136,7 +136,7 @@
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)
{
@@ -310,7 +310,7 @@
removeSwipeSnapshot();
}
-void ViewGestureController::swipeSnapshotWatchdogTimerFired(Timer<ViewGestureController>*)
+void ViewGestureController::swipeSnapshotWatchdogTimerFired()
{
removeSwipeSnapshot();
}
Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (171316 => 171317)
--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h 2014-07-21 20:47:03 UTC (rev 171316)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h 2014-07-21 22:17:24 UTC (rev 171317)
@@ -29,8 +29,8 @@
#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;
@@ -119,7 +119,7 @@
virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
void removeSwipeSnapshot();
- void swipeSnapshotWatchdogTimerFired(WebCore::Timer<ViewGestureController>*);
+ void swipeSnapshotWatchdogTimerFired();
#if PLATFORM(MAC)
// Message handlers.
@@ -146,7 +146,7 @@
WebPageProxy& m_webPageProxy;
ViewGestureType m_activeGestureType;
- WebCore::Timer<ViewGestureController> m_swipeWatchdogTimer;
+ RunLoop::Timer<ViewGestureController> m_swipeWatchdogTimer;
#if USE(IOSURFACE)
RefPtr<WebCore::IOSurface> m_currentSwipeSnapshotSurface;
Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (171316 => 171317)
--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm 2014-07-21 20:47:03 UTC (rev 171316)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm 2014-07-21 22:17:24 UTC (rev 171317)
@@ -97,7 +97,7 @@
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)
@@ -657,7 +657,7 @@
removeSwipeSnapshot();
}
-void ViewGestureController::swipeSnapshotWatchdogTimerFired(WebCore::Timer<ViewGestureController>*)
+void ViewGestureController::swipeSnapshotWatchdogTimerFired()
{
removeSwipeSnapshot();
}