Diff
Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (191170 => 191171)
--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-10-16 06:29:02 UTC (rev 191171)
@@ -1,5 +1,23 @@
2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+ Merge r190604. rdar://problem/22993012
+
+ 2015-10-05 Jer Noble <jer.no...@apple.com>
+
+ [iOS] REGRESSION(r190434): Media continues to play when locking screen
+ https://bugs.webkit.org/show_bug.cgi?id=149822
+
+ Reviewed by Brent Fulgham.
+
+ applicationWillEnterForeground() -> applicationDidEnterForeground().
+
+ * media/video-background-playback-expected.txt:
+ * media/video-background-playback.html:
+ * media/video-background-tab-playback-expected.txt:
+ * media/video-background-tab-playback.html:
+
+2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+
Merge r190438. rdar://problem/22865007
2015-10-01 Brent Fulgham <bfulg...@apple.com>
Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-background-playback-expected.txt (191170 => 191171)
--- branches/safari-601.1.46-branch/LayoutTests/media/video-background-playback-expected.txt 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-background-playback-expected.txt 2015-10-16 06:29:02 UTC (rev 191171)
@@ -21,7 +21,7 @@
EXPECTED (audio.paused == 'false') OK
** Simulate switch back to foreground, video should resume.
-RUN(internals.applicationWillEnterForeground())
+RUN(internals.applicationDidEnterForeground())
EVENT(playing)
Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-background-playback.html (191170 => 191171)
--- branches/safari-601.1.46-branch/LayoutTests/media/video-background-playback.html 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-background-playback.html 2015-10-16 06:29:02 UTC (rev 191171)
@@ -23,7 +23,7 @@
testExpected("audio.paused", false);
state = "foreground";
consoleWrite("<br>** Simulate switch back to foreground, video should resume.");
- run("internals.applicationWillEnterForeground()");
+ run("internals.applicationDidEnterForeground()");
setTimeout(checkState, 100);
consoleWrite("");
break;
Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-background-tab-playback-expected.txt (191170 => 191171)
--- branches/safari-601.1.46-branch/LayoutTests/media/video-background-tab-playback-expected.txt 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-background-tab-playback-expected.txt 2015-10-16 06:29:02 UTC (rev 191171)
@@ -16,7 +16,7 @@
EXPECTED (video.paused == 'true') OK
** Simulate switch back to foreground, video should remain paused.
-RUN(internals.applicationWillEnterForeground())
+RUN(internals.applicationDidEnterForeground())
** 100ms timer fired...
Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-background-tab-playback.html (191170 => 191171)
--- branches/safari-601.1.46-branch/LayoutTests/media/video-background-tab-playback.html 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-background-tab-playback.html 2015-10-16 06:29:02 UTC (rev 191171)
@@ -13,7 +13,7 @@
testExpected("video.paused", true);
state = "foreground";
consoleWrite("<br>** Simulate switch back to foreground, video should remain paused.");
- run("internals.applicationWillEnterForeground()");
+ run("internals.applicationDidEnterForeground()");
setTimeout(checkState, 100);
consoleWrite("");
break;
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-10-16 06:29:02 UTC (rev 191171)
@@ -1,5 +1,47 @@
2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+ Merge r190604. rdar://problem/22993012
+
+ 2015-10-05 Jer Noble <jer.no...@apple.com>
+
+ [iOS] REGRESSION(r190434): Media continues to play when locking screen
+ https://bugs.webkit.org/show_bug.cgi?id=149822
+
+ Reviewed by Brent Fulgham.
+
+ In MediaSessionManagerIOS.mm, both -applicationWillEnterForeground: and
+ -applicationDidBecomeActive: called
+ PlatformMediaSessionManager::applicationWillEnterForeground(), leading to the
+ PlatformMediaSession's m_interruptionCount becoming increasingly unbalanced.
+
+ Rename PlatformMediaSessionManager::applicationWillEnterForeground() to
+ applicationDidEnterForeground() to more correctly reflect when this notification will be
+ called. Add a new method, MediaSessionManagerIOS::applicationWillEnterForeground(bool),
+ whose paramater is whether the screen was locked. This allows the beginInterruption() and
+ endInterruption() methods to be correctly balanced.
+
+ Drive-by fix: remove the unimplemented declarations for application{will,did}Enter{Fore,Back}ground()
+ from PlatformMediaSession.h.
+
+ * platform/audio/PlatformMediaSession.h:
+ * platform/audio/PlatformMediaSessionManager.cpp:
+ (WebCore::PlatformMediaSessionManager::applicationDidEnterForeground):
+ (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground): Deleted.
+ * platform/audio/PlatformMediaSessionManager.h:
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::applicationDidEnterBackground):
+ (WebCore::MediaSessionManageriOS::applicationWillEnterForeground):
+ (-[WebMediaSessionHelper applicationWillEnterForeground:]):
+ (-[WebMediaSessionHelper applicationDidBecomeActive:]):
+ * testing/Internals.cpp:
+ (WebCore::Internals::applicationDidEnterForeground):
+ (WebCore::Internals::applicationWillEnterForeground): Deleted.
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
+2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+
Merge r190447. rdar://problem/22865007
2015-10-01 Jaehun Lim <ljaehun....@samsung.com>
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2015-10-16 06:29:02 UTC (rev 191171)
@@ -84,10 +84,6 @@
void beginInterruption(InterruptionType);
void endInterruption(EndInterruptionFlags);
- void applicationWillEnterForeground() const;
- void applicationWillEnterBackground() const;
- void applicationDidEnterBackground(bool isSuspendedUnderLock) const;
-
bool clientWillBeginPlayback();
bool clientWillPausePlayback();
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2015-10-16 06:29:02 UTC (rev 191171)
@@ -289,9 +289,9 @@
}
}
-void PlatformMediaSessionManager::applicationWillEnterForeground() const
+void PlatformMediaSessionManager::applicationDidEnterForeground() const
{
- LOG(Media, "PlatformMediaSessionManager::applicationWillEnterForeground");
+ LOG(Media, "PlatformMediaSessionManager::applicationDidEnterForeground");
if (!m_isApplicationInBackground)
return;
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2015-10-16 06:29:02 UTC (rev 191171)
@@ -54,7 +54,7 @@
WEBCORE_EXPORT void beginInterruption(PlatformMediaSession::InterruptionType);
WEBCORE_EXPORT void endInterruption(PlatformMediaSession::EndInterruptionFlags);
- WEBCORE_EXPORT void applicationWillEnterForeground() const;
+ WEBCORE_EXPORT void applicationDidEnterForeground() const;
WEBCORE_EXPORT void applicationWillEnterBackground() const;
void stopAllMediaPlaybackForDocument(const Document*);
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2015-10-16 06:29:02 UTC (rev 191171)
@@ -49,6 +49,7 @@
void externalOutputDeviceAvailableDidChange();
virtual bool hasWirelessTargetsAvailable() override;
void applicationDidEnterBackground(bool isSuspendedUnderLock);
+ void applicationWillEnterForeground(bool isSuspendedUnderLock);
private:
friend class PlatformMediaSessionManager;
@@ -67,6 +68,7 @@
virtual bool sessionCanLoadMedia(const PlatformMediaSession&) const override;
RetainPtr<WebMediaSessionHelper> m_objcObserver;
+ bool m_isInBackground { false };
};
} // namespace WebCore
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-10-16 06:29:02 UTC (rev 191171)
@@ -252,6 +252,10 @@
{
LOG(Media, "MediaSessionManageriOS::applicationDidEnterBackground");
+ if (m_isInBackground)
+ return;
+ m_isInBackground = true;
+
if (!isSuspendedUnderLock)
return;
@@ -262,7 +266,24 @@
}
}
+void MediaSessionManageriOS::applicationWillEnterForeground(bool isSuspendedUnderLock)
+{
+ LOG(Media, "MediaSessionManageriOS::applicationWillEnterForeground");
+ if (!m_isInBackground)
+ return;
+ m_isInBackground = false;
+
+ if (!isSuspendedUnderLock)
+ return;
+
+ Vector<PlatformMediaSession*> sessions = this->sessions();
+ for (auto* session : sessions) {
+ if (restrictions(session->mediaType()) & BackgroundProcessPlaybackRestricted)
+ session->endInterruption(PlatformMediaSession::MayResumePlaying);
+ }
+}
+
} // namespace WebCore
@implementation WebMediaSessionHelper
@@ -432,11 +453,13 @@
LOG(Media, "-[WebMediaSessionHelper applicationWillEnterForeground]");
+ BOOL isSuspendedUnderLock = [[[notification userInfo] objectForKey:@"isSuspendedUnderLock"] boolValue];
+
WebThreadRun(^{
if (!_callback)
return;
- _callback->applicationWillEnterForeground();
+ _callback->applicationWillEnterForeground(isSuspendedUnderLock);
});
}
@@ -453,7 +476,7 @@
if (!_callback)
return;
- _callback->applicationWillEnterForeground();
+ _callback->applicationDidEnterForeground();
});
}
Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp 2015-10-16 06:29:02 UTC (rev 191171)
@@ -2642,9 +2642,9 @@
PlatformMediaSessionManager::sharedManager().endInterruption(flags);
}
-void Internals::applicationWillEnterForeground() const
+void Internals::applicationDidEnterForeground() const
{
- PlatformMediaSessionManager::sharedManager().applicationWillEnterForeground();
+ PlatformMediaSessionManager::sharedManager().applicationDidEnterForeground();
}
void Internals::applicationWillEnterBackground() const
Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h 2015-10-16 06:29:02 UTC (rev 191171)
@@ -384,7 +384,7 @@
#if ENABLE(VIDEO)
void beginMediaSessionInterruption(const String&, ExceptionCode&);
void endMediaSessionInterruption(const String&);
- void applicationWillEnterForeground() const;
+ void applicationDidEnterForeground() const;
void applicationWillEnterBackground() const;
void setMediaSessionRestrictions(const String& mediaType, const String& restrictions, ExceptionCode&);
void setMediaElementRestrictions(HTMLMediaElement*, const String& restrictions, ExceptionCode&);
Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl 2015-10-16 06:29:02 UTC (rev 191171)
@@ -351,7 +351,7 @@
[Conditional=VIDEO, RaisesException] void beginMediaSessionInterruption(DOMString interruptionType);
[Conditional=VIDEO] void endMediaSessionInterruption(DOMString flags);
- [Conditional=VIDEO] void applicationWillEnterForeground();
+ [Conditional=VIDEO] void applicationDidEnterForeground();
[Conditional=VIDEO] void applicationWillEnterBackground();
[Conditional=VIDEO, RaisesException] void setMediaSessionRestrictions(DOMString mediaType, DOMString restrictions);
[Conditional=VIDEO, RaisesException] void setMediaElementRestrictions(HTMLMediaElement element, DOMString restrictions);
Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-10-16 06:29:02 UTC (rev 191171)
@@ -1,5 +1,27 @@
2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+ Merge r190604. rdar://problem/22993012
+
+ 2015-10-05 Jer Noble <jer.no...@apple.com>
+
+ [iOS] REGRESSION(r190434): Media continues to play when locking screen
+ https://bugs.webkit.org/show_bug.cgi?id=149822
+
+ Reviewed by Brent Fulgham.
+
+ Pass through isSuspendedUnderLock when notifying the WebPage that the
+ applicationWillEnterForeground, and pass that boolean in the userInfo of the
+ WebUIApplicationWillEnterForegroundNotification.
+
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::applicationWillEnterForeground):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::applicationWillEnterForeground):
+
+2015-10-15 Matthew Hanson <matthew_han...@apple.com>
+
Rollout r188486. rdar://problem/22707497
2015-10-14 Matthew Hanson <matthew_han...@apple.com>
Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2015-10-16 06:29:02 UTC (rev 191171)
@@ -614,7 +614,8 @@
void WebPageProxy::applicationWillEnterForeground()
{
- m_process->send(Messages::WebPage::ApplicationWillEnterForeground(), m_pageID);
+ bool isSuspendedUnderLock = [UIApp isSuspendedUnderLock];
+ m_process->send(Messages::WebPage::ApplicationWillEnterForeground(isSuspendedUnderLock), m_pageID);
}
void WebPageProxy::applicationWillResignActive()
Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-10-16 06:29:02 UTC (rev 191171)
@@ -801,7 +801,7 @@
void willStartUserTriggeredZooming();
void applicationWillResignActive();
void applicationDidEnterBackground(bool isSuspendedUnderLock);
- void applicationWillEnterForeground();
+ void applicationWillEnterForeground(bool isSuspendedUnderLock);
void applicationDidBecomeActive();
void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
void completePendingSyntheticClickForContentChangeObserver();
Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2015-10-16 06:29:02 UTC (rev 191171)
@@ -90,7 +90,7 @@
SetAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection)
ApplicationWillResignActive()
ApplicationDidEnterBackground(bool isSuspendedUnderLock)
- ApplicationWillEnterForeground()
+ ApplicationWillEnterForeground(bool isSuspendedUnderLock)
ApplicationDidBecomeActive()
ContentSizeCategoryDidChange(String contentSizeCategory)
ExecuteEditCommandWithCallback(String name, uint64_t callbackID)
Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (191170 => 191171)
--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-10-16 06:28:57 UTC (rev 191170)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-10-16 06:29:02 UTC (rev 191171)
@@ -2857,12 +2857,12 @@
m_volatilityTimer.startRepeating(std::chrono::milliseconds(200));
}
-void WebPage::applicationWillEnterForeground()
+void WebPage::applicationWillEnterForeground(bool isSuspendedUnderLock)
{
m_volatilityTimer.stop();
setLayerTreeStateIsFrozen(false);
- [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationWillEnterForegroundNotification object:nil];
+ [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationWillEnterForegroundNotification object:nil userInfo:@{@"isSuspendedUnderLock": @(isSuspendedUnderLock)}];
}
void WebPage::applicationDidBecomeActive()