Title: [253256] trunk/Source/WebKit
Revision
253256
Author
[email protected]
Date
2019-12-07 10:46:28 -0800 (Sat, 07 Dec 2019)

Log Message

REGRESSION(r253231): Debug assertion failures under ~WebDeviceOrientationUpdateProvider(Proxy)
https://bugs.webkit.org/show_bug.cgi?id=204977
rdar://problem/57724251

Reviewed by Per Arne Vollan.

In the UI process, have the WebPageProxy swap out its WebDeviceOrientationUpdateProviderProxy whenever
it connects to a new process, instead of creating one on construction and holding onto it for the rest
of the WebPageProxy lifetime. The …UpdateProviderProxy assumes that its page will have the same ID
at the time of registering as a message receiver and later unregistering, but the page ID could change
if the WebPageProxy swaps web processes. Using a new instance per web page ID ensures that the
updater is always able to successfully remove itself as a message receiver when deallocating.

In the Web process, ~WebDeviceOrientationUpdateProvider() should remove itself as a message receiver
specifically for its page ID, rather than as a global message receiver.

No new tests -- existing tests (at least the ProcessSwap API tests) revealed the regression.

* UIProcess/WebPageProxy.cpp:
(WebKit::m_tryCloseTimeoutTimer):
(WebKit::WebPageProxy::didAttachToRunningProcess):
(WebKit::WebPageProxy::resetState):
(WebKit::m_webDeviceOrientationUpdateProviderProxy): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h:
* WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp:
(WebKit::WebDeviceOrientationUpdateProvider::WebDeviceOrientationUpdateProvider):
(WebKit::WebDeviceOrientationUpdateProvider::~WebDeviceOrientationUpdateProvider):
* WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (253255 => 253256)


--- trunk/Source/WebKit/ChangeLog	2019-12-07 18:18:16 UTC (rev 253255)
+++ trunk/Source/WebKit/ChangeLog	2019-12-07 18:46:28 UTC (rev 253256)
@@ -1,3 +1,35 @@
+2019-12-07  David Quesada  <[email protected]>
+
+        REGRESSION(r253231): Debug assertion failures under ~WebDeviceOrientationUpdateProvider(Proxy)
+        https://bugs.webkit.org/show_bug.cgi?id=204977
+        rdar://problem/57724251
+
+        Reviewed by Per Arne Vollan.
+
+        In the UI process, have the WebPageProxy swap out its WebDeviceOrientationUpdateProviderProxy whenever
+        it connects to a new process, instead of creating one on construction and holding onto it for the rest
+        of the WebPageProxy lifetime. The …UpdateProviderProxy assumes that its page will have the same ID
+        at the time of registering as a message receiver and later unregistering, but the page ID could change
+        if the WebPageProxy swaps web processes. Using a new instance per web page ID ensures that the
+        updater is always able to successfully remove itself as a message receiver when deallocating.
+
+        In the Web process, ~WebDeviceOrientationUpdateProvider() should remove itself as a message receiver
+        specifically for its page ID, rather than as a global message receiver.
+
+        No new tests -- existing tests (at least the ProcessSwap API tests) revealed the regression.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::m_tryCloseTimeoutTimer):
+        (WebKit::WebPageProxy::didAttachToRunningProcess):
+        (WebKit::WebPageProxy::resetState):
+        (WebKit::m_webDeviceOrientationUpdateProviderProxy): Deleted.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h:
+        * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp:
+        (WebKit::WebDeviceOrientationUpdateProvider::WebDeviceOrientationUpdateProvider):
+        (WebKit::WebDeviceOrientationUpdateProvider::~WebDeviceOrientationUpdateProvider):
+        * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h:
+
 2019-12-07  Tim Horton  <[email protected]>
 
         Implement encoding for DrawImage and DrawRoundedRect display list items

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (253255 => 253256)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-12-07 18:18:16 UTC (rev 253255)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-12-07 18:46:28 UTC (rev 253256)
@@ -256,6 +256,10 @@
 #include <d3d11_1.h>
 #endif
 
+#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
+#include "WebDeviceOrientationUpdateProviderProxy.h"
+#endif
+
 // This controls what strategy we use for mouse wheel coalescing.
 #define MERGE_WHEEL_EVENTS 1
 
@@ -451,9 +455,6 @@
 #endif
     , m_resetRecentCrashCountTimer(RunLoop::main(), this, &WebPageProxy::resetRecentCrashCount)
     , m_tryCloseTimeoutTimer(RunLoop::main(), this, &WebPageProxy::tryCloseTimedOut)
-#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
-    , m_webDeviceOrientationUpdateProviderProxy(*this)
-#endif
 {
     RELEASE_LOG_IF_ALLOWED(Loading, "constructor:");
 
@@ -909,6 +910,11 @@
     ASSERT(!m_editableImageController);
     m_editableImageController = makeUnique<EditableImageController>(*this);
 #endif
+    
+#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
+    ASSERT(!m_webDeviceOrientationUpdateProviderProxy);
+    m_webDeviceOrientationUpdateProviderProxy = makeUnique<WebDeviceOrientationUpdateProviderProxy>(*this);
+#endif
 }
 
 RefPtr<API::Navigation> WebPageProxy::launchProcessForReload()
@@ -7250,6 +7256,10 @@
 #if HAVE(PENCILKIT)
     m_editableImageController = nullptr;
 #endif
+    
+#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
+    m_webDeviceOrientationUpdateProviderProxy = nullptr;
+#endif
 
     CallbackBase::Error error { };
     switch (resetStateReason) {

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (253255 => 253256)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-12-07 18:18:16 UTC (rev 253255)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-12-07 18:46:28 UTC (rev 253256)
@@ -149,10 +149,6 @@
 #include "SOAuthorizationLoadPolicy.h"
 #endif
 
-#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
-#include "WebDeviceOrientationUpdateProviderProxy.h"
-#endif
-
 #if ENABLE(MEDIA_SESSION)
 namespace WebCore {
 class MediaSessionMetadata;
@@ -301,6 +297,7 @@
 class WebUserContentControllerProxy;
 class WebWheelEvent;
 class WebsiteDataStore;
+class WebDeviceOrientationUpdateProviderProxy;
 class WebViewDidMoveToWindowObserver;
 
 struct AttributedString;
@@ -2638,7 +2635,7 @@
     String m_overriddenMediaType;
         
 #if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
-    WebDeviceOrientationUpdateProviderProxy m_webDeviceOrientationUpdateProviderProxy;
+    std::unique_ptr<WebDeviceOrientationUpdateProviderProxy> m_webDeviceOrientationUpdateProviderProxy;
 #endif
 };
 

Modified: trunk/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h (253255 => 253256)


--- trunk/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h	2019-12-07 18:18:16 UTC (rev 253255)
+++ trunk/Source/WebKit/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h	2019-12-07 18:46:28 UTC (rev 253256)
@@ -35,6 +35,7 @@
 class WebPageProxy;
 
 class WebDeviceOrientationUpdateProviderProxy : public WebCore::MotionManagerClient, private IPC::MessageReceiver {
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     WebDeviceOrientationUpdateProviderProxy(WebPageProxy&);
     ~WebDeviceOrientationUpdateProviderProxy();
@@ -46,7 +47,7 @@
     // WebCore::WebCoreMotionManagerClient
     void orientationChanged(double, double, double, double, double) final;
     
-    // IPC::MessageReceiver.
+    // IPC::MessageReceiver
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
 
     WebPageProxy& m_page;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp (253255 => 253256)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp	2019-12-07 18:18:16 UTC (rev 253255)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp	2019-12-07 18:46:28 UTC (rev 253256)
@@ -39,6 +39,7 @@
 
 WebDeviceOrientationUpdateProvider::WebDeviceOrientationUpdateProvider(WebPage& page)
     : m_page(makeWeakPtr(page))
+    , m_pageIdentifier(page.identifier())
 {
     WebProcess::singleton().addMessageReceiver(Messages::WebDeviceOrientationUpdateProvider::messageReceiverName(), page.identifier(), *this);
 }
@@ -45,7 +46,7 @@
 
 WebDeviceOrientationUpdateProvider::~WebDeviceOrientationUpdateProvider()
 {
-    WebProcess::singleton().removeMessageReceiver(Messages::WebDeviceOrientationUpdateProvider::messageReceiverName());
+    WebProcess::singleton().removeMessageReceiver(Messages::WebDeviceOrientationUpdateProvider::messageReceiverName(), m_pageIdentifier);
 }
 
 void WebDeviceOrientationUpdateProvider::startUpdating(WebCore::MotionManagerClient& client)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h (253255 => 253256)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h	2019-12-07 18:18:16 UTC (rev 253255)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h	2019-12-07 18:46:28 UTC (rev 253256)
@@ -54,6 +54,7 @@
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
 
     WeakPtr<WebPage> m_page;
+    WebCore::PageIdentifier m_pageIdentifier;
     HashSet<WebCore::MotionManagerClient*> m_clients;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to