Title: [121167] branches/safari-536-branch/Source/WebKit2

Diff

Modified: branches/safari-536-branch/Source/WebKit2/ChangeLog (121166 => 121167)


--- branches/safari-536-branch/Source/WebKit2/ChangeLog	2012-06-25 17:39:07 UTC (rev 121166)
+++ branches/safari-536-branch/Source/WebKit2/ChangeLog	2012-06-25 17:41:53 UTC (rev 121167)
@@ -1,3 +1,31 @@
+2012-06-25  Lucas Forschler  <[email protected]>
+
+    Merge 121113
+
+    2012-06-24  Andreas Kling  <[email protected]>
+
+            REGRESSION(r120329): Intermittent WebProcess shutdowns due to out-of-line DidReceiveEvent messages.
+            <rdar://problem/11686974>
+            <http://webkit.org/b/89659>
+
+            Reviewed by Sam Weinig.
+
+            Instead of sending DidReceiveEvent for key events as DispatchMessageEvenWhenWaitingForSyncReply,
+            use proper synchronous messages. This makes the WebProcess block while the UIProcess handles
+            the event but prevents a weird race condition where DidReceiveEvent gets dispatched just before
+            a synchronous DecidePolicyForNavigationAction and something happens below DidReceiveEvent that
+            invalidates the frame ID passed to DecidePolicyForNavigationAction.
+
+            This is a speculative fire-fighting fix.
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::didReceiveKeyEvent):
+            (WebKit::WebPageProxy::didReceiveEvent):
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/WebPageProxy.messages.in:
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::keyEvent):
+
 2012-06-20  Lucas Forschler  <[email protected]>
 
     Merge 120879

Modified: branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (121166 => 121167)


--- branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-06-25 17:39:07 UTC (rev 121166)
+++ branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-06-25 17:41:53 UTC (rev 121167)
@@ -3063,6 +3063,42 @@
     m_pageClient->setCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves);
 }
 
+void WebPageProxy::didReceiveKeyEvent(uint32_t opaqueType, bool handled)
+{
+    process()->responsivenessTimer()->stop();
+
+    WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
+
+    switch (type) {
+    case WebEvent::KeyDown:
+    case WebEvent::KeyUp:
+    case WebEvent::RawKeyDown:
+    case WebEvent::Char: {
+        LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s", webKeyboardEventTypeString(type));
+
+        NativeWebKeyboardEvent event = m_keyEventQueue.first();
+        MESSAGE_CHECK(type == event.type());
+
+        m_keyEventQueue.removeFirst();
+
+        m_pageClient->doneWithKeyEvent(event, handled);
+
+        if (handled)
+            break;
+
+        if (m_uiClient.implementsDidNotHandleKeyEvent())
+            m_uiClient.didNotHandleKeyEvent(this, event);
+#if PLATFORM(WIN)
+        else
+            ::TranslateMessage(event.nativeEvent());
+#endif
+        break;
+    }
+    default:
+        ASSERT_NOT_REACHED();
+    }
+}
+
 void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
 {
     WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
@@ -3075,10 +3111,6 @@
     case WebEvent::MouseDown:
     case WebEvent::MouseUp:
     case WebEvent::Wheel:
-    case WebEvent::KeyDown:
-    case WebEvent::KeyUp:
-    case WebEvent::RawKeyDown:
-    case WebEvent::Char:
 #if ENABLE(GESTURE_EVENTS)
     case WebEvent::GestureScrollBegin:
     case WebEvent::GestureScrollEnd:
@@ -3092,6 +3124,8 @@
 #endif
         process()->responsivenessTimer()->stop();
         break;
+    default:
+        ASSERT_NOT_REACHED();
     }
 
     switch (type) {
@@ -3136,30 +3170,6 @@
         break;
     }
 
-    case WebEvent::KeyDown:
-    case WebEvent::KeyUp:
-    case WebEvent::RawKeyDown:
-    case WebEvent::Char: {
-        LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s", webKeyboardEventTypeString(type));
-
-        NativeWebKeyboardEvent event = m_keyEventQueue.first();
-        MESSAGE_CHECK(type == event.type());
-
-        m_keyEventQueue.removeFirst();
-
-        m_pageClient->doneWithKeyEvent(event, handled);
-
-        if (handled)
-            break;
-
-        if (m_uiClient.implementsDidNotHandleKeyEvent())
-            m_uiClient.didNotHandleKeyEvent(this, event);
-#if PLATFORM(WIN)
-        else
-            ::TranslateMessage(event.nativeEvent());
-#endif
-        break;
-    }
 #if ENABLE(TOUCH_EVENTS)
     case WebEvent::TouchStart:
     case WebEvent::TouchMove:
@@ -3177,6 +3187,8 @@
         break;
     }
 #endif
+    default:
+        ASSERT_NOT_REACHED();
     }
 }
 

Modified: branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.h (121166 => 121167)


--- branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2012-06-25 17:39:07 UTC (rev 121166)
+++ branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2012-06-25 17:41:53 UTC (rev 121167)
@@ -853,6 +853,7 @@
     void setCursorHiddenUntilMouseMoves(bool);
 
     void didReceiveEvent(uint32_t opaqueType, bool handled);
+    void didReceiveKeyEvent(uint32_t opaqueType, bool handled);
     void stopResponsivenessTimer();
 
     void voidCallback(uint64_t);

Modified: branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (121166 => 121167)


--- branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-06-25 17:39:07 UTC (rev 121166)
+++ branches/safari-536-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-06-25 17:41:53 UTC (rev 121167)
@@ -33,6 +33,7 @@
     UnavailablePluginButtonClicked(uint32_t pluginUnavailabilityReason, WTF::String mimeType, WTF::String url, WTF::String pluginsPageURL)
     DidChangeViewportProperties(WebCore::ViewportAttributes attributes)
     DidReceiveEvent(uint32_t type, bool handled)
+    DidReceiveKeyEvent(uint32_t type, bool handled) -> ()
     StopResponsivenessTimer()
     SetCursor(WebCore::Cursor cursor)
     SetCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)

Modified: branches/safari-536-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (121166 => 121167)


--- branches/safari-536-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-06-25 17:39:07 UTC (rev 121166)
+++ branches/safari-536-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-06-25 17:41:53 UTC (rev 121167)
@@ -1411,9 +1411,7 @@
     if (!handled)
         handled = performDefaultBehaviorForKeyEvent(keyboardEvent);
 
-    // The receiving end relies on DidReceiveEvent and InterpretQueuedKeyEvent arriving in the same order they are sent
-    // (for keyboard events.) We set the DispatchMessageEvenWhenWaitingForSyncReply flag to ensure consistent ordering.
-    connection()->send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled), m_pageID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
+    sendSync(Messages::WebPageProxy::DidReceiveKeyEvent(static_cast<uint32_t>(keyboardEvent.type()), handled), Messages::WebPageProxy::DidReceiveKeyEvent::Reply());
 }
 
 void WebPage::keyEventSyncForTesting(const WebKeyboardEvent& keyboardEvent, bool& handled)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to