Changeset 265019 in webkit


Ignore:
Timestamp:
Jul 28, 2020 4:21:53 PM (4 years ago)
Author:
Peng Liu
Message:

Clean up PlaybackSessionInterface[Mac|AVKit]
https://bugs.webkit.org/show_bug.cgi?id=214895

Reviewed by Eric Carlson.

No new tests, no functional change.

  • platform/ios/PlaybackSessionInterfaceAVKit.h:
  • platform/ios/PlaybackSessionInterfaceAVKit.mm:

(WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
(WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
Remove unnecessary WEBCORE_EXPORT.
Include the correct header for Ref.
Replace "protected" with "private".
Use WeakPtr of PlaybackSessionModel instead of a raw pointer.

  • platform/mac/PlaybackSessionInterfaceMac.h:

Add "final" to ensureControlsManager().
Some small cleanup.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r265014 r265019  
     12020-07-28  Peng Liu  <peng.liu6@apple.com>
     2
     3        Clean up PlaybackSessionInterface[Mac|AVKit]
     4        https://bugs.webkit.org/show_bug.cgi?id=214895
     5
     6        Reviewed by Eric Carlson.
     7
     8        No new tests, no functional change.
     9
     10        * platform/ios/PlaybackSessionInterfaceAVKit.h:
     11        * platform/ios/PlaybackSessionInterfaceAVKit.mm:
     12        (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
     13        (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
     14        Remove unnecessary WEBCORE_EXPORT.
     15        Include the correct header for Ref.
     16        Replace "protected" with "private".
     17        Use WeakPtr of PlaybackSessionModel instead of a raw pointer.
     18
     19        * platform/mac/PlaybackSessionInterfaceMac.h:
     20        Add "final" to ensureControlsManager().
     21        Some small cleanup.
     22
    1232020-07-28  Chris Dumez  <cdumez@apple.com>
    224
  • trunk/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.h

    r260729 r265019  
    3636#include <objc/objc.h>
    3737#include <wtf/Forward.h>
     38#include <wtf/Ref.h>
    3839#include <wtf/RefCounted.h>
    39 #include <wtf/RefPtr.h>
    4040#include <wtf/RetainPtr.h>
     41#include <wtf/WeakPtr.h>
    4142
    4243OBJC_CLASS WebAVPlayerController;
     
    6061
    6162    // PlaybackSessionModelClient
    62     WEBCORE_EXPORT void durationChanged(double) override;
    63     WEBCORE_EXPORT void currentTimeChanged(double currentTime, double anchorTime) override;
    64     WEBCORE_EXPORT void bufferedTimeChanged(double) override;
    65     WEBCORE_EXPORT void rateChanged(bool isPlaying, float playbackRate) override;
    66     WEBCORE_EXPORT void seekableRangesChanged(const TimeRanges&, double lastModifiedTime, double liveUpdateInterval) override;
    67     WEBCORE_EXPORT void canPlayFastReverseChanged(bool) override;
    68     WEBCORE_EXPORT void audioMediaSelectionOptionsChanged(const Vector<MediaSelectionOption>& options, uint64_t selectedIndex) override;
    69     WEBCORE_EXPORT void legibleMediaSelectionOptionsChanged(const Vector<MediaSelectionOption>& options, uint64_t selectedIndex) override;
    70     WEBCORE_EXPORT void externalPlaybackChanged(bool enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) override;
    71     WEBCORE_EXPORT void wirelessVideoPlaybackDisabledChanged(bool) override;
    72     WEBCORE_EXPORT void mutedChanged(bool) override;
    73     WEBCORE_EXPORT void volumeChanged(double) override;
    74     WEBCORE_EXPORT void modelDestroyed() override;
     63    void durationChanged(double) override;
     64    void currentTimeChanged(double currentTime, double anchorTime) override;
     65    void bufferedTimeChanged(double) override;
     66    void rateChanged(bool isPlaying, float playbackRate) override;
     67    void seekableRangesChanged(const TimeRanges&, double lastModifiedTime, double liveUpdateInterval) override;
     68    void canPlayFastReverseChanged(bool) override;
     69    void audioMediaSelectionOptionsChanged(const Vector<MediaSelectionOption>& options, uint64_t selectedIndex) override;
     70    void legibleMediaSelectionOptionsChanged(const Vector<MediaSelectionOption>& options, uint64_t selectedIndex) override;
     71    void externalPlaybackChanged(bool enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) override;
     72    void wirelessVideoPlaybackDisabledChanged(bool) override;
     73    void mutedChanged(bool) override;
     74    void volumeChanged(double) override;
     75    void modelDestroyed() override;
    7576
    76     WEBCORE_EXPORT virtual void invalidate();
     77    void invalidate();
    7778
    7879    WebAVPlayerController *playerController() const { return m_playerController.get(); }
    7980
    80 protected:
    81     WEBCORE_EXPORT PlaybackSessionInterfaceAVKit(PlaybackSessionModel&);
    82 
     81private:
     82    PlaybackSessionInterfaceAVKit(PlaybackSessionModel&);
    8383    RetainPtr<WebAVPlayerController> m_playerController;
    84     PlaybackSessionModel* m_playbackSessionModel { nullptr };
     84    WeakPtr<PlaybackSessionModel> m_playbackSessionModel;
    8585};
    8686
  • trunk/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm

    r263990 r265019  
    5252PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit(PlaybackSessionModel& model)
    5353    : m_playerController(adoptNS([[WebAVPlayerController alloc] init]))
    54     , m_playbackSessionModel(&model)
     54    , m_playbackSessionModel(makeWeakPtr(model))
    5555{
    5656    ASSERT(isUIThread());
     
    8282PlaybackSessionModel* PlaybackSessionInterfaceAVKit::playbackSessionModel() const
    8383{
    84     return m_playbackSessionModel;
     84    return m_playbackSessionModel.get();
    8585}
    8686
  • trunk/Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.h

    r260729 r265019  
    6161    void externalPlaybackChanged(bool /* enabled */, PlaybackSessionModel::ExternalPlaybackTargetType, const String& /* localizedDeviceName */) final;
    6262    void isPictureInPictureSupportedChanged(bool) final;
     63    void ensureControlsManager() final;
    6364
    64     void invalidate();
    65     void ensureControlsManager();
    6665#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
    6766    void setPlayBackControlsManager(WebPlaybackControlsManager *);
     
    7372    void endScrubbing();
    7473
     74    void invalidate();
     75
    7576private:
    7677    PlaybackSessionInterfaceMac(PlaybackSessionModel&);
     
    8182    void updatePlaybackControlsManagerTiming(double currentTime, double anchorTime, double playbackRate, bool isPlaying);
    8283#endif
    83 
    8484};
    8585
Note: See TracChangeset for help on using the changeset viewer.