Fullscreen UI does not appear after WebProcess has crashed
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 May 2014 23:11:14 +0000 (23:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 May 2014 23:11:14 +0000 (23:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132442

Patch by Jeremy Jones <jeremyj@apple.com> on 2014-05-02
Reviewed by Darin Adler.

Source/WebCore:
Clean up immediately when there is a WebProcess crash.

* WebCore.exp.in:
* platform/ios/WebVideoFullscreenInterfaceAVKit.h:
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebVideoFullscreenInterfaceAVKit::invalidate):
Clean-up resources immediately.

Source/WebKit2:
Cleanup WebVideoFullscreenManagerProxy after a WebProcess crash.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reattachToWebProcess):
recreate WebVideoFullscreenManagerProxy after a WebProcess crash.

(WebKit::WebPageProxy::resetState):
invalidate and release WebVideoFullscreenManagerProxy on crash.

* UIProcess/ios/WebVideoFullscreenManagerProxy.h:
* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::~WebVideoFullscreenManagerProxy):
don't assume m_page is valid.

(WebKit::WebVideoFullscreenManagerProxy::invalidate):
do cleanup invalidation in reponse to a WebProcess crash.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168205 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h
Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h
Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm

index 1605f31..3533801 100644 (file)
@@ -1,3 +1,18 @@
+2014-05-02  Jeremy Jones  <jeremyj@apple.com>
+
+        Fullscreen UI does not appear after WebProcess has crashed
+        https://bugs.webkit.org/show_bug.cgi?id=132442
+
+        Reviewed by Darin Adler.
+
+        Clean up immediately when there is a WebProcess crash.
+
+        * WebCore.exp.in:
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (WebVideoFullscreenInterfaceAVKit::invalidate):
+        Clean-up resources immediately.
+
 2014-05-02  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r168192.
index a683a47..782d489 100644 (file)
@@ -3310,6 +3310,7 @@ __ZThn?_N7WebCore35WebVideoFullscreenModelMediaElement11handleEventEPNS_22Script
 #endif
 
 #if ENABLE(VIDEO) && PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
+__ZN7WebCore32WebVideoFullscreenInterfaceAVKit10invalidateEv
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit11setDurationEd
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit14exitFullscreenENS_7IntRectE
 __ZN7WebCore32WebVideoFullscreenInterfaceAVKit14setCurrentTimeEdd
index 8b97463..7b145fe 100644 (file)
@@ -86,6 +86,7 @@ public:
 
     virtual void enterFullscreen(PlatformLayer&, WebCore::IntRect initialRect);
     virtual void exitFullscreen(WebCore::IntRect finalRect);
+    virtual void invalidate();
 };
 
 }
index ec89fd3..10242d5 100644 (file)
@@ -585,4 +585,20 @@ void WebVideoFullscreenInterfaceAVKit::exitFullscreen(WebCore::IntRect finalRect
     });
 }
 
+void WebVideoFullscreenInterfaceAVKit::invalidate()
+{
+    m_playerController.clear();
+    [m_window setHidden:YES];
+    [m_window setRootViewController:nil];
+    [m_playerViewController setDelegate:nil];
+    [m_playerViewController setPlayerController:nil];
+    m_playerViewController = nil;
+    m_viewController = nil;
+    m_window = nil;
+    [m_videoLayer removeFromSuperlayer];
+    m_videoLayer = nil;
+    [m_videoLayerContainer removeFromSuperlayer];
+    m_videoLayerContainer = nil;
+}
+
 #endif
index 63e756d..0303fe9 100644 (file)
@@ -1,3 +1,27 @@
+2014-05-02  Jeremy Jones  <jeremyj@apple.com>
+
+        Fullscreen UI does not appear after WebProcess has crashed
+        https://bugs.webkit.org/show_bug.cgi?id=132442
+
+        Reviewed by Darin Adler.
+
+        Cleanup WebVideoFullscreenManagerProxy after a WebProcess crash.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::reattachToWebProcess):
+        recreate WebVideoFullscreenManagerProxy after a WebProcess crash.
+
+        (WebKit::WebPageProxy::resetState):
+        invalidate and release WebVideoFullscreenManagerProxy on crash.
+
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.h:
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::~WebVideoFullscreenManagerProxy):
+        don't assume m_page is valid.
+
+        (WebKit::WebVideoFullscreenManagerProxy::invalidate):
+        do cleanup invalidation in reponse to a WebProcess crash.
+
 2014-05-02  Benjamin Poulain  <bpoulain@apple.com>
 
         [iOS][WK2] More animation madness for when the extendedBackground is modified in an animation block
index 7d95680..9ffe6ea 100644 (file)
@@ -539,6 +539,9 @@ void WebPageProxy::reattachToWebProcess()
 #if ENABLE(FULLSCREEN_API)
     m_fullScreenManager = WebFullScreenManagerProxy::create(*this, m_pageClient.fullScreenManagerProxyClient());
 #endif
+#if PLATFORM(IOS)
+    m_videoFullscreenManager = WebVideoFullscreenManagerProxy::create(*this);
+#endif
 
     initializeWebPage();
 
@@ -4127,6 +4130,13 @@ void WebPageProxy::resetState()
     }
 #endif
 
+#if PLATFORM(IOS)
+    if (m_videoFullscreenManager) {
+        m_videoFullscreenManager->invalidate();
+        m_videoFullscreenManager = nullptr;
+    }
+#endif
+
 #if ENABLE(VIBRATION)
     m_vibration->invalidate();
 #endif
index f5f5e3e..ebe6f9d 100644 (file)
@@ -47,6 +47,8 @@ public:
     static PassRefPtr<WebVideoFullscreenManagerProxy> create(WebPageProxy&);
     virtual ~WebVideoFullscreenManagerProxy();
 
+    virtual void invalidate() override;
+
 private:
     explicit WebVideoFullscreenManagerProxy(WebPageProxy&);
     virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
index bb43496..f43462d 100644 (file)
@@ -55,9 +55,22 @@ WebVideoFullscreenManagerProxy::WebVideoFullscreenManagerProxy(WebPageProxy& pag
 
 WebVideoFullscreenManagerProxy::~WebVideoFullscreenManagerProxy()
 {
+    if (!m_page)
+        return;
     m_page->process().removeMessageReceiver(Messages::WebVideoFullscreenManagerProxy::messageReceiverName(), m_page->pageID());
 }
 
+void WebVideoFullscreenManagerProxy::invalidate()
+{
+    WebVideoFullscreenInterfaceAVKit::invalidate();
+
+    m_page->process().removeMessageReceiver(Messages::WebVideoFullscreenManagerProxy::messageReceiverName(), m_page->pageID());
+    m_page = nullptr;
+
+    [m_layerHost removeFromSuperlayer];
+    m_layerHost.clear();
+}
+
 void WebVideoFullscreenManagerProxy::enterFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect)
 {
     ASSERT(videoLayerID);