<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[187522] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/187522">187522</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-07-28 15:29:54 -0700 (Tue, 28 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS] REGRESSION(<a href="http://trac.webkit.org/projects/webkit/changeset/168075">r168075</a>): Fullscreen web video doesn't pause on screen lock
https://bugs.webkit.org/show_bug.cgi?id=147269
Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-07-28
Reviewed by Andreas Kling.
Media elements should pause when the application is going to EnterBackground
under lock regardless whether it is in full screen or not.
Source/WebCore:
* platform/audio/PlatformMediaSession.h:
* platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::doInterruption): This code was moved from
beginInterruption().
(WebCore::PlatformMediaSession::shouldDoInterruption): Move the condition
which allows the media session interruption to a separate function.
(WebCore::PlatformMediaSession::beginInterruption): Call the functions
shouldDoInterruption() and doInterruption().
(WebCore::PlatformMediaSession::forceInterruption): This function will
be called from PlatformMediaSessionManager::applicationDidEnterBackground()
to override the decision which is made by PlatformMediaSession::beginInterruption()
if the application isSuspendedUnderLock.
* platform/audio/PlatformMediaSessionManager.h:
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
[UIApp isSuspendedUnderLock] is only valid when it is called when the
UIApplicationDidEnterBackgroundNotification is received. We need to force
interrupting the media sessions if the application isSuspendedUnderLock
and UIApplicationWillResignActiveNotification was ignored because of PiP.
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(-[WebMediaSessionHelper initWithCallback:]):
(-[WebMediaSessionHelper applicationDidEnterBackground:]): Listen to
UIApplicationDidEnterBackgroundNotification and make a call on the web
thread to PlatformMediaSessionManager::applicationDidEnterBackground()
and pass the isSuspendedUnderLock flag which is queried on the UIProcess.
Source/WebKit2:
* Platform/spi/ios/UIKitSPI.h: Forward declare [UIApplication isSuspendedUnderLock].
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::applicationDidEnterBackground):
[UIApp isSuspendedUnderLock] can only be called in the UIProcess. We need
to call it here and pass it to the WebPage in the WebProcess as part of the
ApplicationDidEnterBackground message.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Add the new parameter:
'isSuspendedUnderLock' to the ApplicationDidEnterBackground message.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::applicationDidEnterBackground): On iOS, the WebPage needs
to notify the MediaSessionManagerIOS that it received the message
ApplicationDidEnterBackground.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioPlatformMediaSessioncpp">trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioPlatformMediaSessionh">trunk/Source/WebCore/platform/audio/PlatformMediaSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioPlatformMediaSessionManagercpp">trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioPlatformMediaSessionManagerh">trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSh">trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm">trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformspiiosUIKitSPIh">trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebCore/ChangeLog        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2015-07-28 Said Abou-Hallawa <sabouhallawa@apple.com>
+
+ [iOS] REGRESSION(r168075): Fullscreen web video doesn't pause on screen lock
+ https://bugs.webkit.org/show_bug.cgi?id=147269
+
+ Reviewed by Andreas Kling.
+
+ Media elements should pause when the application is going to EnterBackground
+ under lock regardless whether it is in full screen or not.
+
+ * platform/audio/PlatformMediaSession.h:
+ * platform/audio/PlatformMediaSession.cpp:
+ (WebCore::PlatformMediaSession::doInterruption): This code was moved from
+ beginInterruption().
+
+ (WebCore::PlatformMediaSession::shouldDoInterruption): Move the condition
+ which allows the media session interruption to a separate function.
+
+ (WebCore::PlatformMediaSession::beginInterruption): Call the functions
+ shouldDoInterruption() and doInterruption().
+
+ (WebCore::PlatformMediaSession::forceInterruption): This function will
+ be called from PlatformMediaSessionManager::applicationDidEnterBackground()
+ to override the decision which is made by PlatformMediaSession::beginInterruption()
+ if the application isSuspendedUnderLock.
+
+ * platform/audio/PlatformMediaSessionManager.h:
+ * platform/audio/PlatformMediaSessionManager.cpp:
+ (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
+ [UIApp isSuspendedUnderLock] is only valid when it is called when the
+ UIApplicationDidEnterBackgroundNotification is received. We need to force
+ interrupting the media sessions if the application isSuspendedUnderLock
+ and UIApplicationWillResignActiveNotification was ignored because of PiP.
+
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (-[WebMediaSessionHelper initWithCallback:]):
+ (-[WebMediaSessionHelper applicationDidEnterBackground:]): Listen to
+ UIApplicationDidEnterBackgroundNotification and make a call on the web
+ thread to PlatformMediaSessionManager::applicationDidEnterBackground()
+ and pass the isSuspendedUnderLock flag which is queried on the UIProcess.
+
</ins><span class="cx"> 2015-07-28 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Creating a TextIndicator causes the view to scroll to the current selection
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioPlatformMediaSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -79,13 +79,8 @@
</span><span class="cx"> m_state = state;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void PlatformMediaSession::beginInterruption(InterruptionType type)
</del><ins>+void PlatformMediaSession::doInterruption()
</ins><span class="cx"> {
</span><del>- LOG(Media, "PlatformMediaSession::beginInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);
-
- if (++m_interruptionCount > 1 || (type == EnteringBackground && client().overrideBackgroundPlaybackRestriction()))
- return;
-
</del><span class="cx"> m_stateToRestore = state();
</span><span class="cx"> m_notifyingClient = true;
</span><span class="cx"> setState(Interrupted);
</span><span class="lines">@@ -93,6 +88,40 @@
</span><span class="cx"> m_notifyingClient = false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool PlatformMediaSession::shouldDoInterruption(InterruptionType type)
+{
+ return type != EnteringBackground || !client().overrideBackgroundPlaybackRestriction();
+}
+
+void PlatformMediaSession::beginInterruption(InterruptionType type)
+{
+ LOG(Media, "PlatformMediaSession::beginInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);
+
+ if (++m_interruptionCount > 1 || !shouldDoInterruption(type))
+ return;
+
+ doInterruption();
+}
+
+void PlatformMediaSession::forceInterruption(InterruptionType type)
+{
+ LOG(Media, "PlatformMediaSession::forceInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);
+
+ // beginInterruption() must have been called before calling this function.
+ if (!m_interruptionCount) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ // The purpose of this function is to override the decision which was made by
+ // beginInterruption(). If it was decided to interrupt the media session there,
+ // then nothing should be done here.
+ if (shouldDoInterruption(type))
+ return;
+
+ doInterruption();
+}
+
</ins><span class="cx"> void PlatformMediaSession::endInterruption(EndInterruptionFlags flags)
</span><span class="cx"> {
</span><span class="cx"> LOG(Media, "PlatformMediaSession::endInterruption(%p) - flags = %i, stateToRestore = %s, interruption count = %i", this, (int)flags, stateName(m_stateToRestore), m_interruptionCount);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioPlatformMediaSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.h (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.h        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.h        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -79,11 +79,16 @@
</span><span class="cx"> NoFlags = 0,
</span><span class="cx"> MayResumePlaying = 1 << 0,
</span><span class="cx"> };
</span><ins>+
+ void doInterruption();
+ bool shouldDoInterruption(InterruptionType);
</ins><span class="cx"> void beginInterruption(InterruptionType);
</span><ins>+ void forceInterruption(InterruptionType);
</ins><span class="cx"> void endInterruption(EndInterruptionFlags);
</span><span class="cx">
</span><span class="cx"> void applicationWillEnterForeground() const;
</span><span class="cx"> void applicationWillEnterBackground() const;
</span><ins>+ void applicationDidEnterBackground(bool isSuspendedUnderLock) const;
</ins><span class="cx">
</span><span class="cx"> bool clientWillBeginPlayback();
</span><span class="cx"> bool clientWillPausePlayback();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioPlatformMediaSessionManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -283,6 +283,20 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void PlatformMediaSessionManager::applicationDidEnterBackground(bool isSuspendedUnderLock) const
+{
+ LOG(Media, "PlatformMediaSessionManager::applicationDidEnterBackground");
+
+ if (!isSuspendedUnderLock)
+ return;
+
+ Vector<PlatformMediaSession*> sessions = m_sessions;
+ for (auto* session : sessions) {
+ if (m_restrictions[session->mediaType()] & BackgroundProcessPlaybackRestricted)
+ session->forceInterruption(PlatformMediaSession::EnteringBackground);
+ }
+}
+
</ins><span class="cx"> void PlatformMediaSessionManager::applicationWillEnterForeground() const
</span><span class="cx"> {
</span><span class="cx"> LOG(Media, "PlatformMediaSessionManager::applicationWillEnterForeground");
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioPlatformMediaSessionManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void applicationWillEnterForeground() const;
</span><span class="cx"> WEBCORE_EXPORT void applicationWillEnterBackground() const;
</span><ins>+ WEBCORE_EXPORT void applicationDidEnterBackground(bool isSuspendedUnderLock) const;
</ins><span class="cx">
</span><span class="cx"> void stopAllMediaPlaybackForDocument(const Document*);
</span><span class="cx"> WEBCORE_EXPORT void stopAllMediaPlaybackForProcess();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> extern NSString* WebUIApplicationWillResignActiveNotification;
</span><span class="cx"> extern NSString* WebUIApplicationWillEnterForegroundNotification;
</span><span class="cx"> extern NSString* WebUIApplicationDidBecomeActiveNotification;
</span><ins>+extern NSString* WebUIApplicationDidEnterBackgroundNotification;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -61,11 +61,13 @@
</span><span class="cx"> SOFT_LINK_POINTER(UIKit, UIApplicationWillResignActiveNotification, NSString *)
</span><span class="cx"> SOFT_LINK_POINTER(UIKit, UIApplicationWillEnterForegroundNotification, NSString *)
</span><span class="cx"> SOFT_LINK_POINTER(UIKit, UIApplicationDidBecomeActiveNotification, NSString *)
</span><ins>+SOFT_LINK_POINTER(UIKit, UIApplicationDidEnterBackgroundNotification, NSString *)
</ins><span class="cx">
</span><span class="cx"> #define UIApplication getUIApplicationClass()
</span><span class="cx"> #define UIApplicationWillResignActiveNotification getUIApplicationWillResignActiveNotification()
</span><span class="cx"> #define UIApplicationWillEnterForegroundNotification getUIApplicationWillEnterForegroundNotification()
</span><span class="cx"> #define UIApplicationDidBecomeActiveNotification getUIApplicationDidBecomeActiveNotification()
</span><ins>+#define UIApplicationDidEnterBackgroundNotification getUIApplicationDidEnterBackgroundNotification()
</ins><span class="cx">
</span><span class="cx"> SOFT_LINK_FRAMEWORK(MediaPlayer)
</span><span class="cx"> SOFT_LINK_CLASS(MediaPlayer, MPAVRoutingController)
</span><span class="lines">@@ -87,6 +89,7 @@
</span><span class="cx"> WEBCORE_EXPORT NSString* WebUIApplicationWillResignActiveNotification = @"WebUIApplicationWillResignActiveNotification";
</span><span class="cx"> WEBCORE_EXPORT NSString* WebUIApplicationWillEnterForegroundNotification = @"WebUIApplicationWillEnterForegroundNotification";
</span><span class="cx"> WEBCORE_EXPORT NSString* WebUIApplicationDidBecomeActiveNotification = @"WebUIApplicationDidBecomeActiveNotification";
</span><ins>+WEBCORE_EXPORT NSString* WebUIApplicationDidEnterBackgroundNotification = @"WebUIApplicationDidEnterBackgroundNotification";
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="lines">@@ -103,6 +106,7 @@
</span><span class="cx"> - (void)interruption:(NSNotification *)notification;
</span><span class="cx"> - (void)applicationWillEnterForeground:(NSNotification *)notification;
</span><span class="cx"> - (void)applicationWillResignActive:(NSNotification *)notification;
</span><ins>+- (void)applicationDidEnterBackground:(NSNotification *)notification;
</ins><span class="cx"> - (BOOL)hasWirelessTargetsAvailable;
</span><span class="cx"> - (void)startMonitoringAirPlayRoutes;
</span><span class="cx"> - (void)stopMonitoringAirPlayRoutes;
</span><span class="lines">@@ -293,6 +297,8 @@
</span><span class="cx"> [center addObserver:self selector:@selector(applicationDidBecomeActive:) name:WebUIApplicationDidBecomeActiveNotification object:nil];
</span><span class="cx"> [center addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
</span><span class="cx"> [center addObserver:self selector:@selector(applicationWillResignActive:) name:WebUIApplicationWillResignActiveNotification object:nil];
</span><ins>+ [center addObserver:self selector:@selector(applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];
+ [center addObserver:self selector:@selector(applicationDidEnterBackground:) name:WebUIApplicationDidEnterBackgroundNotification object:nil];
</ins><span class="cx">
</span><span class="cx"> [self allocateVolumeView];
</span><span class="cx">
</span><span class="lines">@@ -448,7 +454,7 @@
</span><span class="cx"> WebThreadRun(^{
</span><span class="cx"> if (!_callback)
</span><span class="cx"> return;
</span><del>-
</del><ins>+
</ins><span class="cx"> _callback->applicationWillEnterBackground();
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="lines">@@ -469,6 +475,23 @@
</span><span class="cx"> _callback->externalOutputDeviceAvailableDidChange();
</span><span class="cx"> });
</span><span class="cx"> }
</span><ins>+
+- (void)applicationDidEnterBackground:(NSNotification *)notification
+{
+ if (!_callback)
+ return;
+
+ LOG(Media, "-[WebMediaSessionHelper applicationDidEnterBackground]");
+
+ BOOL isSuspendedUnderLock = [[[notification userInfo] objectForKey:@"isSuspendedUnderLock"] boolValue];
+
+ WebThreadRun(^{
+ if (!_callback)
+ return;
+
+ _callback->applicationDidEnterBackground(isSuspendedUnderLock);
+ });
+}
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebKit2/ChangeLog        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2015-07-28 Said Abou-Hallawa <sabouhallawa@apple.com>
+
+ [iOS] REGRESSION(r168075): Fullscreen web video doesn't pause on screen lock
+ https://bugs.webkit.org/show_bug.cgi?id=147269
+
+ Reviewed by Andreas Kling.
+
+ Media elements should pause when the application is going to EnterBackground
+ under lock regardless whether it is in full screen or not.
+
+ * Platform/spi/ios/UIKitSPI.h: Forward declare [UIApplication isSuspendedUnderLock].
+
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::applicationDidEnterBackground):
+ [UIApp isSuspendedUnderLock] can only be called in the UIProcess. We need
+ to call it here and pass it to the WebPage in the WebProcess as part of the
+ ApplicationDidEnterBackground message.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in: Add the new parameter:
+ 'isSuspendedUnderLock' to the ApplicationDidEnterBackground message.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::applicationDidEnterBackground): On iOS, the WebPage needs
+ to notify the MediaSessionManagerIOS that it received the message
+ ApplicationDidEnterBackground.
+
</ins><span class="cx"> 2015-07-28 Yongjun Zhang <yongjun_zhang@apple.com>
</span><span class="cx">
</span><span class="cx"> Bounds in InteractionInformationAtPosition should be always in main frame coordinate space.
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformspiiosUIKitSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -101,6 +101,7 @@
</span><span class="cx"> - (UIInterfaceOrientation)interfaceOrientation;
</span><span class="cx"> - (void)_cancelAllTouches;
</span><span class="cx"> - (CGFloat)statusBarHeight;
</span><ins>+- (BOOL)isSuspendedUnderLock;
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> typedef NS_ENUM(NSInteger, UIDatePickerPrivateMode) {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import "RemoteLayerTreeDrawingAreaProxy.h"
</span><span class="cx"> #import "RemoteLayerTreeDrawingAreaProxyMessages.h"
</span><span class="cx"> #import "RemoteLayerTreeTransaction.h"
</span><ins>+#import "UIKitSPI.h"
</ins><span class="cx"> #import "UserData.h"
</span><span class="cx"> #import "ViewUpdateDispatcherMessages.h"
</span><span class="cx"> #import "WKBrowsingContextControllerInternal.h"
</span><span class="lines">@@ -606,7 +607,8 @@
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::applicationDidEnterBackground()
</span><span class="cx"> {
</span><del>- m_process->send(Messages::WebPage::ApplicationDidEnterBackground(), m_pageID);
</del><ins>+ bool isSuspendedUnderLock = [UIApp isSuspendedUnderLock];
+ m_process->send(Messages::WebPage::ApplicationDidEnterBackground(isSuspendedUnderLock), m_pageID);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::applicationWillEnterForeground()
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -804,7 +804,7 @@
</span><span class="cx"> bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
</span><span class="cx"> void willStartUserTriggeredZooming();
</span><span class="cx"> void applicationWillResignActive();
</span><del>- void applicationDidEnterBackground();
</del><ins>+ void applicationDidEnterBackground(bool isSuspendedUnderLock);
</ins><span class="cx"> void applicationWillEnterForeground();
</span><span class="cx"> void applicationDidBecomeActive();
</span><span class="cx"> void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx"> SetAssistedNodeValueAsNumber(double value)
</span><span class="cx"> SetAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection)
</span><span class="cx"> ApplicationWillResignActive()
</span><del>- ApplicationDidEnterBackground()
</del><ins>+ ApplicationDidEnterBackground(bool isSuspendedUnderLock)
</ins><span class="cx"> ApplicationWillEnterForeground()
</span><span class="cx"> ApplicationDidBecomeActive()
</span><span class="cx"> ContentSizeCategoryDidChange(String contentSizeCategory)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (187521 => 187522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2015-07-28 22:22:14 UTC (rev 187521)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2015-07-28 22:29:54 UTC (rev 187522)
</span><span class="lines">@@ -2846,8 +2846,10 @@
</span><span class="cx"> m_volatilityTimer.stop();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPage::applicationDidEnterBackground()
</del><ins>+void WebPage::applicationDidEnterBackground(bool isSuspendedUnderLock)
</ins><span class="cx"> {
</span><ins>+ [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationDidEnterBackgroundNotification object:nil userInfo:@{@"isSuspendedUnderLock": [NSNumber numberWithBool:isSuspendedUnderLock]}];
+
</ins><span class="cx"> setLayerTreeStateIsFrozen(true);
</span><span class="cx"> if (markLayersVolatileImmediatelyIfPossible())
</span><span class="cx"> return;
</span></span></pre>
</div>
</div>
</body>
</html>