Commit 9f514e70 authored by paroga@webkit.org's avatar paroga@webkit.org

2011-05-13 Patrick Gansterer <paroga@webkit.org>

        Reviewed by Adam Barth.

        Enable OwnPtr strict mode in MediaPlayer
        https://bugs.webkit.org/show_bug.cgi?id=59466

        Let the CreateMediaEnginePlayer function return a PassOwnPtr instead of a raw pointer.
        Also fix the templete argument of OwnPtr for the m_private member variable.

        * platform/graphics/MediaPlayer.cpp:
        (WebCore::MediaPlayer::MediaPlayer):
        (WebCore::MediaPlayer::loadWithNextMediaEngine):
        * platform/graphics/MediaPlayer.h:
        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h:
        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm:
        (WebCore::MediaPlayerPrivateAVFoundationObjC::create):
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivateGStreamer::create):
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivateQTKit::create):
        * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp:
        (WebCore::MediaPlayerPrivatePhonon::create):
        * platform/graphics/qt/MediaPlayerPrivatePhonon.h:
        * platform/graphics/qt/MediaPlayerPrivateQt.cpp:
        (WebCore::MediaPlayerPrivateQt::create):
        * platform/graphics/qt/MediaPlayerPrivateQt.h:
        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::create):
        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
        (WebCore::MediaPlayerPrivate::create):
        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h:
        * platform/graphics/wince/MediaPlayerPrivateWinCE.h:
2011-05-13  Patrick Gansterer  <paroga@webkit.org>

        Reviewed by Adam Barth.

        Enable OwnPtr strict mode in MediaPlayer
        https://bugs.webkit.org/show_bug.cgi?id=59466

        Let the CreateMediaEnginePlayer function return a PassOwnPtr instead of a raw pointer.
        Also fix the templete argument of OwnPtr for the m_private member variable.

        * src/WebMediaPlayerClientImpl.cpp:
        (WebKit::WebMediaPlayerClientImpl::create):
        * src/WebMediaPlayerClientImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86418 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ba3782cc
2011-05-13 Patrick Gansterer <paroga@webkit.org>
Reviewed by Adam Barth.
Enable OwnPtr strict mode in MediaPlayer
https://bugs.webkit.org/show_bug.cgi?id=59466
Let the CreateMediaEnginePlayer function return a PassOwnPtr instead of a raw pointer.
Also fix the templete argument of OwnPtr for the m_private member variable.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::MediaPlayer):
(WebCore::MediaPlayer::loadWithNextMediaEngine):
* platform/graphics/MediaPlayer.h:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::create):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::create):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivateQTKit::create):
* platform/graphics/qt/MediaPlayerPrivatePhonon.cpp:
(WebCore::MediaPlayerPrivatePhonon::create):
* platform/graphics/qt/MediaPlayerPrivatePhonon.h:
* platform/graphics/qt/MediaPlayerPrivateQt.cpp:
(WebCore::MediaPlayerPrivateQt::create):
* platform/graphics/qt/MediaPlayerPrivateQt.h:
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::create):
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
* platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
(WebCore::MediaPlayerPrivate::create):
* platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h:
* platform/graphics/wince/MediaPlayerPrivateWinCE.h:
2011-05-13 Alexey Proskuryakov <ap@apple.com>
Reviewed by Pavel Feldman.
......@@ -25,9 +25,6 @@
#include "config.h"
// FIXME: Remove this define!
#define LOOSE_OWN_PTR
#if ENABLE(VIDEO)
#include "MediaPlayer.h"
......@@ -310,8 +307,7 @@ MediaPlayer::MediaPlayer(MediaPlayerClient* client)
Vector<MediaPlayerFactory*>& engines = installedMediaEngines();
if (!engines.isEmpty()) {
m_currentMediaEngine = engines[0];
m_private.clear();
m_private.set(engines[0]->constructor(this));
m_private = engines[0]->constructor(this);
if (m_mediaPlayerClient)
m_mediaPlayerClient->mediaPlayerEngineUpdated(this);
}
......@@ -362,11 +358,10 @@ void MediaPlayer::loadWithNextMediaEngine(MediaPlayerFactory* current)
// Don't delete and recreate the player unless it comes from a different engine.
if (!engine) {
m_currentMediaEngine = engine;
m_private.clear();
m_private = nullptr;
} else if (m_currentMediaEngine != engine) {
m_currentMediaEngine = engine;
m_private.clear();
m_private.set(engine->constructor(this));
m_private = engine->constructor(this);
if (m_mediaPlayerClient)
m_mediaPlayerClient->mediaPlayerEngineUpdated(this);
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
......
......@@ -310,7 +310,7 @@ private:
MediaPlayerClient* m_mediaPlayerClient;
Timer<MediaPlayer> m_reloadTimer;
OwnPtr<MediaPlayerPrivateInterface*> m_private;
OwnPtr<MediaPlayerPrivateInterface> m_private;
MediaPlayerFactory* m_currentMediaEngine;
String m_url;
String m_contentMIMEType;
......@@ -330,7 +330,7 @@ private:
#endif
};
typedef MediaPlayerPrivateInterface* (*CreateMediaEnginePlayer)(MediaPlayer*);
typedef PassOwnPtr<MediaPlayerPrivateInterface> (*CreateMediaEnginePlayer)(MediaPlayer*);
typedef void (*MediaEngineSupportedTypes)(HashSet<String>& types);
typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const String& type, const String& codecs);
typedef void (*MediaEngineGetSitesInMediaCache)(Vector<String>&);
......
......@@ -66,7 +66,7 @@ private:
~MediaPlayerPrivateAVFoundationObjC();
// engine support
static MediaPlayerPrivateInterface* create(MediaPlayer* player);
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
static void getSupportedTypes(HashSet<String>& types);
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
static bool isAvailable();
......
......@@ -123,9 +123,9 @@ static const char *boolString(bool val)
static const float invalidTime = -1.0f;
MediaPlayerPrivateInterface* MediaPlayerPrivateAVFoundationObjC::create(MediaPlayer* player)
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateAVFoundationObjC::create(MediaPlayer* player)
{
return new MediaPlayerPrivateAVFoundationObjC(player);
return adoptPtr(new MediaPlayerPrivateAVFoundationObjC(player));
}
void MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(MediaEngineRegistrar registrar)
......
......@@ -151,9 +151,9 @@ static void mediaPlayerPrivateRepaintCallback(WebKitVideoSink*, GstBuffer *buffe
playerPrivate->triggerRepaint(buffer);
}
MediaPlayerPrivateInterface* MediaPlayerPrivateGStreamer::create(MediaPlayer* player)
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateGStreamer::create(MediaPlayer* player)
{
return new MediaPlayerPrivateGStreamer(player);
return adoptPtr(new MediaPlayerPrivateGStreamer(player));
}
void MediaPlayerPrivateGStreamer::registerMediaEngine(MediaEngineRegistrar registrar)
......
......@@ -47,6 +47,7 @@ class MediaPlayerPrivateGStreamer;
class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
public:
~MediaPlayerPrivateGStreamer();
static void registerMediaEngine(MediaEngineRegistrar);
gboolean handleMessage(GstMessage*);
......@@ -124,9 +125,8 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
private:
MediaPlayerPrivateGStreamer(MediaPlayer*);
~MediaPlayerPrivateGStreamer();
static MediaPlayerPrivateInterface* create(MediaPlayer* player);
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
static void getSupportedTypes(HashSet<String>&);
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
......
......@@ -59,6 +59,7 @@ class ApplicationCacheResource;
class MediaPlayerPrivateQTKit : public MediaPlayerPrivateInterface {
public:
~MediaPlayerPrivateQTKit();
static void registerMediaEngine(MediaEngineRegistrar);
void repaint();
......@@ -70,10 +71,9 @@ public:
private:
MediaPlayerPrivateQTKit(MediaPlayer*);
~MediaPlayerPrivateQTKit();
// engine support
static MediaPlayerPrivateInterface* create(MediaPlayer* player);
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
static void getSupportedTypes(HashSet<String>& types);
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
static void getSitesInMediaCache(Vector<String>&);
......
......@@ -181,11 +181,9 @@ using namespace std;
namespace WebCore {
MediaPlayerPrivateInterface* MediaPlayerPrivateQTKit::create(MediaPlayer* player)
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateQTKit::create(MediaPlayer* player)
{
return new MediaPlayerPrivateQTKit(player);
return adoptPtr(new MediaPlayerPrivateQTKit(player));
}
void MediaPlayerPrivateQTKit::registerMediaEngine(MediaEngineRegistrar registrar)
......
......@@ -118,9 +118,9 @@ MediaPlayerPrivatePhonon::MediaPlayerPrivatePhonon(MediaPlayer* player)
connect(m_mediaObject, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64)));
}
MediaPlayerPrivateInterface* MediaPlayerPrivatePhonon::create(MediaPlayer* player)
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivatePhonon::create(MediaPlayer* player)
{
return new MediaPlayerPrivatePhonon(player);
return adoptPtr(new MediaPlayerPrivatePhonon(player));
}
void MediaPlayerPrivatePhonon::registerMediaEngine(MediaEngineRegistrar registrar)
......
......@@ -128,7 +128,7 @@ namespace WebCore {
private:
MediaPlayerPrivatePhonon(MediaPlayer*);
static MediaPlayerPrivateInterface* create(MediaPlayer* player);
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
static void getSupportedTypes(HashSet<String>&);
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
......
......@@ -59,9 +59,9 @@ using namespace WTF;
namespace WebCore {
MediaPlayerPrivateInterface* MediaPlayerPrivateQt::create(MediaPlayer* player)
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateQt::create(MediaPlayer* player)
{
return new MediaPlayerPrivateQt(player);
return adoptPtr(new MediaPlayerPrivateQt(player));
}
void MediaPlayerPrivateQt::registerMediaEngine(MediaEngineRegistrar registrar)
......
......@@ -46,7 +46,7 @@ class MediaPlayerPrivateQt : public QObject, public MediaPlayerPrivateInterface
Q_OBJECT
public:
static MediaPlayerPrivateInterface* create(MediaPlayer* player);
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
~MediaPlayerPrivateQt();
static void registerMediaEngine(MediaEngineRegistrar);
......
......@@ -148,9 +148,9 @@ private:
MediaPlayerPrivateQuickTimeVisualContext* m_parent;
};
MediaPlayerPrivateInterface* MediaPlayerPrivateQuickTimeVisualContext::create(MediaPlayer* player)
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateQuickTimeVisualContext::create(MediaPlayer* player)
{
return new MediaPlayerPrivateQuickTimeVisualContext(player);
return adoptPtr(new MediaPlayerPrivateQuickTimeVisualContext(player));
}
void MediaPlayerPrivateQuickTimeVisualContext::registerMediaEngine(MediaEngineRegistrar registrar)
......
......@@ -126,7 +126,7 @@ private:
void sawUnsupportedTracks();
// engine support
static MediaPlayerPrivateInterface* create(MediaPlayer*);
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
static void getSupportedTypes(HashSet<String>& types);
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
static bool isAvailable();
......
......@@ -71,9 +71,9 @@ namespace WebCore {
SOFT_LINK_LIBRARY(Wininet)
SOFT_LINK(Wininet, InternetSetCookieExW, DWORD, WINAPI, (LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData, DWORD dwFlags, DWORD_PTR dwReserved), (lpszUrl, lpszCookieName, lpszCookieData, dwFlags, dwReserved))
MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player)
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivate::create(MediaPlayer* player)
{
return new MediaPlayerPrivate(player);
return adoptPtr(new MediaPlayerPrivate(player));
}
void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar)
......
......@@ -137,7 +137,7 @@ private:
virtual void movieNewImageAvailable(QTMovieGWorld*);
// engine support
static MediaPlayerPrivateInterface* create(MediaPlayer*);
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
static void getSupportedTypes(HashSet<String>& types);
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
static bool isAvailable();
......
......@@ -97,7 +97,7 @@ namespace WebCore {
#endif
// engine support
static MediaPlayerPrivateInterface* create(MediaPlayer*);
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
static void getSupportedTypes(HashSet<String>& types);
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
static bool isAvailable();
......
2011-05-13 Patrick Gansterer <paroga@webkit.org>
Reviewed by Adam Barth.
Enable OwnPtr strict mode in MediaPlayer
https://bugs.webkit.org/show_bug.cgi?id=59466
Let the CreateMediaEnginePlayer function return a PassOwnPtr instead of a raw pointer.
Also fix the templete argument of OwnPtr for the m_private member variable.
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::create):
* src/WebMediaPlayerClientImpl.h:
2011-05-12 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
......
......@@ -547,9 +547,9 @@ void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame)
}
#endif
MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player)
PassOwnPtr<MediaPlayerPrivateInterface> WebMediaPlayerClientImpl::create(MediaPlayer* player)
{
WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl();
OwnPtr<WebMediaPlayerClientImpl> client = adoptPtr(new WebMediaPlayerClientImpl());
client->m_mediaPlayer = player;
#if USE(ACCELERATED_COMPOSITING)
......@@ -564,7 +564,7 @@ MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* playe
frame->contentRenderer()->compositor()->hasAcceleratedCompositing();
#endif
return client;
return client.release();
}
void WebMediaPlayerClientImpl::getSupportedTypes(HashSet<String>& supportedTypes)
......
......@@ -134,7 +134,7 @@ private:
void startDelayedLoad();
void loadInternal();
static WebCore::MediaPlayerPrivateInterface* create(WebCore::MediaPlayer*);
static PassOwnPtr<WebCore::MediaPlayerPrivateInterface> create(WebCore::MediaPlayer*);
static void getSupportedTypes(WTF::HashSet<WTF::String>&);
static WebCore::MediaPlayer::SupportsType supportsType(
const WTF::String& type, const WTF::String& codecs);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment