MediaPlayer cleanup, part one of N

Get rid of a lot of dead code in MediaPlayer and associated classes,
and simplify MediaPlayer now that there's only a single MediaEngine
to worry about.

Note that this is just the beginning: there's clearly lots more to be
done, and some the layers here probably no longer need to exist.

R=eseidel@chromium.org

Review URL: https://chromiumcodereview.appspot.com/14722011

git-svn-id: svn://svn.chromium.org/blink/trunk@149779 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index 1160a42..00d2a2a 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -79,12 +79,7 @@
 void WebMediaPlayerClientImpl::registerSelf(MediaEngineRegistrar registrar)
 {
     if (m_isEnabled) {
-        registrar(WebMediaPlayerClientImpl::create,
-                  WebMediaPlayerClientImpl::getSupportedTypes,
-                  WebMediaPlayerClientImpl::supportsType,
-                  0,
-                  0,
-                  0);
+        registrar(WebMediaPlayerClientImpl::create, WebMediaPlayerClientImpl::supportsType);
     }
 }
 
@@ -730,12 +725,6 @@
     return client.release();
 }
 
-void WebMediaPlayerClientImpl::getSupportedTypes(HashSet<String>& supportedTypes)
-{
-    // FIXME: integrate this list with WebMediaPlayerClientImpl::supportsType.
-    notImplemented();
-}
-
 #if ENABLE(ENCRYPTED_MEDIA)
 MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& type,
                                                                  const String& codecs,
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
index c20de5d..6180dd7 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
@@ -158,7 +158,6 @@
     void loadInternal();
 
     static PassOwnPtr<WebCore::MediaPlayerPrivateInterface> create(WebCore::MediaPlayer*);
-    static void getSupportedTypes(WTF::HashSet<WTF::String>&);
 #if ENABLE(ENCRYPTED_MEDIA)
     static WebCore::MediaPlayer::SupportsType supportsType(
         const WTF::String& type, const WTF::String& codecs, const String& keySystem, const WebCore::KURL&);
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp
index 5481f20..5df2b76 100644
--- a/Source/core/dom/DOMImplementation.cpp
+++ b/Source/core/dom/DOMImplementation.cpp
@@ -67,22 +67,6 @@
     set.add(string);
 }
 
-class DOMImplementationSupportsTypeClient : public MediaPlayerSupportsTypeClient {
-public:
-    DOMImplementationSupportsTypeClient(bool needsHacks, const String& host)
-        : m_needsHacks(needsHacks)
-        , m_host(host)
-    {
-    }
-
-private:
-    virtual bool mediaPlayerNeedsSiteSpecificHacks() const OVERRIDE { return m_needsHacks; }
-    virtual String mediaPlayerDocumentHost() const OVERRIDE { return m_host; }
-
-    bool m_needsHacks;
-    String m_host;
-};
-
 #if ENABLE(SVG)
 
 static bool isSVG10Feature(const String &feature, const String &version)
@@ -433,11 +417,10 @@
     if (Image::supportsType(type))
         return ImageDocument::create(frame, url);
 
-     // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument
+    // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument
     // Key system is not applicable here.
-    DOMImplementationSupportsTypeClient client(frame && frame->settings() && frame->settings()->needsSiteSpecificQuirks(), url.host());
-    if (MediaPlayer::supportsType(ContentType(type), String(), url, &client))
-         return MediaDocument::create(frame, url);
+    if (MediaPlayer::supportsType(ContentType(type), String(), url))
+        return MediaDocument::create(frame, url);
 
     // Everything else except text/plain can be overridden by plugins. In particular, Adobe SVG Viewer should be used for SVG, if installed.
     // Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a fundamental type that the browser is expected to handle,
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 334d7197..93b3878 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -575,7 +575,7 @@
 
 String HTMLMediaElement::canPlayType(const String& mimeType, const String& keySystem, const KURL& url) const
 {
-    MediaPlayer::SupportsType support = MediaPlayer::supportsType(ContentType(mimeType), keySystem, url, this);
+    MediaPlayer::SupportsType support = MediaPlayer::supportsType(ContentType(mimeType), keySystem, url);
     String canPlay;
 
     // 4.8.10.3
@@ -3058,7 +3058,7 @@
             if (shouldLog)
                 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is '%s' - key system is '%s'", type.utf8().data(), system.utf8().data());
 #endif
-            if (!MediaPlayer::supportsType(ContentType(type), system, mediaURL, this))
+            if (!MediaPlayer::supportsType(ContentType(type), system, mediaURL))
                 goto check_again;
         }
 
@@ -3877,26 +3877,6 @@
 }
 
 
-void HTMLMediaElement::getSitesInMediaCache(Vector<String>& sites)
-{
-    MediaPlayer::getSitesInMediaCache(sites);
-}
-
-void HTMLMediaElement::clearMediaCache()
-{
-    MediaPlayer::clearMediaCache();
-}
-
-void HTMLMediaElement::clearMediaCacheForSite(const String& site)
-{
-    MediaPlayer::clearMediaCacheForSite(site);
-}
-
-void HTMLMediaElement::resetMediaEngines()
-{
-    MediaPlayer::resetMediaEngines();
-}
-
 MediaControls* HTMLMediaElement::mediaControls() const
 {
     return toMediaControls(userAgentShadowRoot()->firstChild());
@@ -4238,17 +4218,6 @@
     return Anonymous;
 }
 
-bool HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks() const
-{
-    Settings* settings = document()->settings();
-    return settings && settings->needsSiteSpecificQuirks();
-}
-
-String HTMLMediaElement::mediaPlayerDocumentHost() const
-{
-    return document()->url().host();
-}
-
 void HTMLMediaElement::mediaPlayerEnterFullscreen()
 {
     enterFullscreen();
diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h
index e30ce8b..eedbc78 100644
--- a/Source/core/html/HTMLMediaElement.h
+++ b/Source/core/html/HTMLMediaElement.h
@@ -65,7 +65,7 @@
 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it
 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement.
 
-class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, public MediaPlayerSupportsTypeClient, public ActiveDOMObject, public MediaControllerInterface
+class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, public ActiveDOMObject, public MediaControllerInterface
     , private TextTrackClient
 #if USE(PLATFORM_TEXT_TRACK_MENU)
     , public PlatformTextTrackMenuClient
@@ -285,12 +285,6 @@
     void sourceWasRemoved(HTMLSourceElement*);
     void sourceWasAdded(HTMLSourceElement*);
 
-    // Media cache management.
-    static void getSitesInMediaCache(Vector<String>&);
-    static void clearMediaCache();
-    static void clearMediaCacheForSite(const String&);
-    static void resetMediaEngines();
-
     bool isPlaying() const { return m_playing; }
 
     virtual bool hasPendingActivity() const;
@@ -419,9 +413,6 @@
     virtual String mediaPlayerUserAgent() const OVERRIDE;
     virtual CORSMode mediaPlayerCORSMode() const OVERRIDE;
 
-    virtual bool mediaPlayerNeedsSiteSpecificHacks() const OVERRIDE;
-    virtual String mediaPlayerDocumentHost() const OVERRIDE;
-
     virtual void mediaPlayerEnterFullscreen() OVERRIDE;
     virtual void mediaPlayerExitFullscreen() OVERRIDE;
     virtual bool mediaPlayerIsFullscreen() const OVERRIDE;
diff --git a/Source/core/platform/MIMETypeRegistry.h b/Source/core/platform/MIMETypeRegistry.h
index ee32c32..77fefd7 100644
--- a/Source/core/platform/MIMETypeRegistry.h
+++ b/Source/core/platform/MIMETypeRegistry.h
@@ -64,9 +64,6 @@
     // document in a frame.  Includes supported JavaScript MIME types.
     static bool isSupportedNonImageMIMEType(const String& mimeType);
 
-    // Check to see if a mime type is suitable for being loaded using <video> and <audio>
-    static bool isSupportedMediaMIMEType(const String& mimeType); 
-
     // Check to see if the mime type and codecs are supported by the MediaSource implementation.
     static bool isSupportedMediaSourceMIMEType(const String& mimeType, const String& codecs);
 
diff --git a/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp b/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp
index 20fd6db..709218f 100644
--- a/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp
+++ b/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp
@@ -119,13 +119,6 @@
         != WebKit::WebMimeRegistry::IsNotSupported;
 }
 
-bool MIMETypeRegistry::isSupportedMediaMIMEType(const String& mimeType)
-{
-    HashSet<String> supportedMediaMIMETypes;
-    MediaPlayer::getSupportedTypes(supportedMediaMIMETypes);
-    return !mimeType.isEmpty() && supportedMediaMIMETypes.contains(mimeType);
-}
-
 bool MIMETypeRegistry::isSupportedMediaSourceMIMEType(const String& mimeType, const String& codecs)
 {
     return !mimeType.isEmpty() && !codecs.isEmpty()
diff --git a/Source/core/platform/graphics/MediaPlayer.cpp b/Source/core/platform/graphics/MediaPlayer.cpp
index 03b0104..31f65ce 100644
--- a/Source/core/platform/graphics/MediaPlayer.cpp
+++ b/Source/core/platform/graphics/MediaPlayer.cpp
@@ -43,7 +43,6 @@
 #include "core/platform/graphics/InbandTextTrackPrivate.h"
 
 #include "core/platform/graphics/chromium/MediaPlayerPrivateChromium.h"
-#define PlatformMediaEngineClassName MediaPlayerPrivate
 
 namespace WebCore {
 
@@ -127,61 +126,38 @@
 struct MediaPlayerFactory {
     WTF_MAKE_NONCOPYABLE(MediaPlayerFactory); WTF_MAKE_FAST_ALLOCATED;
 public:
-    MediaPlayerFactory(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsTypeAndCodecs,
-        MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite)
+    MediaPlayerFactory(CreateMediaEnginePlayer constructor, MediaEngineSupportsType supportsTypeAndCodecs)
         : constructor(constructor)
-        , getSupportedTypes(getSupportedTypes)
         , supportsTypeAndCodecs(supportsTypeAndCodecs)
-        , getSitesInMediaCache(getSitesInMediaCache)
-        , clearMediaCache(clearMediaCache)
-        , clearMediaCacheForSite(clearMediaCacheForSite)
     {
     }
 
     CreateMediaEnginePlayer constructor;
-    MediaEngineSupportedTypes getSupportedTypes;
     MediaEngineSupportsType supportsTypeAndCodecs;
-    MediaEngineGetSitesInMediaCache getSitesInMediaCache;
-    MediaEngineClearMediaCache clearMediaCache;
-    MediaEngineClearMediaCacheForSite clearMediaCacheForSite;
 };
 
-static void addMediaEngine(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType, MediaEngineGetSitesInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForSite);
+static void addMediaEngine(CreateMediaEnginePlayer, MediaEngineSupportsType);
 
-static MediaPlayerFactory* bestMediaEngineForTypeAndCodecs(const String& type, const String& codecs, const String& keySystem, const KURL&, MediaPlayerFactory* current = 0);
-static MediaPlayerFactory* nextMediaEngine(MediaPlayerFactory* current);
+// gInstalledEngine should not be accessed directly; call installedMediaEngine() instead.
+static MediaPlayerFactory* gInstalledEngine = 0;
 
-enum RequeryEngineOptions { DoNotResetEngines, ResetEngines };
-static Vector<MediaPlayerFactory*>& installedMediaEngines(RequeryEngineOptions requeryFlags = DoNotResetEngines )
+static MediaPlayerFactory* installedMediaEngine()
 {
-    DEFINE_STATIC_LOCAL(Vector<MediaPlayerFactory*>, installedEngines, ());
     static bool enginesQueried = false;
-
-    if (requeryFlags == ResetEngines) {
-        installedEngines.clear();
-        enginesQueried = false;
-        return installedEngines;
-    }
-
     if (!enginesQueried) {
         enginesQueried = true;
-
-#if defined(PlatformMediaEngineClassName)
-        PlatformMediaEngineClassName::registerMediaEngine(addMediaEngine);
-#endif
+        MediaPlayerPrivate::registerMediaEngine(addMediaEngine);
     }
 
-    return installedEngines;
+    return gInstalledEngine;
 }
 
-static void addMediaEngine(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsType,
-    MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite)
+static void addMediaEngine(CreateMediaEnginePlayer constructor, MediaEngineSupportsType supportsType)
 {
     ASSERT(constructor);
-    ASSERT(getSupportedTypes);
     ASSERT(supportsType);
 
-    installedMediaEngines().append(new MediaPlayerFactory(constructor, getSupportedTypes, supportsType, getSitesInMediaCache, clearMediaCache, clearMediaCacheForSite));
+    gInstalledEngine = new MediaPlayerFactory(constructor, supportsType);
 }
 
 static const AtomicString& applicationOctetStream()
@@ -202,13 +178,13 @@
     return codecs;
 }
 
-static MediaPlayerFactory* bestMediaEngineForTypeAndCodecs(const String& type, const String& codecs, const String& keySystem, const KURL& url, MediaPlayerFactory* current)
+static MediaPlayerFactory* bestMediaEngineForTypeAndCodecs(const String& type, const String& codecs, const String& keySystem, const KURL& url)
 {
     if (type.isEmpty())
         return 0;
 
-    Vector<MediaPlayerFactory*>& engines = installedMediaEngines();
-    if (engines.isEmpty())
+    MediaPlayerFactory* engine = installedMediaEngine();
+    if (!engine)
         return 0;
 
     // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream" 
@@ -219,52 +195,23 @@
             return 0;
     }
 
-    MediaPlayerFactory* engine = 0;
-    MediaPlayer::SupportsType supported = MediaPlayer::IsNotSupported;
-    unsigned count = engines.size();
-    for (unsigned ndx = 0; ndx < count; ndx++) {
-        if (current) {
-            if (current == engines[ndx])
-                current = 0;
-            continue;
-        }
 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2)
-        MediaPlayer::SupportsType engineSupport = engines[ndx]->supportsTypeAndCodecs(type, codecs, keySystem, url);
+    MediaPlayer::SupportsType engineSupport = engine->supportsTypeAndCodecs(type, codecs, keySystem, url);
 #else
-        UNUSED_PARAM(keySystem);
-        ASSERT(keySystem.isEmpty());
-        MediaPlayer::SupportsType engineSupport = engines[ndx]->supportsTypeAndCodecs(type, codecs, url);
+    UNUSED_PARAM(keySystem);
+    ASSERT(keySystem.isEmpty());
+    MediaPlayer::SupportsType engineSupport = engine->supportsTypeAndCodecs(type, codecs, url);
 #endif
-        if (engineSupport > supported) {
-            supported = engineSupport;
-            engine = engines[ndx];
-        }
-    }
+    if (engineSupport > MediaPlayer::IsNotSupported)
+        return engine;
 
-    return engine;
-}
-
-static MediaPlayerFactory* nextMediaEngine(MediaPlayerFactory* current)
-{
-    Vector<MediaPlayerFactory*>& engines = installedMediaEngines();
-    if (engines.isEmpty())
-        return 0;
-
-    if (!current) 
-        return engines.first();
-
-    size_t currentIndex = engines.find(current);
-    if (currentIndex == WTF::notFound || currentIndex + 1 >= engines.size()) 
-        return 0;
-
-    return engines[currentIndex + 1];
+    return 0;
 }
 
 // media player
 
 MediaPlayer::MediaPlayer(MediaPlayerClient* client)
     : m_mediaPlayerClient(client)
-    , m_reloadTimer(this, &MediaPlayer::reloadTimerFired)
     , m_private(createNullMediaPlayer(this))
     , m_currentMediaEngine(0)
     , m_frameView(0)
@@ -311,7 +258,7 @@
         }
     }
 
-    loadWithNextMediaEngine(0);
+    loadWithMediaEngine();
     return m_currentMediaEngine;
 }
 
@@ -323,24 +270,24 @@
     m_url = url;
     m_keySystem = "";
     m_contentMIMETypeWasInferredFromExtension = false;
-    loadWithNextMediaEngine(0);
+    loadWithMediaEngine();
     return m_currentMediaEngine;
 }
 
-void MediaPlayer::loadWithNextMediaEngine(MediaPlayerFactory* current)
+void MediaPlayer::loadWithMediaEngine()
 {
     MediaPlayerFactory* engine = 0;
 
     if (!m_contentMIMEType.isEmpty())
-        engine = bestMediaEngineForTypeAndCodecs(m_contentMIMEType, m_contentTypeCodecs, m_keySystem, m_url, current);
+        engine = bestMediaEngineForTypeAndCodecs(m_contentMIMEType, m_contentTypeCodecs, m_keySystem, m_url);
 
     // If no MIME type is specified or the type was inferred from the file extension, just use the next engine.
     if (!engine && (m_contentMIMEType.isEmpty() || m_contentMIMETypeWasInferredFromExtension))
-        engine = nextMediaEngine(current);
+        engine = installedMediaEngine();
 
     // Don't delete and recreate the player unless it comes from a different engine.
     if (!engine) {
-        LOG(Media, "MediaPlayer::loadWithNextMediaEngine - no media engine found for type \"%s\"", m_contentMIMEType.utf8().data());
+        LOG(Media, "MediaPlayer::loadWithMediaEngine - no media engine found for type \"%s\"", m_contentMIMEType.utf8().data());
         m_currentMediaEngine = engine;
         m_private = nullptr;
     } else if (m_currentMediaEngine != engine) {
@@ -642,7 +589,7 @@
     return m_private->copyVideoTextureToPlatformTexture(context, texture, level, type, internalFormat, premultiplyAlpha, flipY);
 }
 
-MediaPlayer::SupportsType MediaPlayer::supportsType(const ContentType& contentType, const String& keySystem, const KURL& url, const MediaPlayerSupportsTypeClient* client)
+MediaPlayer::SupportsType MediaPlayer::supportsType(const ContentType& contentType, const String& keySystem, const KURL& url)
 {
     String type = contentType.type().lower();
     // The codecs string is not lower-cased because MP4 values are case sensitive
@@ -659,9 +606,6 @@
     if (!engine)
         return IsNotSupported;
 
-    // FIXME: Remove this parameter. This was used by the Mac port.
-    UNUSED_PARAM(client);
-
 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2)
     return engine->supportsTypeAndCodecs(type, typeCodecs, system, url);
 #else
@@ -670,20 +614,9 @@
 #endif
 }
 
-void MediaPlayer::getSupportedTypes(HashSet<String>& types)
-{
-    Vector<MediaPlayerFactory*>& engines = installedMediaEngines();
-    if (engines.isEmpty())
-        return;
-
-    unsigned count = engines.size();
-    for (unsigned ndx = 0; ndx < count; ndx++)
-        engines[ndx]->getSupportedTypes(types);
-} 
-
 bool MediaPlayer::isAvailable()
 {
-    return !installedMediaEngines().isEmpty();
+    return !!installedMediaEngine();
 } 
 
 #if USE(NATIVE_FULLSCREEN_VIDEO)
@@ -760,58 +693,9 @@
     return m_private->videoDecodedByteCount();
 }
 
-void MediaPlayer::reloadTimerFired(Timer<MediaPlayer>*)
-{
-    m_private->cancelLoad();
-    loadWithNextMediaEngine(m_currentMediaEngine);
-}
-
-void MediaPlayer::getSitesInMediaCache(Vector<String>& sites)
-{
-    Vector<MediaPlayerFactory*>& engines = installedMediaEngines();
-    unsigned size = engines.size();
-    for (unsigned i = 0; i < size; i++) {
-        if (!engines[i]->getSitesInMediaCache)
-            continue;
-        Vector<String> engineSites;
-        engines[i]->getSitesInMediaCache(engineSites);
-        sites.append(engineSites);
-    }
-}
-
-void MediaPlayer::clearMediaCache()
-{
-    Vector<MediaPlayerFactory*>& engines = installedMediaEngines();
-    unsigned size = engines.size();
-    for (unsigned i = 0; i < size; i++) {
-        if (engines[i]->clearMediaCache)
-            engines[i]->clearMediaCache();
-    }
-}
-
-void MediaPlayer::clearMediaCacheForSite(const String& site)
-{
-    Vector<MediaPlayerFactory*>& engines = installedMediaEngines();
-    unsigned size = engines.size();
-    for (unsigned i = 0; i < size; i++) {
-        if (engines[i]->clearMediaCacheForSite)
-            engines[i]->clearMediaCacheForSite(site);
-    }
-}
-
 // Client callbacks.
 void MediaPlayer::networkStateChanged()
 {
-    // If more than one media engine is installed and this one failed before finding metadata,
-    // let the next engine try.
-    if (m_private->networkState() >= FormatError
-        && m_private->readyState() < HaveMetadata
-        && installedMediaEngines().size() > 1) {
-        if (m_contentMIMEType.isEmpty() || bestMediaEngineForTypeAndCodecs(m_contentMIMEType, m_contentTypeCodecs, m_keySystem, m_url, m_currentMediaEngine)) {
-            m_reloadTimer.startOneShot(0);
-            return;
-        }
-    }
     if (m_mediaPlayerClient)
         m_mediaPlayerClient->mediaPlayerNetworkStateChanged(this);
 }
@@ -943,14 +827,6 @@
     return m_mediaPlayerClient->mediaPlayerUserAgent();
 }
 
-String MediaPlayer::engineDescription() const
-{
-    if (!m_private)
-        return String();
-
-    return m_private->engineDescription();
-}
-
 CachedResourceLoader* MediaPlayer::cachedResourceLoader()
 {
     if (!m_mediaPlayerClient)
@@ -997,9 +873,4 @@
 }
 #endif // USE(PLATFORM_TEXT_TRACK_MENU)
 
-void MediaPlayer::resetMediaEngines()
-{
-    installedMediaEngines(ResetEngines);
-}
-
 }
diff --git a/Source/core/platform/graphics/MediaPlayer.h b/Source/core/platform/graphics/MediaPlayer.h
index 08d25b5..537f1c6 100644
--- a/Source/core/platform/graphics/MediaPlayer.h
+++ b/Source/core/platform/graphics/MediaPlayer.h
@@ -27,14 +27,12 @@
 #define MediaPlayer_h
 
 #include "core/platform/KURL.h"
-#include "core/platform/Timer.h"
 #include "core/platform/graphics/GraphicsTypes3D.h"
 #include "core/platform/graphics/InbandTextTrackPrivate.h"
 #include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/LayoutRect.h"
 #include "core/platform/graphics/PlatformLayer.h"
 #include <wtf/Forward.h>
-#include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
@@ -205,14 +203,6 @@
     virtual void paintTextTrackRepresentation(GraphicsContext*, const IntRect&) { }
 };
 
-class MediaPlayerSupportsTypeClient {
-public:
-    virtual ~MediaPlayerSupportsTypeClient() { }
-
-    virtual bool mediaPlayerNeedsSiteSpecificHacks() const { return false; }
-    virtual String mediaPlayerDocumentHost() const { return String(); }
-};
-
 class MediaPlayer {
     WTF_MAKE_NONCOPYABLE(MediaPlayer); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -225,12 +215,8 @@
 
     // Media engine support.
     enum SupportsType { IsNotSupported, IsSupported, MayBeSupported };
-    static MediaPlayer::SupportsType supportsType(const ContentType&, const String& keySystem, const KURL&, const MediaPlayerSupportsTypeClient*);
-    static void getSupportedTypes(HashSet<String>&);
+    static MediaPlayer::SupportsType supportsType(const ContentType&, const String& keySystem, const KURL&);
     static bool isAvailable();
-    static void getSitesInMediaCache(Vector<String>&);
-    static void clearMediaCache();
-    static void clearMediaCacheForSite(const String&);
 
     bool supportsFullscreen() const;
     bool supportsSave() const;
@@ -404,8 +390,6 @@
     String referrer() const;
     String userAgent() const;
 
-    String engineDescription() const;
-
     CachedResourceLoader* cachedResourceLoader();
 
     void addTextTrack(PassRefPtr<InbandTextTrackPrivate>);
@@ -414,8 +398,6 @@
     bool requiresTextTrackRepresentation() const;
     void setTextTrackRepresentation(TextTrackRepresentation*);
 
-    static void resetMediaEngines();
-
 #if USE(PLATFORM_TEXT_TRACK_MENU)
     bool implementsTextTrackControls() const;
     PassRefPtr<PlatformTextTrackMenuInterface> textTrackMenu();
@@ -423,13 +405,9 @@
 
 private:
     MediaPlayer(MediaPlayerClient*);
-    void loadWithNextMediaEngine(MediaPlayerFactory*);
-    void reloadTimerFired(Timer<MediaPlayer>*);
-
-    static void initializeMediaEngines();
+    void loadWithMediaEngine();
 
     MediaPlayerClient* m_mediaPlayerClient;
-    Timer<MediaPlayer> m_reloadTimer;
     OwnPtr<MediaPlayerPrivateInterface> m_private;
     MediaPlayerFactory* m_currentMediaEngine;
     KURL m_url;
@@ -451,18 +429,13 @@
 };
 
 typedef PassOwnPtr<MediaPlayerPrivateInterface> (*CreateMediaEnginePlayer)(MediaPlayer*);
-typedef void (*MediaEngineSupportedTypes)(HashSet<String>& types);
 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2)
 typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const String& type, const String& codecs, const String& keySystem, const KURL& url);
 #else
 typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const String& type, const String& codecs, const KURL& url);
 #endif
-typedef void (*MediaEngineGetSitesInMediaCache)(Vector<String>&);
-typedef void (*MediaEngineClearMediaCache)();
-typedef void (*MediaEngineClearMediaCacheForSite)(const String&);
 
-typedef void (*MediaEngineRegistrar)(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType,
-    MediaEngineGetSitesInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForSite);
+typedef void (*MediaEngineRegistrar)(CreateMediaEnginePlayer, MediaEngineSupportsType);
 
 }
 
diff --git a/Source/core/platform/graphics/MediaPlayerPrivate.h b/Source/core/platform/graphics/MediaPlayerPrivate.h
index ecb8beb..4afdc1b 100644
--- a/Source/core/platform/graphics/MediaPlayerPrivate.h
+++ b/Source/core/platform/graphics/MediaPlayerPrivate.h
@@ -148,12 +148,6 @@
     virtual unsigned audioDecodedByteCount() const { return 0; }
     virtual unsigned videoDecodedByteCount() const { return 0; }
 
-    void getSitesInMediaCache(Vector<String>&) { }
-    void clearMediaCache() { }
-    void clearMediaCacheForSite(const String&) { }
-
-    virtual String engineDescription() const { return emptyString(); }
-
 #if ENABLE(WEB_AUDIO)
     virtual AudioSourceProvider* audioSourceProvider() { return 0; }
 #endif