Title: [185126] trunk/Source/WebCore
Revision
185126
Author
commit-qu...@webkit.org
Date
2015-06-02 14:54:13 -0700 (Tue, 02 Jun 2015)

Log Message

Added a stub implementation of MediaSession, part of the Media Session spec.
https://bugs.webkit.org/show_bug.cgi?id=145530

Patch by Matt Rajca <mra...@apple.com> on 2015-06-02
Reviewed by Eric Carlson.

* CMakeLists.txt: Added new MediaSession sources.
* DerivedSources.make:
* Modules/mediasession/MediaSession.cpp: Added stub implementation.
(WebCore::MediaSession::MediaSession): Per the Media Session spec, a Media Remote Controls object should only be
  set for 'content' sessions; it is null otherwise.
(WebCore::MediaSession::~MediaSession):
(WebCore::MediaSession::controls):
(WebCore::MediaSession::releaseSession):
* Modules/mediasession/MediaSession.h: Added basic translation of IDL file.
* Modules/mediasession/MediaSession.idl: Added from the Media Session spec.
* WebCore.xcodeproj/project.pbxproj: Added new MediaSession sources.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (185125 => 185126)


--- trunk/Source/WebCore/CMakeLists.txt	2015-06-02 21:37:36 UTC (rev 185125)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-06-02 21:54:13 UTC (rev 185126)
@@ -219,6 +219,7 @@
     Modules/mediacontrols/MediaControlsHost.idl
 
     Modules/mediasession/MediaRemoteControls.idl
+    Modules/mediasession/MediaSession.idl
 
     Modules/mediasource/DOMURLMediaSource.idl
     Modules/mediasource/MediaSource.idl
@@ -874,6 +875,7 @@
     Modules/mediacontrols/MediaControlsHost.cpp
 
     Modules/mediasession/MediaRemoteControls.cpp
+    Modules/mediasession/MediaSession.cpp
 
     Modules/mediasource/DOMURLMediaSource.cpp
     Modules/mediasource/MediaSource.cpp

Modified: trunk/Source/WebCore/ChangeLog (185125 => 185126)


--- trunk/Source/WebCore/ChangeLog	2015-06-02 21:37:36 UTC (rev 185125)
+++ trunk/Source/WebCore/ChangeLog	2015-06-02 21:54:13 UTC (rev 185126)
@@ -1,3 +1,22 @@
+2015-06-02  Matt Rajca  <mra...@apple.com>
+
+        Added a stub implementation of MediaSession, part of the Media Session spec.
+        https://bugs.webkit.org/show_bug.cgi?id=145530
+
+        Reviewed by Eric Carlson.
+
+        * CMakeLists.txt: Added new MediaSession sources.
+        * DerivedSources.make:
+        * Modules/mediasession/MediaSession.cpp: Added stub implementation.
+        (WebCore::MediaSession::MediaSession): Per the Media Session spec, a Media Remote Controls object should only be
+          set for 'content' sessions; it is null otherwise.
+        (WebCore::MediaSession::~MediaSession):
+        (WebCore::MediaSession::controls):
+        (WebCore::MediaSession::releaseSession):
+        * Modules/mediasession/MediaSession.h: Added basic translation of IDL file.
+        * Modules/mediasession/MediaSession.idl: Added from the Media Session spec.
+        * WebCore.xcodeproj/project.pbxproj: Added new MediaSession sources.
+
 2015-06-02  Zalan Bujtas  <za...@apple.com>
 
         Backdrop filter is pulling in content from behind the window.

Modified: trunk/Source/WebCore/DerivedSources.make (185125 => 185126)


--- trunk/Source/WebCore/DerivedSources.make	2015-06-02 21:37:36 UTC (rev 185125)
+++ trunk/Source/WebCore/DerivedSources.make	2015-06-02 21:54:13 UTC (rev 185126)
@@ -105,6 +105,7 @@
     $(WebCore)/Modules/indieui/UIRequestEvent.idl \
     $(WebCore)/Modules/mediacontrols/MediaControlsHost.idl \
     $(WebCore)/Modules/mediasession/MediaRemoteControls.idl \
+    $(WebCore)/Modules/mediasession/MediaSession.idl \
 	$(WebCore)/Modules/mediasource/DOMURLMediaSource.idl \
 	$(WebCore)/Modules/mediasource/AudioTrackMediaSource.idl \
 	$(WebCore)/Modules/mediasource/MediaSource.idl \

Added: trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp (0 => 185126)


--- trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp	2015-06-02 21:54:13 UTC (rev 185126)
@@ -0,0 +1,57 @@
+/*
+ * 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 "MediaSession.h"
+
+#if ENABLE(MEDIA_SESSION)
+
+namespace WebCore {
+
+MediaSession::MediaSession(ScriptExecutionContext& context, const String& kind)
+    : m_kind(kind)
+{
+    if (m_kind == "content")
+        m_controls = adoptRef(*new MediaRemoteControls(context));
+}
+
+MediaSession::~MediaSession()
+{
+}
+
+MediaRemoteControls* MediaSession::controls(bool& isNull)
+{
+    MediaRemoteControls* controls = m_controls.get();
+    isNull = !controls;
+    return controls;
+}
+
+void MediaSession::releaseSession()
+{
+}
+
+}
+
+#endif /* ENABLE(MEDIA_SESSION) */

Added: trunk/Source/WebCore/Modules/mediasession/MediaSession.h (0 => 185126)


--- trunk/Source/WebCore/Modules/mediasession/MediaSession.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.h	2015-06-02 21:54:13 UTC (rev 185126)
@@ -0,0 +1,59 @@
+/*
+ * 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 MediaSession_h
+#define MediaSession_h
+
+#if ENABLE(MEDIA_SESSION)
+
+#include "MediaRemoteControls.h"
+
+namespace WebCore {
+
+class MediaSession final : public RefCounted<MediaSession> {
+public:
+    static Ref<MediaSession> create(ScriptExecutionContext& context, const String& kind)
+    {
+        return adoptRef(*new MediaSession(context, kind));
+    }
+
+    MediaSession(ScriptExecutionContext&, const String&);
+    ~MediaSession();
+
+    String kind() const { return m_kind; }
+    MediaRemoteControls* controls(bool& isNull);
+
+    void releaseSession();
+
+private:
+    const String m_kind;
+    RefPtr<MediaRemoteControls> m_controls;
+};
+
+} // namespace WebCore
+
+#endif /* ENABLE(MEDIA_SESSION) */
+
+#endif /* MediaSession_h */

Added: trunk/Source/WebCore/Modules/mediasession/MediaSession.idl (0 => 185126)


--- trunk/Source/WebCore/Modules/mediasession/MediaSession.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.idl	2015-06-02 21:54:13 UTC (rev 185126)
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+[
+    Conditional=MEDIA_SESSION,
+    Constructor(MediaSessionKind kind),
+    ConstructorCallWith=ScriptExecutionContext,
+    ImplementationLacksVTable,
+] interface MediaSession {
+    readonly attribute MediaSessionKind kind;
+    readonly attribute MediaRemoteControls? controls;
+
+    void releaseSession();
+};
+
+enum MediaSessionKind {
+    "content",
+    "transient",
+    "transient-solo",
+    "ambient"
+};

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (185125 => 185126)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-06-02 21:37:36 UTC (rev 185125)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-06-02 21:54:13 UTC (rev 185126)
@@ -5691,8 +5691,11 @@
 		C6F420A216B7164E0052A9F2 /* JSMutationCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F420A016B7164E0052A9F2 /* JSMutationCallback.cpp */; };
 		C6F420A316B7164E0052A9F2 /* JSMutationCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F420A116B7164E0052A9F2 /* JSMutationCallback.h */; };
 		C9026B651B1CF5FE001D99A7 /* JSMediaRemoteControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9026B631B1CF5AB001D99A7 /* JSMediaRemoteControls.cpp */; };
+		C9027F411B1D0AD200BFBFEF /* MediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9027F3F1B1D0AD200BFBFEF /* MediaSession.cpp */; };
+		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 */; };
+		C9DADBCB1B1D3B97001F17D8 /* JSMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9DADBC91B1D3B25001F17D8 /* JSMediaSession.cpp */; };
 		CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
 		CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */; };
@@ -13252,9 +13255,14 @@
 		C6F420A116B7164E0052A9F2 /* JSMutationCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMutationCallback.h; sourceTree = "<group>"; };
 		C9026B631B1CF5AB001D99A7 /* JSMediaRemoteControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaRemoteControls.cpp; sourceTree = "<group>"; };
 		C9026B641B1CF5AB001D99A7 /* JSMediaRemoteControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaRemoteControls.h; sourceTree = "<group>"; };
+		C9027F3E1B1D0AB900BFBFEF /* MediaSession.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaSession.idl; sourceTree = "<group>"; };
+		C9027F3F1B1D0AD200BFBFEF /* MediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSession.cpp; sourceTree = "<group>"; };
+		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>"; };
 		C93458BB1B18D77E0088EE12 /* MediaRemoteControls.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaRemoteControls.idl; sourceTree = "<group>"; };
+		C9DADBC91B1D3B25001F17D8 /* JSMediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaSession.cpp; sourceTree = "<group>"; };
+		C9DADBCA1B1D3B25001F17D8 /* JSMediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaSession.h; sourceTree = "<group>"; };
 		CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = "<group>"; };
 		CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
 		CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAspectRatioValue.cpp; sourceTree = "<group>"; };
@@ -14601,6 +14609,9 @@
 				C90843CD1B18E47D00B68564 /* MediaRemoteControls.cpp */,
 				C90843CE1B18E47D00B68564 /* MediaRemoteControls.h */,
 				C93458BB1B18D77E0088EE12 /* MediaRemoteControls.idl */,
+				C9027F3F1B1D0AD200BFBFEF /* MediaSession.cpp */,
+				C9027F401B1D0AD200BFBFEF /* MediaSession.h */,
+				C9027F3E1B1D0AB900BFBFEF /* MediaSession.idl */,
 				0709D78C1AE55554004E42F8 /* WebMediaSessionManager.cpp */,
 				0709D78D1AE55554004E42F8 /* WebMediaSessionManager.h */,
 				0709D7941AE55A29004E42F8 /* WebMediaSessionManagerClient.h */,
@@ -19224,6 +19235,8 @@
 				CDB859F9160D493E00E5B07F /* JSMediaKeyEvent.h */,
 				C9026B631B1CF5AB001D99A7 /* JSMediaRemoteControls.cpp */,
 				C9026B641B1CF5AB001D99A7 /* JSMediaRemoteControls.h */,
+				C9DADBC91B1D3B25001F17D8 /* JSMediaSession.cpp */,
+				C9DADBCA1B1D3B25001F17D8 /* JSMediaSession.h */,
 				7E46F6F81627A2C900062223 /* JSOESElementIndexUint.cpp */,
 				7E46F6F91627A2C900062223 /* JSOESElementIndexUint.h */,
 				9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */,
@@ -25830,6 +25843,7 @@
 				C90843D01B18E47D00B68564 /* MediaRemoteControls.h in Headers */,
 				CEEFCD7A19DB31F7003876D7 /* MediaResourceLoader.h in Headers */,
 				CDBEAEAD19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h in Headers */,
+				C9027F421B1D0AD200BFBFEF /* MediaSession.h in Headers */,
 				07F944161864D046005D31CB /* MediaSessionManager.h in Headers */,
 				07638A991884487200E15A1B /* MediaSessionManagerIOS.h in Headers */,
 				CD3A495F17A9D01B00274E42 /* MediaSource.h in Headers */,
@@ -28926,6 +28940,7 @@
 				D3A94A46122DC40F00A37BBC /* JSMediaQueryList.cpp in Sources */,
 				7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */,
 				C9026B651B1CF5FE001D99A7 /* JSMediaRemoteControls.cpp in Sources */,
+				C9DADBCB1B1D3B97001F17D8 /* JSMediaSession.cpp in Sources */,
 				CD9DE17417AAC74C00EA386D /* JSMediaSource.cpp in Sources */,
 				07C59B7117F79C7C000FBCBB /* JSMediaSourceStates.cpp in Sources */,
 				07C59B6E17F794F6000FBCBB /* JSMediaSourceStatesCustom.cpp in Sources */,
@@ -29414,6 +29429,7 @@
 				C90843CF1B18E47D00B68564 /* MediaRemoteControls.cpp in Sources */,
 				CEEFCD7919DB31F7003876D7 /* MediaResourceLoader.cpp in Sources */,
 				CDBEAEAC19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.mm in Sources */,
+				C9027F411B1D0AD200BFBFEF /* MediaSession.cpp in Sources */,
 				CDAE8C091746B95700532D78 /* MediaSessionManager.cpp in Sources */,
 				07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */,
 				07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.cpp in Sources */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to