Commit b02df768 authored by srirama.m@samsung.com's avatar srirama.m@samsung.com

Eliminate MediaPlayer & MediaPlayerClient abstractions(readystate)

BUG=350571

Review URL: https://codereview.chromium.org/318923004

git-svn-id: svn://svn.chromium.org/blink/trunk@175723 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent de3a7171
......@@ -1234,9 +1234,9 @@ bool HTMLMediaElement::textTracksAreReady() const
void HTMLMediaElement::textTrackReadyStateChanged(TextTrack* track)
{
if (m_player && m_textTracksWhenResourceSelectionBegan.contains(track)) {
if (webMediaPlayer()&& m_textTracksWhenResourceSelectionBegan.contains(track)) {
if (track->readinessState() != TextTrack::Loading)
setReadyState(m_player->readyState());
setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState()));
} else {
// The track readiness state might have changed as a result of the user
// clicking the captions button. In this case, a check whether all the
......@@ -1588,10 +1588,10 @@ void HTMLMediaElement::changeNetworkStateFromLoadingToIdle()
void HTMLMediaElement::mediaPlayerReadyStateChanged()
{
setReadyState(m_player->readyState());
setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState()));
}
void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
void HTMLMediaElement::setReadyState(ReadyState state)
{
WTF_LOG(Media, "HTMLMediaElement::setReadyState(%d) - current state is %d,", static_cast<int>(state), static_cast<int>(m_readyState));
......@@ -1599,7 +1599,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
bool wasPotentiallyPlaying = potentiallyPlaying();
ReadyState oldState = m_readyState;
ReadyState newState = static_cast<ReadyState>(state);
ReadyState newState = state;
bool tracksAreReady = textTracksAreReady();
......
......@@ -324,7 +324,7 @@ private:
virtual void updateDisplayState() { }
void setReadyState(MediaPlayer::ReadyState);
void setReadyState(ReadyState);
void setNetworkState(MediaPlayer::NetworkState);
virtual void mediaPlayerNetworkStateChanged() OVERRIDE FINAL;
......
......@@ -124,15 +124,11 @@ ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
// This variant does not work in worker threads.
ASSERT(eventTarget.toDOMWindow());
if (!video->player()) {
exceptionState.throwDOMException(InvalidStateError, "No player can be retrieved from the provided video element.");
return ScriptPromise();
}
if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) {
exceptionState.throwDOMException(InvalidStateError, "The provided element has not retrieved data.");
return ScriptPromise();
}
if (video->player()->readyState() <= MediaPlayer::HaveMetadata) {
if (video->readyState() <= HTMLMediaElement::HAVE_METADATA) {
exceptionState.throwDOMException(InvalidStateError, "The provided element's player has no current data.");
return ScriptPromise();
}
......@@ -144,7 +140,7 @@ ScriptPromise ImageBitmapFactories::createImageBitmap(ScriptState* scriptState,
exceptionState.throwSecurityError("The source video contains image data from multiple origins.");
return ScriptPromise();
}
if (!(video->webMediaPlayer() && video->webMediaPlayer()->didPassCORSAccessCheck())
if (!video->webMediaPlayer()->didPassCORSAccessCheck()
&& eventTarget.toDOMWindow()->document()->securityOrigin()->taintsCanvas(video->currentSrc())) {
exceptionState.throwSecurityError("Cross-origin access to the source video is denied.");
return ScriptPromise();
......
......@@ -135,9 +135,6 @@ public:
enum NetworkState { Empty, Idle, Loading, Loaded, FormatError, NetworkError, DecodeError };
virtual NetworkState networkState() const = 0;
enum ReadyState { HaveNothing, HaveMetadata, HaveCurrentData, HaveFutureData, HaveEnoughData };
virtual ReadyState readyState() const = 0;
virtual double maxTimeSeekable() const = 0;
virtual PassRefPtr<TimeRanges> buffered() const = 0;
......
......@@ -45,6 +45,7 @@
#include "core/frame/csp/ContentSecurityPolicy.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/shadow/TextControlInnerElements.h"
#include "core/loader/FrameLoaderTypes.h"
#include "core/loader/NavigationPolicy.h"
......@@ -415,11 +416,11 @@ COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateFormatError, MediaPlaye
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateNetworkError, MediaPlayer::NetworkError);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateDecodeError, MediaPlayer::DecodeError);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveNothing, MediaPlayer::HaveNothing);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveMetadata, MediaPlayer::HaveMetadata);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveCurrentData, MediaPlayer::HaveCurrentData);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveFutureData, MediaPlayer::HaveFutureData);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveEnoughData, MediaPlayer::HaveEnoughData);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveNothing, HTMLMediaElement::HAVE_NOTHING);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveMetadata, HTMLMediaElement::HAVE_METADATA);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveCurrentData, HTMLMediaElement::HAVE_CURRENT_DATA);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveFutureData, HTMLMediaElement::HAVE_FUTURE_DATA);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveEnoughData, HTMLMediaElement::HAVE_ENOUGH_DATA);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::PreloadNone, MediaPlayer::None);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::PreloadMetaData, MediaPlayer::MetaData);
......
......@@ -283,13 +283,6 @@ MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
return MediaPlayer::Empty;
}
MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const
{
if (m_webMediaPlayer)
return static_cast<MediaPlayer::ReadyState>(m_webMediaPlayer->readyState());
return MediaPlayer::HaveNothing;
}
double WebMediaPlayerClientImpl::maxTimeSeekable() const
{
if (m_webMediaPlayer)
......
......@@ -106,7 +106,6 @@ public:
virtual bool paused() const OVERRIDE;
virtual void setPoster(const WebCore::KURL&) OVERRIDE;
virtual WebCore::MediaPlayer::NetworkState networkState() const OVERRIDE;
virtual WebCore::MediaPlayer::ReadyState readyState() const OVERRIDE;
virtual double maxTimeSeekable() const OVERRIDE;
virtual WTF::PassRefPtr<WebCore::TimeRanges> buffered() const OVERRIDE;
virtual bool didLoadingProgress() const OVERRIDE;
......
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