| Differences between
and this patch
- a/Source/WebCore/ChangeLog +24 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-10-15  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Use std::unique_ptr instead of PassOwnPtr|OwnPtr in MediaPlayerFoo classes
4
        https://bugs.webkit.org/show_bug.cgi?id=137765
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        No new tests, no behavior changes.
9
10
        * html/HTMLMediaElement.cpp:
11
        (WebCore::HTMLMediaElement::parseAttribute):
12
        * html/HTMLMediaElement.h:
13
        * platform/graphics/MediaPlayer.cpp:
14
        (WebCore::createNullMediaPlayer):
15
        * platform/graphics/MediaPlayer.h: Set ctor to public.
16
        (WebCore::MediaPlayer::create):
17
        * platform/graphics/MediaPlayerPrivate.h:
18
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
19
        (WebCore::MediaPlayerPrivateGStreamer::create):
20
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Set ctor and create() to public.
21
        * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
22
        (WebCore::MockMediaPlayerMediaSource::create):
23
        * platform/mock/mediasource/MockMediaPlayerMediaSource.h: ditto.
24
1
2014-10-15  Chris Dumez  <cdumez@apple.com>
25
2014-10-15  Chris Dumez  <cdumez@apple.com>
2
26
3
        [Mac] Fix inefficiencies in ResourceResponse::platformLazyInit(InitLevel) - Part 2
27
        [Mac] Fix inefficiencies in ResourceResponse::platformLazyInit(InitLevel) - Part 2
- a/Source/WebCore/html/HTMLMediaElement.cpp -2 / +2 lines
Lines 4646-4652 void HTMLMediaElement::clearMediaPlayer(int flags) a/Source/WebCore/html/HTMLMediaElement.cpp_sec1
4646
        m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, false);
4646
        m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, false);
4647
#endif
4647
#endif
4648
4648
4649
    m_player.clear();
4649
    m_player = nullptr;
4650
4650
4651
    stopPeriodicTimers();
4651
    stopPeriodicTimers();
4652
    m_loadTimer.stop();
4652
    m_loadTimer.stop();
Lines 4693-4699 void HTMLMediaElement::stop() a/Source/WebCore/html/HTMLMediaElement.cpp_sec2
4693
    // Once an active DOM object has been stopped it can not be restarted, so we can deallocate
4693
    // Once an active DOM object has been stopped it can not be restarted, so we can deallocate
4694
    // the media player now. Note that userCancelledLoad will already have cleared the player
4694
    // the media player now. Note that userCancelledLoad will already have cleared the player
4695
    // if the media was not fully loaded. This handles all other cases.
4695
    // if the media was not fully loaded. This handles all other cases.
4696
    m_player.clear();
4696
    m_player = nullptr;
4697
4697
4698
    updateSleepDisabling();
4698
    updateSleepDisabling();
4699
}
4699
}
- a/Source/WebCore/html/HTMLMediaElement.h -1 / +1 lines
Lines 770-776 private: a/Source/WebCore/html/HTMLMediaElement.h_sec1
770
    MediaPlayer::VideoGravity m_videoFullscreenGravity;
770
    MediaPlayer::VideoGravity m_videoFullscreenGravity;
771
#endif
771
#endif
772
772
773
    OwnPtr<MediaPlayer> m_player;
773
    std::unique_ptr<MediaPlayer> m_player;
774
774
775
    MediaPlayer::Preload m_preload;
775
    MediaPlayer::Preload m_preload;
776
776
- a/Source/WebCore/platform/graphics/MediaPlayer.cpp -4 / +3 lines
Lines 144-155 public: a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec1
144
#endif
144
#endif
145
};
145
};
146
146
147
static PassOwnPtr<MediaPlayerPrivateInterface> createNullMediaPlayer(MediaPlayer* player) 
147
static std::unique_ptr<MediaPlayerPrivateInterface> createNullMediaPlayer(MediaPlayer* player) 
148
{ 
148
{
149
    return adoptPtr(new NullMediaPlayerPrivate(player)); 
149
    return std::make_unique<NullMediaPlayerPrivate>(player);
150
}
150
}
151
151
152
153
// engine support
152
// engine support
154
153
155
struct MediaPlayerFactory {
154
struct MediaPlayerFactory {
- a/Source/WebCore/platform/graphics/MediaPlayer.h -5 / +6 lines
Lines 279-288 class MediaPlayer { a/Source/WebCore/platform/graphics/MediaPlayer.h_sec1
279
    WTF_MAKE_NONCOPYABLE(MediaPlayer); WTF_MAKE_FAST_ALLOCATED;
279
    WTF_MAKE_NONCOPYABLE(MediaPlayer); WTF_MAKE_FAST_ALLOCATED;
280
public:
280
public:
281
281
282
    static PassOwnPtr<MediaPlayer> create(MediaPlayerClient& client)
282
    static std::unique_ptr<MediaPlayer> create(MediaPlayerClient& client)
283
    {
283
    {
284
        return adoptPtr(new MediaPlayer(client));
284
        return std::make_unique<MediaPlayer>(client);
285
    }
285
    }
286
287
    explicit MediaPlayer(MediaPlayerClient&);
286
    virtual ~MediaPlayer();
288
    virtual ~MediaPlayer();
287
289
288
    // Media engine support.
290
    // Media engine support.
Lines 577-583 public: a/Source/WebCore/platform/graphics/MediaPlayer.h_sec2
577
    String sourceApplicationIdentifier() const;
579
    String sourceApplicationIdentifier() const;
578
580
579
private:
581
private:
580
    MediaPlayer(MediaPlayerClient&);
581
    MediaPlayerFactory* nextBestMediaEngine(MediaPlayerFactory*) const;
582
    MediaPlayerFactory* nextBestMediaEngine(MediaPlayerFactory*) const;
582
    void loadWithNextMediaEngine(MediaPlayerFactory*);
583
    void loadWithNextMediaEngine(MediaPlayerFactory*);
583
    void reloadTimerFired(Timer<MediaPlayer>&);
584
    void reloadTimerFired(Timer<MediaPlayer>&);
Lines 586-592 private: a/Source/WebCore/platform/graphics/MediaPlayer.h_sec3
586
587
587
    MediaPlayerClient& m_client;
588
    MediaPlayerClient& m_client;
588
    Timer<MediaPlayer> m_reloadTimer;
589
    Timer<MediaPlayer> m_reloadTimer;
589
    OwnPtr<MediaPlayerPrivateInterface> m_private;
590
    std::unique_ptr<MediaPlayerPrivateInterface> m_private;
590
    MediaPlayerFactory* m_currentMediaEngine;
591
    MediaPlayerFactory* m_currentMediaEngine;
591
    URL m_url;
592
    URL m_url;
592
    String m_contentMIMEType;
593
    String m_contentMIMEType;
Lines 608-614 private: a/Source/WebCore/platform/graphics/MediaPlayer.h_sec4
608
#endif
609
#endif
609
};
610
};
610
611
611
typedef PassOwnPtr<MediaPlayerPrivateInterface> (*CreateMediaEnginePlayer)(MediaPlayer*);
612
typedef std::unique_ptr<MediaPlayerPrivateInterface> (*CreateMediaEnginePlayer)(MediaPlayer*);
612
typedef void (*MediaEngineSupportedTypes)(HashSet<String>& types);
613
typedef void (*MediaEngineSupportedTypes)(HashSet<String>& types);
613
typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const MediaEngineSupportParameters& parameters);
614
typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const MediaEngineSupportParameters& parameters);
614
typedef void (*MediaEngineGetSitesInMediaCache)(Vector<String>&);
615
typedef void (*MediaEngineGetSitesInMediaCache)(Vector<String>&);
- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h -1 lines
Lines 31-37 a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h_sec1
31
#include "MediaPlayer.h"
31
#include "MediaPlayer.h"
32
#include "PlatformTimeRanges.h"
32
#include "PlatformTimeRanges.h"
33
#include <wtf/Forward.h>
33
#include <wtf/Forward.h>
34
#include <wtf/OwnPtr.h>
35
34
36
namespace WebCore {
35
namespace WebCore {
37
36
- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp -2 / +2 lines
Lines 138-146 void MediaPlayerPrivateGStreamer::setAudioStreamProperties(GObject* object) a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp_sec1
138
    LOG_MEDIA_MESSAGE("Set media.role as %s at %s", role, elementName.get());
138
    LOG_MEDIA_MESSAGE("Set media.role as %s at %s", role, elementName.get());
139
}
139
}
140
140
141
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateGStreamer::create(MediaPlayer* player)
141
std::unique_ptr<MediaPlayerPrivateInterface> MediaPlayerPrivateGStreamer::create(MediaPlayer* player)
142
{
142
{
143
    return adoptPtr(new MediaPlayerPrivateGStreamer(player));
143
    return std::make_unique<MediaPlayerPrivateGStreamer>(player);
144
}
144
}
145
145
146
void MediaPlayerPrivateGStreamer::registerMediaEngine(MediaEngineRegistrar registrar)
146
void MediaPlayerPrivateGStreamer::registerMediaEngine(MediaEngineRegistrar registrar)
- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h -4 / +3 lines
Lines 57-63 class VideoTrackPrivateGStreamer; a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h_sec1
57
57
58
class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateGStreamerBase {
58
class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateGStreamerBase {
59
public:
59
public:
60
    static std::unique_ptr<MediaPlayerPrivateInterface> create(MediaPlayer*);
61
    explicit MediaPlayerPrivateGStreamer(MediaPlayer*);
60
    ~MediaPlayerPrivateGStreamer();
62
    ~MediaPlayerPrivateGStreamer();
63
61
    static void registerMediaEngine(MediaEngineRegistrar);
64
    static void registerMediaEngine(MediaEngineRegistrar);
62
    gboolean handleMessage(GstMessage*);
65
    gboolean handleMessage(GstMessage*);
63
    void handlePluginInstallerResult(GstInstallPluginsReturn);
66
    void handlePluginInstallerResult(GstInstallPluginsReturn);
Lines 126-135 public: a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h_sec2
126
    bool changePipelineState(GstState);
129
    bool changePipelineState(GstState);
127
130
128
private:
131
private:
129
    MediaPlayerPrivateGStreamer(MediaPlayer*);
130
131
    static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
132
133
    static void getSupportedTypes(HashSet<String>&);
132
    static void getSupportedTypes(HashSet<String>&);
134
    static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
133
    static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
135
134
- a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp -2 / +2 lines
Lines 44-52 void MockMediaPlayerMediaSource::registerMediaEngine(MediaEngineRegistrar regist a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp_sec1
44
    registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
44
    registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
45
}
45
}
46
46
47
PassOwnPtr<MediaPlayerPrivateInterface> MockMediaPlayerMediaSource::create(MediaPlayer* player)
47
std::unique_ptr<MediaPlayerPrivateInterface> MockMediaPlayerMediaSource::create(MediaPlayer* player)
48
{
48
{
49
    return adoptPtr(new MockMediaPlayerMediaSource(player));
49
    return std::make_unique<MockMediaPlayerMediaSource>(player);
50
}
50
}
51
51
52
static HashSet<String> mimeTypeCache()
52
static HashSet<String> mimeTypeCache()
- a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h -3 / +3 lines
Lines 38-46 class MockMediaSourcePrivate; a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h_sec1
38
38
39
class MockMediaPlayerMediaSource : public MediaPlayerPrivateInterface {
39
class MockMediaPlayerMediaSource : public MediaPlayerPrivateInterface {
40
public:
40
public:
41
    explicit MockMediaPlayerMediaSource(MediaPlayer*);
42
41
    // MediaPlayer Engine Support
43
    // MediaPlayer Engine Support
42
    static void registerMediaEngine(MediaEngineRegistrar);
44
    static void registerMediaEngine(MediaEngineRegistrar);
43
    static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
45
    static std::unique_ptr<MediaPlayerPrivateInterface> create(MediaPlayer*);
44
    static void getSupportedTypes(HashSet<String>& types);
46
    static void getSupportedTypes(HashSet<String>& types);
45
    static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
47
    static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
46
48
Lines 56-63 public: a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h_sec2
56
    void seekCompleted();
58
    void seekCompleted();
57
59
58
private:
60
private:
59
    MockMediaPlayerMediaSource(MediaPlayer*);
60
61
    // MediaPlayerPrivate Overrides
61
    // MediaPlayerPrivate Overrides
62
    virtual void load(const String& url) override;
62
    virtual void load(const String& url) override;
63
    virtual void load(const String& url, MediaSourcePrivateClient*) override;
63
    virtual void load(const String& url, MediaSourcePrivateClient*) override;

Return to Bug 137765