Title: [218422] trunk/Source/WebCore
- Revision
- 218422
- Author
- commit-qu...@webkit.org
- Date
- 2017-06-16 15:56:44 -0700 (Fri, 16 Jun 2017)
Log Message
Handle timeout of prepareForPictureInPictureStopWithCompletionHandler.
https://bugs.webkit.org/show_bug.cgi?id=173462
rdar://problem/32128170
Patch by Jeremy Jones <jere...@apple.com> on 2017-06-16
Reviewed by Jer Noble.
No new tests because no effect on the DOM.
If WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler doesn't respond fast enough,
the caller will timeout and call will/didStopPictureInPicture.
This is getting fullscreen state confused.
This change keeps state consistent by handling will/didStopPictureInPicture possibly being called before
prepareForPictureInPictureStopWithCompletionHandler calls its callback.
* platform/ios/WebVideoFullscreenInterfaceAVKit.h:
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture):
(WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture):
(WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
(WebVideoFullscreenInterfaceAVKit::watchdogTimerFired):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (218421 => 218422)
--- trunk/Source/WebCore/ChangeLog 2017-06-16 22:46:21 UTC (rev 218421)
+++ trunk/Source/WebCore/ChangeLog 2017-06-16 22:56:44 UTC (rev 218422)
@@ -1,3 +1,28 @@
+2017-06-16 Jeremy Jones <jere...@apple.com>
+
+ Handle timeout of prepareForPictureInPictureStopWithCompletionHandler.
+ https://bugs.webkit.org/show_bug.cgi?id=173462
+ rdar://problem/32128170
+
+ Reviewed by Jer Noble.
+
+ No new tests because no effect on the DOM.
+
+ If WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler doesn't respond fast enough,
+ the caller will timeout and call will/didStopPictureInPicture.
+
+ This is getting fullscreen state confused.
+
+ This change keeps state consistent by handling will/didStopPictureInPicture possibly being called before
+ prepareForPictureInPictureStopWithCompletionHandler calls its callback.
+
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ (WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture):
+ (WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture):
+ (WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
+ (WebVideoFullscreenInterfaceAVKit::watchdogTimerFired):
+
2017-06-16 Myles C. Maxfield <mmaxfi...@apple.com>
Make builds faster after r218371
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (218421 => 218422)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2017-06-16 22:46:21 UTC (rev 218421)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2017-06-16 22:56:44 UTC (rev 218422)
@@ -147,6 +147,7 @@
bool m_wirelessVideoPlaybackDisabled { true };
bool m_shouldReturnToFullscreenWhenStoppingPiP { false };
bool m_shouldReturnToFullscreenAfterEnteringForeground { false };
+ bool m_restoringFullscreenForPictureInPictureStop { false };
void doEnterFullscreen();
};
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (218421 => 218422)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2017-06-16 22:46:21 UTC (rev 218421)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2017-06-16 22:56:44 UTC (rev 218422)
@@ -909,8 +909,11 @@
void WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture()
{
+ m_shouldReturnToFullscreenWhenStoppingPiP = false;
+ m_shouldReturnToFullscreenAfterEnteringForeground = false;
+
LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture(%p)", this);
- if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard))
+ if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard) || m_restoringFullscreenForPictureInPictureStop)
return;
[m_window setHidden:NO];
@@ -923,13 +926,10 @@
void WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture()
{
LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture(%p)", this);
- if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard)) {
+ if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard) || m_restoringFullscreenForPictureInPictureStop) {
// ASSUMPTION: we are exiting pip because we are entering fullscreen
clearMode(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture);
[m_playerViewController setShowsPlaybackControls:YES];
-
- if (m_fullscreenChangeObserver)
- m_fullscreenChangeObserver->didEnterFullscreen();
return;
}
@@ -950,14 +950,17 @@
if (m_shouldReturnToFullscreenWhenStoppingPiP || m_shouldReturnToFullscreenAfterEnteringForeground) {
m_shouldReturnToFullscreenWhenStoppingPiP = false;
m_shouldReturnToFullscreenAfterEnteringForeground = false;
+ m_restoringFullscreenForPictureInPictureStop = true;
- // ASSUMPTION: we are exiting pip because we are entering fullscreen
[m_window setHidden:NO];
[[m_playerViewController view] setHidden:NO];
[m_playerViewController enterFullScreenAnimated:YES completionHandler:^(BOOL success, NSError*) {
+ m_restoringFullscreenForPictureInPictureStop = false;
setMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);
completionHandler(success);
+ if (m_fullscreenChangeObserver)
+ m_fullscreenChangeObserver->didEnterFullscreen();
}];
return;
}
@@ -998,7 +1001,7 @@
NO_RETURN_DUE_TO_ASSERT void WebVideoFullscreenInterfaceAVKit::watchdogTimerFired()
{
- LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::watchdogTimerFired(%p) - no exit fullscreen response in %gs; forcing fullscreen hidden.", this, defaultWatchdogTimerInterval);
+ LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::watchdogTimerFired(%p) - no exit fullscreen response in %gs; forcing fullscreen hidden.", this, defaultWatchdogTimerInterval.value());
ASSERT_NOT_REACHED();
[m_window setHidden:YES];
[[m_playerViewController view] setHidden:YES];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes