Diff
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (192971 => 192972)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-12-02 23:01:23 UTC (rev 192971)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-12-02 23:04:01 UTC (rev 192972)
@@ -1,3 +1,28 @@
+2015-12-01 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r187544. rdar://problem/23395970
+
+ 2015-07-29 Chris Dumez <cdu...@apple.com>
+
+ Avoid unnecessarily constructing PlatformMediaSessionManager on Document destruction
+ https://bugs.webkit.org/show_bug.cgi?id=147398
+
+ Reviewed by Jer Noble.
+
+ Only call PlatformMediaSessionManager::stopAllMediaPlaybackForProcess() in
+ destructors if an PlatformMediaSessionManager instance already exists, to
+ avoid constructing one unecessarily at that point.
+
+ * dom/Document.cpp:
+ (WebCore::Document::~Document):
+ * platform/audio/PlatformMediaSessionManager.cpp:
+ (WebCore::PlatformMediaSessionManager::sharedManager):
+ (WebCore::PlatformMediaSessionManager::sharedManagerIfExists):
+ * platform/audio/PlatformMediaSessionManager.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::PlatformMediaSessionManager::sharedManager):
+ (WebCore::PlatformMediaSessionManager::sharedManagerIfExists):
+
2015-12-01 Babak Shafiei <bshaf...@apple.com>
Merge r192709.
Modified: branches/safari-601.1.46-branch/Source/WebCore/dom/Document.cpp (192971 => 192972)
--- branches/safari-601.1.46-branch/Source/WebCore/dom/Document.cpp 2015-12-02 23:01:23 UTC (rev 192971)
+++ branches/safari-601.1.46-branch/Source/WebCore/dom/Document.cpp 2015-12-02 23:04:01 UTC (rev 192972)
@@ -633,7 +633,8 @@
if (m_cachedResourceLoader->document() == this)
m_cachedResourceLoader->setDocument(nullptr);
- PlatformMediaSessionManager::sharedManager().stopAllMediaPlaybackForDocument(this);
+ if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists())
+ platformMediaSessionManager->stopAllMediaPlaybackForDocument(this);
// We must call clearRareData() here since a Document class inherits TreeScope
// as well as Node. See a comment on TreeScope.h for the reason.
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (192971 => 192972)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2015-12-02 23:01:23 UTC (rev 192971)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2015-12-02 23:04:01 UTC (rev 192972)
@@ -37,11 +37,19 @@
namespace WebCore {
#if !PLATFORM(IOS)
+static PlatformMediaSessionManager* platformMediaSessionManager = nullptr;
+
PlatformMediaSessionManager& PlatformMediaSessionManager::sharedManager()
{
- DEPRECATED_DEFINE_STATIC_LOCAL(PlatformMediaSessionManager, manager, ());
- return manager;
+ if (!platformMediaSessionManager)
+ platformMediaSessionManager = new PlatformMediaSessionManager;
+ return *platformMediaSessionManager;
}
+
+PlatformMediaSessionManager* PlatformMediaSessionManager::sharedManagerIfExists()
+{
+ return platformMediaSessionManager;
+}
#endif
PlatformMediaSessionManager::PlatformMediaSessionManager()
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (192971 => 192972)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2015-12-02 23:01:23 UTC (rev 192971)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2015-12-02 23:04:01 UTC (rev 192972)
@@ -44,6 +44,7 @@
class PlatformMediaSessionManager : private RemoteCommandListenerClient, private SystemSleepListener::Client, private AudioHardwareListener::Client {
WTF_MAKE_FAST_ALLOCATED;
public:
+ WEBCORE_EXPORT static PlatformMediaSessionManager* sharedManagerIfExists();
WEBCORE_EXPORT static PlatformMediaSessionManager& sharedManager();
virtual ~PlatformMediaSessionManager() { }
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (192971 => 192972)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-12-02 23:01:23 UTC (rev 192971)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-12-02 23:04:01 UTC (rev 192972)
@@ -114,12 +114,20 @@
namespace WebCore {
+static MediaSessionManageriOS* platformMediaSessionManager = nullptr;
+
PlatformMediaSessionManager& PlatformMediaSessionManager::sharedManager()
{
- DEPRECATED_DEFINE_STATIC_LOCAL(MediaSessionManageriOS, manager, ());
- return manager;
+ if (!platformMediaSessionManager)
+ platformMediaSessionManager = new MediaSessionManageriOS;
+ return *platformMediaSessionManager;
}
+PlatformMediaSessionManager* PlatformMediaSessionManager::sharedManagerIfExists()
+{
+ return platformMediaSessionManager;
+}
+
MediaSessionManageriOS::MediaSessionManageriOS()
: PlatformMediaSessionManager()
, m_objcObserver(adoptNS([[WebMediaSessionHelper alloc] initWithCallback:this]))
Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (192971 => 192972)
--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-12-02 23:01:23 UTC (rev 192971)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-12-02 23:04:01 UTC (rev 192972)
@@ -1,3 +1,21 @@
+2015-12-01 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r187544. rdar://problem/23395970
+
+ 2015-07-29 Chris Dumez <cdu...@apple.com>
+
+ Avoid unnecessarily constructing PlatformMediaSessionManager on Document destruction
+ https://bugs.webkit.org/show_bug.cgi?id=147398
+
+ Reviewed by Jer Noble.
+
+ Only call PlatformMediaSessionManager::stopAllMediaPlaybackForProcess() in
+ destructors if an PlatformMediaSessionManager instance already exists, to
+ avoid constructing one unecessarily at that point.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::didClose):
+
2015-12-01 Babak Shafiei <bshaf...@apple.com>
Merge r192742.
Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebProcess.cpp (192971 => 192972)
--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebProcess.cpp 2015-12-02 23:01:23 UTC (rev 192971)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebProcess.cpp 2015-12-02 23:04:01 UTC (rev 192972)
@@ -660,7 +660,8 @@
#endif
// FIXME(146657): This explicit media stop command should not be necessary
- PlatformMediaSessionManager::sharedManager().stopAllMediaPlaybackForProcess();
+ if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists())
+ platformMediaSessionManager->stopAllMediaPlaybackForProcess();
// The UI process closed this connection, shut down.
stopRunLoop();