Index: webkit/glue/webmediaplayer_impl.cc |
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc |
index f5b87cf8da1c0302e9c3f1933948acda4b8aa936..2e5090d59561a210137e984eb5e6cfd747139277 100644 |
--- a/webkit/glue/webmediaplayer_impl.cc |
+++ b/webkit/glue/webmediaplayer_impl.cc |
@@ -242,12 +242,25 @@ WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
} |
} |
+WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::client() const { |
+ // TODO(boliu): Remove these? Need locks? |
+ DCHECK(MessageLoop::current() == main_loop_); |
+ DCHECK(client_); |
+ return client_; |
+} |
+ |
+void WebMediaPlayerImpl::setClient(WebKit::WebMediaPlayerClient* new_client) { |
+ // TODO(boliu): Remove these? Need locks? |
+ DCHECK(MessageLoop::current() == main_loop_); |
+ client_ = new_client; |
+} |
+ |
void WebMediaPlayerImpl::load(const WebKit::WebURL& url) { |
DCHECK(MessageLoop::current() == main_loop_); |
DCHECK(proxy_); |
// Handle any volume changes that occured before load(). |
- setVolume(GetClient()->volume()); |
+ setVolume(client()->volume()); |
// Initialize the pipeline. |
SetNetworkState(WebKit::WebMediaPlayer::Loading); |
@@ -299,7 +312,7 @@ void WebMediaPlayerImpl::seek(float seconds) { |
// We still have to notify WebKit that time has changed otherwise |
// HTMLMediaElement gets into an inconsistent state. |
if (pipeline_->GetCurrentTime().ToInternalValue() == 0 && seconds == 0) { |
- GetClient()->timeChanged(); |
+ client()->timeChanged(); |
return; |
} |
@@ -569,7 +582,7 @@ void WebMediaPlayerImpl::WillDestroyCurrentMessageLoop() { |
void WebMediaPlayerImpl::Repaint() { |
DCHECK(MessageLoop::current() == main_loop_); |
- GetClient()->repaint(); |
+ client()->repaint(); |
} |
void WebMediaPlayerImpl::OnPipelineInitialize() { |
@@ -612,14 +625,14 @@ void WebMediaPlayerImpl::OnPipelineSeek() { |
} |
SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); |
- GetClient()->timeChanged(); |
+ client()->timeChanged(); |
} |
} |
void WebMediaPlayerImpl::OnPipelineEnded() { |
DCHECK(MessageLoop::current() == main_loop_); |
if (pipeline_->GetError() == media::PIPELINE_OK) { |
- GetClient()->timeChanged(); |
+ client()->timeChanged(); |
} |
} |
@@ -675,7 +688,7 @@ void WebMediaPlayerImpl::SetNetworkState( |
DCHECK(MessageLoop::current() == main_loop_); |
// Always notify to ensure client has the latest value. |
network_state_ = state; |
- GetClient()->networkStateChanged(); |
+ client()->networkStateChanged(); |
} |
void WebMediaPlayerImpl::SetReadyState( |
@@ -683,7 +696,7 @@ void WebMediaPlayerImpl::SetReadyState( |
DCHECK(MessageLoop::current() == main_loop_); |
// Always notify to ensure client has the latest value. |
ready_state_ = state; |
- GetClient()->readyStateChanged(); |
+ client()->readyStateChanged(); |
} |
void WebMediaPlayerImpl::Destroy() { |
@@ -708,10 +721,4 @@ void WebMediaPlayerImpl::PipelineStoppedCallback() { |
pipeline_stopped_.Signal(); |
} |
-WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
- DCHECK(MessageLoop::current() == main_loop_); |
- DCHECK(client_); |
- return client_; |
-} |
- |
} // namespace webkit_glue |