WebPlaybackControlsManager should not be owned by the WebPlaybackSessionInterfaceMac.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2016 18:24:57 +0000 (18:24 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2016 18:24:57 +0000 (18:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157155
<rdar://problem/25991724>

Reviewed by Beth Dakin.

Move the WebPlaybackControlsManager class into its own header and implementation files.

* WebCore.xcodeproj/project.pbxproj:
* platform/mac/WebPlaybackControlsManager.h: Added.
* platform/mac/WebPlaybackControlsManager.mm: Added.
(-[WebPlaybackControlsManager timing]): Moved from WebPlaybackSessionInterfaceMac.
(-[WebPlaybackControlsManager setTiming:]): Ditto.
(-[WebPlaybackControlsManager seekableTimeRanges]): Ditto.
(-[WebPlaybackControlsManager setSeekableTimeRanges:]): Ditto.
(-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]): Ditto.
(-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]): Ditto.
* platform/mac/WebPlaybackSessionInterfaceMac.h:
* platform/mac/WebPlaybackSessionInterfaceMac.mm:
(WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
(-[WebPlaybackControlsManager initWithWebPlaybackSessionInterfaceMac:]): Deleted.
(-[WebPlaybackControlsManager timing]): Deleted.
(-[WebPlaybackControlsManager setTiming:]): Deleted.
(-[WebPlaybackControlsManager seekableTimeRanges]): Deleted.
(-[WebPlaybackControlsManager setSeekableTimeRanges:]): Deleted.
(-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]): Deleted.
(-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]): Deleted.
(WebCore::WebPlaybackSessionInterfaceMac::playBackControlsManager): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200254 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/mac/WebPlaybackControlsManager.h [new file with mode: 0644]
Source/WebCore/platform/mac/WebPlaybackControlsManager.mm [new file with mode: 0644]
Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h
Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm

index 2926164..b30729f 100644 (file)
@@ -1,3 +1,34 @@
+2016-04-28  Jer Noble  <jer.noble@apple.com>
+
+        WebPlaybackControlsManager should not be owned by the WebPlaybackSessionInterfaceMac.
+        https://bugs.webkit.org/show_bug.cgi?id=157155
+        <rdar://problem/25991724>
+
+        Reviewed by Beth Dakin.
+
+        Move the WebPlaybackControlsManager class into its own header and implementation files.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/mac/WebPlaybackControlsManager.h: Added.
+        * platform/mac/WebPlaybackControlsManager.mm: Added.
+        (-[WebPlaybackControlsManager timing]): Moved from WebPlaybackSessionInterfaceMac.
+        (-[WebPlaybackControlsManager setTiming:]): Ditto.
+        (-[WebPlaybackControlsManager seekableTimeRanges]): Ditto.
+        (-[WebPlaybackControlsManager setSeekableTimeRanges:]): Ditto.
+        (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]): Ditto.
+        (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]): Ditto.
+        * platform/mac/WebPlaybackSessionInterfaceMac.h:
+        * platform/mac/WebPlaybackSessionInterfaceMac.mm:
+        (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
+        (-[WebPlaybackControlsManager initWithWebPlaybackSessionInterfaceMac:]): Deleted.
+        (-[WebPlaybackControlsManager timing]): Deleted.
+        (-[WebPlaybackControlsManager setTiming:]): Deleted.
+        (-[WebPlaybackControlsManager seekableTimeRanges]): Deleted.
+        (-[WebPlaybackControlsManager setSeekableTimeRanges:]): Deleted.
+        (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]): Deleted.
+        (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]): Deleted.
+        (WebCore::WebPlaybackSessionInterfaceMac::playBackControlsManager): Deleted.
+
 2016-04-29  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r200232.
index 0f18e22..133d8d1 100644 (file)
                CD54DE4B17469C6D005E5B36 /* AudioSessionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD54DE4917469C6D005E5B36 /* AudioSessionMac.cpp */; };
                CD5596911475B678001D0BD0 /* AudioFileReaderIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD55968F1475B678001D0BD0 /* AudioFileReaderIOS.cpp */; };
                CD5596921475B678001D0BD0 /* AudioFileReaderIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5596901475B678001D0BD0 /* AudioFileReaderIOS.h */; };
+               CD5896E11CD2B15100B3BCC8 /* WebPlaybackControlsManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD5896DF1CD2B15100B3BCC8 /* WebPlaybackControlsManager.mm */; };
+               CD5896E21CD2B15100B3BCC8 /* WebPlaybackControlsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5896E01CD2B15100B3BCC8 /* WebPlaybackControlsManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CD5E5B5F1A15CE54000C609E /* PageConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5E5B5E1A15CE54000C609E /* PageConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CD5E5B611A15F156000C609E /* PageConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5E5B601A15F156000C609E /* PageConfiguration.cpp */; };
                CD60C0C6193E87C7003C656B /* MediaTimeQTKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD60C0C4193E87C7003C656B /* MediaTimeQTKit.mm */; };
                CD54DE4917469C6D005E5B36 /* AudioSessionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioSessionMac.cpp; sourceTree = "<group>"; };
                CD55968F1475B678001D0BD0 /* AudioFileReaderIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioFileReaderIOS.cpp; sourceTree = "<group>"; };
                CD5596901475B678001D0BD0 /* AudioFileReaderIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioFileReaderIOS.h; sourceTree = "<group>"; };
+               CD5896DF1CD2B15100B3BCC8 /* WebPlaybackControlsManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPlaybackControlsManager.mm; sourceTree = "<group>"; };
+               CD5896E01CD2B15100B3BCC8 /* WebPlaybackControlsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPlaybackControlsManager.h; sourceTree = "<group>"; };
                CD5E5B5E1A15CE54000C609E /* PageConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageConfiguration.h; sourceTree = "<group>"; };
                CD5E5B601A15F156000C609E /* PageConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageConfiguration.cpp; sourceTree = "<group>"; };
                CD60C0C4193E87C7003C656B /* MediaTimeQTKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaTimeQTKit.mm; sourceTree = "<group>"; };
                                E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */,
                                CDA29A151CBDA56C00901CCF /* WebPlaybackSessionInterfaceMac.h */,
                                CDA29A141CBDA56C00901CCF /* WebPlaybackSessionInterfaceMac.mm */,
+                               CD5896DF1CD2B15100B3BCC8 /* WebPlaybackControlsManager.mm */,
+                               CD5896E01CD2B15100B3BCC8 /* WebPlaybackControlsManager.h */,
                                CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */,
                                CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */,
                                CD8203081395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h */,
                                A7CA595D0B27BD9E00FA021D /* DragController.h in Headers */,
                                A7B6E69F0B291A9600D0529F /* DragData.h in Headers */,
                                A7CFB3D20B7ED10A0070C32D /* DragImage.h in Headers */,
+                               CD5896E21CD2B15100B3BCC8 /* WebPlaybackControlsManager.h in Headers */,
                                81F65FF613788FAA00FF6F2D /* DragState.h in Headers */,
                                E1BA66F11742BD8600C20251 /* DynamicLinkerInterposing.h in Headers */,
                                CE1252451A16C22500864480 /* DynamicLinkerSPI.h in Headers */,
                                163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
                                E48944A2180B57D800F165D8 /* SimpleLineLayout.cpp in Sources */,
                                585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */,
+                               CD5896E11CD2B15100B3BCC8 /* WebPlaybackControlsManager.mm in Sources */,
                                E4E9B11B18145692003ACCDF /* SimpleLineLayoutFunctions.cpp in Sources */,
                                585D6DFC1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp in Sources */,
                                582CB0551A78A2B200AFFCC4 /* SimpleLineLayoutTextFragmentIterator.cpp in Sources */,
diff --git a/Source/WebCore/platform/mac/WebPlaybackControlsManager.h b/Source/WebCore/platform/mac/WebPlaybackControlsManager.h
new file mode 100644 (file)
index 0000000..6bab906
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 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. AND ITS CONTRIBUTORS ``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 ITS 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 WebPlaybackControlsManager_h
+#define WebPlaybackControlsManager_h
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+
+namespace WebCore {
+class WebPlaybackSessionInterfaceMac;
+}
+
+#if USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+#import <WebKitAdditions/WebPlaybackControlsControllerAdditions.h>
+#else
+
+WEBCORE_EXPORT
+@interface WebPlaybackControlsManager : NSObject {
+    NSTimeInterval _contentDuration;
+    RetainPtr<AVValueTiming> _timing;
+    RetainPtr<NSArray> _seekableTimeRanges;
+    BOOL _hasEnabledAudio;
+    BOOL _hasEnabledVideo;
+    float _rate;
+
+@private
+    WebCore::WebPlaybackSessionInterfaceMac* _webPlaybackSessionInterfaceMac;
+}
+
+@property (assign) WebCore::WebPlaybackSessionInterfaceMac* webPlaybackSessionInterfaceMac;
+@property (readwrite) NSTimeInterval contentDuration;
+@property (nonatomic, retain, readwrite) AVValueTiming *timing;
+@property (nonatomic, retain, readwrite) NSArray *seekableTimeRanges;
+@property (readwrite) BOOL hasEnabledAudio;
+@property (readwrite) BOOL hasEnabledVideo;
+@property (nonatomic) float rate;
+
+@end
+#endif // USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+
+#endif // PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+
+#endif // WebPlaybackControlsManager_h
diff --git a/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm b/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm
new file mode 100644 (file)
index 0000000..8721ee7
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2016 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. AND ITS CONTRIBUTORS ``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 ITS 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 "WebPlaybackControlsManager.h"
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+
+#if USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+#import <WebKitAdditions/WebPlaybackControlsControllerAdditions.mm>
+#else
+@implementation WebPlaybackControlsManager
+
+@synthesize contentDuration=_contentDuration;
+@synthesize hasEnabledAudio=_hasEnabledAudio;
+@synthesize hasEnabledVideo=_hasEnabledVideo;
+@synthesize rate=_rate;
+
+- (AVValueTiming *)timing
+{
+    return _timing.get();
+}
+
+- (void)setTiming:(AVValueTiming *)timing
+{
+    _timing = timing;
+}
+
+- (NSArray *)seekableTimeRanges
+{
+    return _seekableTimeRanges.get();
+}
+
+- (void)setSeekableTimeRanges:(NSArray *)timeRanges
+{
+    _seekableTimeRanges = timeRanges;
+}
+
+- (void)setAudioMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex
+{
+    UNUSED_PARAM(options);
+    UNUSED_PARAM(selectedIndex);
+}
+
+- (void)setLegibleMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex
+{
+    UNUSED_PARAM(options);
+    UNUSED_PARAM(selectedIndex);
+}
+
+@end
+#endif // USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+
+#endif // PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+
index a13b3d3..b95248d 100644 (file)
@@ -74,6 +74,7 @@ public:
     WEBCORE_EXPORT void setWirelessVideoPlaybackDisabled(bool) final { }
     WEBCORE_EXPORT void invalidate();
     WEBCORE_EXPORT void ensureControlsManager();
+    WEBCORE_EXPORT void setPlayBackControlsManager(WebPlaybackControlsManager *);
     WEBCORE_EXPORT WebPlaybackControlsManager *playBackControlsManager();
 
 private:
index d70f7aa..88833bf 100644 (file)
@@ -32,6 +32,7 @@
 #import "IntRect.h"
 #import "MediaTimeAVFoundation.h"
 #import "TimeRanges.h"
+#import "WebPlaybackControlsManager.h"
 #import "WebPlaybackSessionModel.h"
 #import <AVFoundation/AVFoundation.h>
 
@@ -42,85 +43,6 @@ SOFT_LINK_CLASS_OPTIONAL(AVKit, AVValueTiming)
 
 using namespace WebCore;
 
-#if USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
-#import <WebKitAdditions/WebPlaybackControlsControllerAdditions.mm>
-#else
-@interface WebPlaybackControlsManager : NSObject {
-    NSTimeInterval _contentDuration;
-    RetainPtr<AVValueTiming> _timing;
-    RetainPtr<NSArray> _seekableTimeRanges;
-    BOOL _hasEnabledAudio;
-    BOOL _hasEnabledVideo;
-    float _rate;
-
-@private
-    WebCore::WebPlaybackSessionInterfaceMac* _webPlaybackSessionInterfaceMac;
-}
-
-@property (readwrite) NSTimeInterval contentDuration;
-@property (nonatomic, retain, readwrite) AVValueTiming *timing;
-@property (nonatomic, retain, readwrite) NSArray *seekableTimeRanges;
-@property (readwrite) BOOL hasEnabledAudio;
-@property (readwrite) BOOL hasEnabledVideo;
-@property (nonatomic) float rate;
-
-- (instancetype)initWithWebPlaybackSessionInterfaceMac:(WebCore::WebPlaybackSessionInterfaceMac*)webPlaybackSessionInterfaceMac;
-
-@end
-
-@implementation WebPlaybackControlsManager
-
-@synthesize contentDuration=_contentDuration;
-@synthesize hasEnabledAudio=_hasEnabledAudio;
-@synthesize hasEnabledVideo=_hasEnabledVideo;
-@synthesize rate=_rate;
-
-- (instancetype)initWithWebPlaybackSessionInterfaceMac:(WebCore::WebPlaybackSessionInterfaceMac*)webPlaybackSessionInterfaceMac
-{
-    if (!(self = [super init]))
-        return nil;
-
-    _webPlaybackSessionInterfaceMac = webPlaybackSessionInterfaceMac;
-
-    return self;
-}
-
-- (AVValueTiming *)timing
-{
-    return _timing.get();
-}
-
-- (void)setTiming:(AVValueTiming *)timing
-{
-    _timing = timing;
-}
-
-- (NSArray *)seekableTimeRanges
-{
-    return _seekableTimeRanges.get();
-}
-
-- (void)setSeekableTimeRanges:(NSArray *)timeRanges
-{
-    _seekableTimeRanges = timeRanges;
-}
-
-- (void)setAudioMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex
-{
-    UNUSED_PARAM(options);
-    UNUSED_PARAM(selectedIndex);
-}
-
-- (void)setLegibleMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex
-{
-    UNUSED_PARAM(options);
-    UNUSED_PARAM(selectedIndex);
-}
-
-@end
-
-#endif
-
 namespace WebCore {
 
 WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac()
@@ -212,14 +134,17 @@ void WebPlaybackSessionInterfaceMac::ensureControlsManager()
 WebPlaybackControlsManager *WebPlaybackSessionInterfaceMac::playBackControlsManager()
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
-    if (!m_playbackControlsManager)
-        m_playbackControlsManager = adoptNS([[WebPlaybackControlsManager alloc] initWithWebPlaybackSessionInterfaceMac:this]);
     return m_playbackControlsManager.get();
 #else
     return nil;
 #endif
 }
-    
+
+void WebPlaybackSessionInterfaceMac::setPlayBackControlsManager(WebPlaybackControlsManager *manager)
+{
+    m_playbackControlsManager = manager;
+}
+
 }
 
 #endif // PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)