Diff
Modified: trunk/Source/WebCore/ChangeLog (185388 => 185389)
--- trunk/Source/WebCore/ChangeLog 2015-06-09 22:20:56 UTC (rev 185388)
+++ trunk/Source/WebCore/ChangeLog 2015-06-09 22:57:03 UTC (rev 185389)
@@ -1,3 +1,20 @@
+2015-06-09 Matt Rajca <[email protected]>
+
+ Implement MediaSessionManager to keep track of all MediaSessions.
+ https://bugs.webkit.org/show_bug.cgi?id=145806
+
+ Reviewed by Eric Carlson.
+
+ * Modules/mediasession/MediaSession.cpp:
+ (WebCore::MediaSession::MediaSession): Add ourselves to the MediaSessionManager upon construction.
+ (WebCore::MediaSession::~MediaSession): Remove ourselves from the MediaSessionManager before destruction.
+ * Modules/mediasession/MediaSessionManager.cpp: Added to keep track of all living MediaSessions.
+ (WebCore::MediaSessionManager::singleton):
+ (WebCore::MediaSessionManager::addMediaSession):
+ (WebCore::MediaSessionManager::removeMediaSession):
+ * Modules/mediasession/MediaSessionManager.h: Added.
+ * WebCore.xcodeproj/project.pbxproj: Added new MediaSessionManager sources.
+
2015-06-09 Ryuan Choi <[email protected]>
[CoordinatedGraphics] Remove RefCounted from Tile
Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp (185388 => 185389)
--- trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp 2015-06-09 22:20:56 UTC (rev 185388)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp 2015-06-09 22:57:03 UTC (rev 185389)
@@ -29,6 +29,7 @@
#if ENABLE(MEDIA_SESSION)
#include "HTMLMediaElement.h"
+#include "MediaSessionManager.h"
namespace WebCore {
@@ -37,10 +38,13 @@
{
if (m_kind == "content")
m_controls = adoptRef(*new MediaRemoteControls(context));
+
+ MediaSessionManager::singleton().addMediaSession(*this);
}
MediaSession::~MediaSession()
{
+ MediaSessionManager::singleton().removeMediaSession(*this);
}
MediaRemoteControls* MediaSession::controls(bool& isNull)
Copied: trunk/Source/WebCore/Modules/mediasession/MediaSessionManager.cpp (from rev 185388, trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp) (0 => 185389)
--- trunk/Source/WebCore/Modules/mediasession/MediaSessionManager.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSessionManager.cpp 2015-06-09 22:57:03 UTC (rev 185389)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MediaSessionManager.h"
+
+#if ENABLE(MEDIA_SESSION)
+
+#include "MediaSession.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+MediaSessionManager& MediaSessionManager::singleton()
+{
+ static NeverDestroyed<MediaSessionManager> manager;
+ return manager;
+}
+
+void MediaSessionManager::addMediaSession(MediaSession& session)
+{
+ m_sessions.add(&session);
+}
+
+void MediaSessionManager::removeMediaSession(MediaSession& session)
+{
+ m_sessions.remove(&session);
+}
+
+}
+
+#endif /* ENABLE(MEDIA_SESSION) */
Copied: trunk/Source/WebCore/Modules/mediasession/MediaSessionManager.h (from rev 185388, trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp) (0 => 185389)
--- trunk/Source/WebCore/Modules/mediasession/MediaSessionManager.h (rev 0)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSessionManager.h 2015-06-09 22:57:03 UTC (rev 185389)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaSessionManager_h
+#define MediaSessionManager_h
+
+#if ENABLE(MEDIA_SESSION)
+
+#include <wtf/HashSet.h>
+
+namespace WebCore {
+
+class MediaSession;
+
+class MediaSessionManager {
+public:
+ static MediaSessionManager& singleton();
+
+private:
+ friend class MediaSession;
+
+ void addMediaSession(MediaSession&);
+ void removeMediaSession(MediaSession&);
+
+ HashSet<MediaSession*> m_sessions;
+};
+
+} // namespace WebCore
+
+#endif /* ENABLE(MEDIA_SESSION) */
+
+#endif /* MediaSessionManager_h */
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (185388 => 185389)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-06-09 22:20:56 UTC (rev 185388)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-06-09 22:57:03 UTC (rev 185389)
@@ -5699,6 +5699,8 @@
C9027F421B1D0AD200BFBFEF /* MediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = C9027F401B1D0AD200BFBFEF /* MediaSession.h */; };
C90843CF1B18E47D00B68564 /* MediaRemoteControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C90843CD1B18E47D00B68564 /* MediaRemoteControls.cpp */; };
C90843D01B18E47D00B68564 /* MediaRemoteControls.h in Headers */ = {isa = PBXBuildFile; fileRef = C90843CE1B18E47D00B68564 /* MediaRemoteControls.h */; };
+ C90F65551B2253B1002163A1 /* MediaSessionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C90F65531B225396002163A1 /* MediaSessionManager.cpp */; };
+ C90F65561B2253BE002163A1 /* MediaSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C90F65541B225396002163A1 /* MediaSessionManager.h */; };
C937FE8D1B1F6821008ECC5D /* HTMLMediaElementMediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = C968B2E61B1E72F700EF1F81 /* HTMLMediaElementMediaSession.h */; };
C968B2E81B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C968B2E71B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp */; };
C9DADBCB1B1D3B97001F17D8 /* JSMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9DADBC91B1D3B25001F17D8 /* JSMediaSession.cpp */; };
@@ -13270,6 +13272,8 @@
C9027F401B1D0AD200BFBFEF /* MediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSession.h; sourceTree = "<group>"; };
C90843CD1B18E47D00B68564 /* MediaRemoteControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaRemoteControls.cpp; sourceTree = "<group>"; };
C90843CE1B18E47D00B68564 /* MediaRemoteControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaRemoteControls.h; sourceTree = "<group>"; };
+ C90F65531B225396002163A1 /* MediaSessionManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSessionManager.cpp; sourceTree = "<group>"; };
+ C90F65541B225396002163A1 /* MediaSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManager.h; sourceTree = "<group>"; };
C93458BB1B18D77E0088EE12 /* MediaRemoteControls.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaRemoteControls.idl; sourceTree = "<group>"; };
C968B2E51B1E704500EF1F81 /* HTMLMediaElementMediaSession.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLMediaElementMediaSession.idl; sourceTree = "<group>"; };
C968B2E61B1E72F700EF1F81 /* HTMLMediaElementMediaSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTMLMediaElementMediaSession.h; sourceTree = "<group>"; };
@@ -14628,6 +14632,8 @@
C9027F3F1B1D0AD200BFBFEF /* MediaSession.cpp */,
C9027F401B1D0AD200BFBFEF /* MediaSession.h */,
C9027F3E1B1D0AB900BFBFEF /* MediaSession.idl */,
+ C90F65531B225396002163A1 /* MediaSessionManager.cpp */,
+ C90F65541B225396002163A1 /* MediaSessionManager.h */,
0709D78C1AE55554004E42F8 /* WebMediaSessionManager.cpp */,
0709D78D1AE55554004E42F8 /* WebMediaSessionManager.h */,
0709D7941AE55A29004E42F8 /* WebMediaSessionManagerClient.h */,
@@ -25867,6 +25873,7 @@
CEEFCD7A19DB31F7003876D7 /* MediaResourceLoader.h in Headers */,
CDBEAEAD19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h in Headers */,
C9027F421B1D0AD200BFBFEF /* MediaSession.h in Headers */,
+ C90F65561B2253BE002163A1 /* MediaSessionManager.h in Headers */,
07638A991884487200E15A1B /* MediaSessionManagerIOS.h in Headers */,
CD3A495F17A9D01B00274E42 /* MediaSource.h in Headers */,
CD641EB31818F5ED00EE4C41 /* MediaSourcePrivate.h in Headers */,
@@ -29456,6 +29463,7 @@
CEEFCD7919DB31F7003876D7 /* MediaResourceLoader.cpp in Sources */,
CDBEAEAC19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.mm in Sources */,
C9027F411B1D0AD200BFBFEF /* MediaSession.cpp in Sources */,
+ C90F65551B2253B1002163A1 /* MediaSessionManager.cpp in Sources */,
07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */,
07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.cpp in Sources */,
CD3A495E17A9D01B00274E42 /* MediaSource.cpp in Sources */,