summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 23:49:03 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 23:49:03 +0000
commit037958af0fa3a7541a067b72bb904a4c67452f73 (patch)
treeb13ed5c7c42220b579fc17c51064a9f1cd94a8e6
parent340ba394b3b34db9c805418c5e54f37e3b264bd2 (diff)
downloadchromium_src-037958af0fa3a7541a067b72bb904a4c67452f73.zip
chromium_src-037958af0fa3a7541a067b72bb904a4c67452f73.tar.gz
chromium_src-037958af0fa3a7541a067b72bb904a4c67452f73.tar.bz2
Refactor DataSourceImpl to get rid of using ReleaseRendererResource for cleanup
The previous model of waiting in Stop() was extremely bad, it created a lot of deadlocks and made cleanup harder. What should be the correct way of doing cleanup is that DataSourceImpl should signal it has stopped so no more activity in other threads, post a task on render thread to do final cleanup on that thread, if render thread is dying then it's simply leaked and don't care. This refactoring helped cleanup some ugly pattern in cleaning up. Review URL: http://codereview.chromium.org/77008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13984 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/media/audio_renderer_impl.cc46
-rw-r--r--chrome/renderer/media/audio_renderer_impl.h3
-rw-r--r--chrome/renderer/media/data_source_impl.cc179
-rw-r--r--chrome/renderer/media/data_source_impl.h27
-rw-r--r--chrome/renderer/webmediaplayer_delegate_impl.cc29
-rw-r--r--chrome/renderer/webmediaplayer_delegate_impl.h9
6 files changed, 128 insertions, 165 deletions
diff --git a/chrome/renderer/media/audio_renderer_impl.cc b/chrome/renderer/media/audio_renderer_impl.cc
index 4f0627c..46907ee 100644
--- a/chrome/renderer/media/audio_renderer_impl.cc
+++ b/chrome/renderer/media/audio_renderer_impl.cc
@@ -28,16 +28,6 @@ AudioRendererImpl::AudioRendererImpl(AudioMessageFilter* filter)
AudioRendererImpl::~AudioRendererImpl() {
}
-bool AudioRendererImpl::HasStopped() {
- AutoLock auto_lock(lock_);
- return stopped_;
-}
-
-void AudioRendererImpl::SignalStop() {
- AutoLock auto_lock(lock_);
- stopped_ = true;
-}
-
bool AudioRendererImpl::IsMediaFormatSupported(
const media::MediaFormat& media_format) {
int channels;
@@ -65,18 +55,19 @@ bool AudioRendererImpl::OnInitialize(const media::MediaFormat& media_format) {
}
void AudioRendererImpl::OnStop() {
- if (HasStopped())
+ AutoLock auto_lock(lock_);
+ if (stopped_)
return;
+ stopped_ = true;
- SignalStop();
io_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &AudioRendererImpl::OnDestroy));
}
void AudioRendererImpl::OnReadComplete(media::Buffer* buffer_in) {
- if (HasStopped())
+ AutoLock auto_lock(lock_);
+ if (stopped_)
return;
-
// Use the base class to queue the buffer.
AudioRendererBase::OnReadComplete(buffer_in);
// Post a task to render thread to notify a packet reception.
@@ -85,9 +76,6 @@ void AudioRendererImpl::OnReadComplete(media::Buffer* buffer_in) {
}
void AudioRendererImpl::SetPlaybackRate(float rate) {
- if (HasStopped())
- return;
-
// TODO(hclam): handle playback rates not equal to 1.0.
if (rate == 1.0f) {
// TODO(hclam): what should I do here? OnCreated has fired StartAudioStream
@@ -98,9 +86,9 @@ void AudioRendererImpl::SetPlaybackRate(float rate) {
}
void AudioRendererImpl::SetVolume(float volume) {
- if (HasStopped())
+ AutoLock auto_lock(lock_);
+ if (stopped_)
return;
-
// TODO(hclam): change this to multichannel if possible.
io_loop_->PostTask(FROM_HERE,
NewRunnableMethod(
@@ -111,7 +99,8 @@ void AudioRendererImpl::OnCreated(base::SharedMemoryHandle handle,
size_t length) {
DCHECK(MessageLoop::current() == io_loop_);
- if (HasStopped())
+ AutoLock auto_lock(lock_);
+ if (stopped_)
return;
shared_memory_.reset(new base::SharedMemory(handle, false));
@@ -134,7 +123,8 @@ void AudioRendererImpl::OnStateChanged(AudioOutputStream::State state,
int info) {
DCHECK(MessageLoop::current() == io_loop_);
- if (HasStopped())
+ AutoLock auto_lock(lock_);
+ if (stopped_)
return;
switch (state) {
@@ -152,9 +142,6 @@ void AudioRendererImpl::OnStateChanged(AudioOutputStream::State state,
}
void AudioRendererImpl::OnVolume(double left, double right) {
- if (HasStopped())
- return;
-
// TODO(hclam): decide whether we need to report the current volume to
// pipeline.
}
@@ -164,7 +151,8 @@ void AudioRendererImpl::OnCreateStream(
int bits_per_sample, size_t packet_size) {
DCHECK(MessageLoop::current() == io_loop_);
- if (HasStopped())
+ AutoLock auto_lock(lock_);
+ if (stopped_)
return;
// Make sure we don't call create more than once.
@@ -191,18 +179,18 @@ void AudioRendererImpl::OnDestroy() {
void AudioRendererImpl::OnSetVolume(double left, double right) {
DCHECK(MessageLoop::current() == io_loop_);
- if (HasStopped())
+ AutoLock auto_lock(lock_);
+ if (stopped_)
return;
-
filter_->Send(new ViewHostMsg_SetAudioVolume(0, stream_id_, left, right));
}
void AudioRendererImpl::OnNotifyPacketReady() {
DCHECK(MessageLoop::current() == io_loop_);
- if (HasStopped())
+ AutoLock auto_lock(lock_);
+ if (stopped_)
return;
-
if (packet_request_event_.IsSignaled()) {
DCHECK(shared_memory_.get());
// Fill into the shared memory.
diff --git a/chrome/renderer/media/audio_renderer_impl.h b/chrome/renderer/media/audio_renderer_impl.h
index 3628e44..1181b87 100644
--- a/chrome/renderer/media/audio_renderer_impl.h
+++ b/chrome/renderer/media/audio_renderer_impl.h
@@ -143,9 +143,6 @@ class AudioRendererImpl : public media::AudioRendererBase,
explicit AudioRendererImpl(AudioMessageFilter* filter);
virtual ~AudioRendererImpl();
- bool HasStopped();
- void SignalStop();
-
// Methods call on IO thread ------------------------------------------------
// The following methods are tasks posted on the IO thread that needs to
// be executed on that thread. They interact with AudioMessageFilter and
diff --git a/chrome/renderer/media/data_source_impl.cc b/chrome/renderer/media/data_source_impl.cc
index 4046f83..db4f42c 100644
--- a/chrome/renderer/media/data_source_impl.cc
+++ b/chrome/renderer/media/data_source_impl.cc
@@ -10,7 +10,6 @@
#include "chrome/renderer/webmediaplayer_delegate_impl.h"
#include "chrome/renderer/render_thread.h"
#include "media/base/filter_host.h"
-#include "media/base/pipeline.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "webkit/glue/webappcachecontext.h"
@@ -25,7 +24,6 @@ DataSourceImpl::DataSourceImpl(WebMediaPlayerDelegateImpl* delegate)
total_bytes_known_(false),
download_completed_(false),
resource_loader_bridge_(NULL),
- resource_release_event_(true, false),
read_event_(false, false),
ALLOW_THIS_IN_INITIALIZER_LIST(
read_callback_(this, &DataSourceImpl::OnDidFileStreamRead)),
@@ -34,20 +32,17 @@ DataSourceImpl::DataSourceImpl(WebMediaPlayerDelegateImpl* delegate)
position_(0),
io_loop_(delegate->view()->GetMessageLoopForIO()),
seek_event_(false, false) {
- // Register ourselves with WebMediaPlayerDelgateImpl.
- delegate_->SetDataSource(this);
}
DataSourceImpl::~DataSourceImpl() {
}
void DataSourceImpl::Stop() {
+ AutoLock auto_lock(lock_);
if (stopped_)
return;
stopped_ = true;
- delegate_->SetDataSource(NULL);
-
// Wakes up demuxer waiting on |read_event_| in Read().
read_event_.Signal();
// Wakes up demuxer waiting on |seek_event_| in SetPosition().
@@ -55,13 +50,8 @@ void DataSourceImpl::Stop() {
// Wakes up demuxer waiting on |download_event_| in Read() or SetPosition().
download_event_.Signal();
- if (!resource_release_event_.IsSignaled()) {
- render_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &DataSourceImpl::ReleaseResources, false));
- // We wait until the resource is released to make sure we won't receive
- // any call from render thread when we wake up.
- resource_release_event_.Wait();
- }
+ render_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &DataSourceImpl::OnDestroy));
}
bool DataSourceImpl::Initialize(const std::string& url) {
@@ -76,27 +66,44 @@ bool DataSourceImpl::Initialize(const std::string& url) {
size_t DataSourceImpl::Read(uint8* data, size_t size) {
DCHECK(stream_.get());
// Wait until we have downloaded the requested bytes.
- while (!stopped_) {
+ while (true) {
{
AutoLock auto_lock(lock_);
- if (download_completed_ || position_ + size <= downloaded_bytes_)
+ if (stopped_ || download_completed_ ||
+ position_ + size <= downloaded_bytes_)
break;
}
download_event_.Wait();
}
last_read_size_ = media::DataSource::kReadError;
- if (!stopped_) {
- if (logging::DEBUG_MODE) {
- AutoLock auto_lock(lock_);
- DCHECK(download_completed_ || position_ + size <= downloaded_bytes_);
+ if (logging::DEBUG_MODE) {
+ AutoLock auto_lock(lock_);
+ DCHECK(stopped_ || download_completed_ ||
+ position_ + size <= downloaded_bytes_);
+ }
+
+ // Post a task to IO message loop to perform the actual reading.
+ bool task_posted = false;
+ {
+ AutoLock auto_lock(lock_);
+ if (!stopped_) {
+ io_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &DataSourceImpl::OnReadFileStream,
+ data, size));
+ task_posted = true;
}
- // Post a task to IO message loop to perform the actual reading.
- io_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &DataSourceImpl::OnReadFileStream, data, size));
+ }
+
+ if (task_posted)
read_event_.Wait();
+
+ {
+ AutoLock auto_lock(lock_);
+ if (!stopped_)
+ return last_read_size_;
+ return media::DataSource::kReadError;
}
- return last_read_size_;
}
bool DataSourceImpl::GetPosition(int64* position_out) {
@@ -107,38 +114,48 @@ bool DataSourceImpl::GetPosition(int64* position_out) {
bool DataSourceImpl::SetPosition(int64 position) {
DCHECK(stream_.get());
- while (!stopped_) {
+ while (true) {
{
AutoLock auto_lock(lock_);
- if (download_completed_ || position < downloaded_bytes_)
+ if (stopped_ || download_completed_ || position < downloaded_bytes_)
break;
}
download_event_.Wait();
}
- if (!stopped_) {
- if (logging::DEBUG_MODE) {
- AutoLock auto_lock_(lock_);
- DCHECK(download_completed_ || position < downloaded_bytes_);
+
+ if (logging::DEBUG_MODE) {
+ AutoLock auto_lock(lock_);
+ DCHECK(stopped_ || download_completed_ || position < downloaded_bytes_);
+ }
+
+ // Perform the seek operation on IO message loop.
+ bool task_posted = false;
+ {
+ AutoLock auto_lock(lock_);
+ if (!stopped_) {
+ io_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this,
+ &DataSourceImpl::OnSeekFileStream, net::FROM_BEGIN, position));
+ task_posted = true;
}
- // Perform the seek operation on IO message loop.
- io_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &DataSourceImpl::OnSeekFileStream, net::FROM_BEGIN, position));
+ }
+ if (task_posted)
seek_event_.Wait();
- if (!stopped_ && logging::DEBUG_MODE) {
- AutoLock auto_lock_(lock_);
- DCHECK(position == position_);
- }
+
+ if (logging::DEBUG_MODE) {
+ AutoLock auto_lock_(lock_);
+ DCHECK(stopped_ || position == position_);
}
return true;
}
bool DataSourceImpl::GetSize(int64* size_out) {
AutoLock auto_lock(lock_);
- if (!stopped_ && total_bytes_known_) {
+ if (total_bytes_known_) {
*size_out = total_bytes_;
return true;
}
+ *size_out = 0;
return false;
}
@@ -149,6 +166,9 @@ bool DataSourceImpl::IsSeekable() {
}
void DataSourceImpl::OnCreateFileStream(base::PlatformFile file) {
+ AutoLock auto_lock(lock_);
+ if (stopped_)
+ return;
stream_.reset(
new net::FileStream(
file, base::PLATFORM_FILE_READ | base::PLATFORM_FILE_ASYNC));
@@ -157,40 +177,38 @@ void DataSourceImpl::OnCreateFileStream(base::PlatformFile file) {
}
void DataSourceImpl::OnReadFileStream(uint8* data, size_t size) {
- if (!stopped_ && stream_.get()) {
- // net::FileStream::Read wants a char*, not uint8*.
- char* c_data = reinterpret_cast<char*>(data);
- COMPILE_ASSERT(sizeof(*c_data) == sizeof(*data), data_not_sizeof_char);
-
- // This method IO operation is asynchronous, it is expected to return
- // ERROR_IO_PENDING, when the operation is done, OnDidFileStreamRead() will
- // be called. Since the file handle is asynchronous, return value other
- // than ERROR_IO_PENDING is an error.
- if (stream_->Read(c_data, size, &read_callback_) != net::ERR_IO_PENDING) {
- host_->Error(media::PIPELINE_ERROR_READ);
+ int error = net::ERR_IO_PENDING;
+ {
+ AutoLock auto_lock(lock_);
+ if (!stopped_) {
+ // net::FileStream::Read wants a char*, not uint8*.
+ char* c_data = reinterpret_cast<char*>(data);
+ COMPILE_ASSERT(sizeof(*c_data) == sizeof(*data), data_not_sizeof_char);
+ error = stream_->Read(c_data, size, &read_callback_);
}
}
+
+ // Since the file handle is asynchronous, return value other than
+ // ERROR_IO_PENDING is an error.
+ if (error != net::ERR_IO_PENDING) {
+ HandleError(media::PIPELINE_ERROR_READ);
+ }
}
void DataSourceImpl::OnSeekFileStream(net::Whence whence, int64 position) {
- if (!stopped_ && stream_.get()) {
- int64 new_position = stream_->Seek(whence, position);
- // Make the critical section as small as possible, because we can't assume
- // anything inside Seek() method above.
- {
- AutoLock auto_lock(lock_);
- position_ = new_position;
- }
+ {
+ AutoLock auto_lock(lock_);
+ if (!stopped_)
+ position_ = stream_->Seek(whence, position);
}
seek_event_.Signal();
}
void DataSourceImpl::OnDidFileStreamRead(int size) {
if (size < 0) {
- host_->Error(media::PIPELINE_ERROR_READ);
+ HandleError(media::PIPELINE_ERROR_READ);
} else {
AutoLock auto_lock(lock_);
- // TODO(hclam): size may be an error code, handle that.
position_ += size;
}
last_read_size_ = size;
@@ -200,7 +218,7 @@ void DataSourceImpl::OnDidFileStreamRead(int size) {
void DataSourceImpl::OnInitialize(std::string uri) {
uri_ = uri;
// Create the resource loader bridge.
- resource_loader_bridge_ =
+ resource_loader_bridge_.reset(
RenderThread::current()->resource_dispatcher()->CreateBridge(
"GET",
GURL(uri),
@@ -219,23 +237,15 @@ void DataSourceImpl::OnInitialize(std::string uri) {
// app_cache_context()->context_id()
// For now don't service media resource requests from the appcache.
WebAppCacheContext::kNoAppCacheContextId,
- delegate_->view()->routing_id());
+ delegate_->view()->routing_id()));
// Start the resource loading.
resource_loader_bridge_->Start(this);
}
-void DataSourceImpl::ReleaseResources(bool render_thread_is_dying) {
+void DataSourceImpl::OnDestroy() {
DCHECK(MessageLoop::current() == render_loop_);
- if (render_thread_is_dying) {
- // If render thread is dying we can't call cancel on this pointer, we will
- // just let this object leak.
- resource_loader_bridge_ = NULL;
- } else if (resource_loader_bridge_) {
- resource_loader_bridge_->Cancel();
- delete resource_loader_bridge_;
- resource_loader_bridge_ = NULL;
- }
- resource_release_event_.Signal();
+ resource_loader_bridge_->Cancel();
+ resource_loader_bridge_.reset();
}
void DataSourceImpl::OnDownloadProgress(uint64 position, uint64 size) {
@@ -281,13 +291,19 @@ void DataSourceImpl::OnReceivedResponse(
total_bytes_ = info.content_length;
}
- // Post a task to the IO message loop to create the file stream.
- io_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &DataSourceImpl::OnCreateFileStream,
- response_data_file));
+ {
+ // Post a task to the IO message loop to create the file stream.
+ // We don't want to post any more tasks once we are stopped.
+ AutoLock auto_lock(lock_);
+ if (!stopped_) {
+ io_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &DataSourceImpl::OnCreateFileStream,
+ response_data_file));
+ }
+ }
} else {
// TODO(hclam): handle the fallback case of using memory buffer here.
- host_->Error(media::PIPELINE_ERROR_NETWORK);
+ HandleError(media::PIPELINE_ERROR_NETWORK);
}
}
@@ -304,7 +320,14 @@ void DataSourceImpl::OnCompletedRequest(const URLRequestStatus& status,
download_completed_ = true;
}
if (status.status() != URLRequestStatus::SUCCESS) {
- host_->Error(media::PIPELINE_ERROR_NETWORK);
+ HandleError(media::PIPELINE_ERROR_NETWORK);
+ }
+}
+
+void DataSourceImpl::HandleError(media::PipelineError error) {
+ AutoLock auto_lock(lock_);
+ if (!stopped_) {
+ host_->Error(error);
}
}
diff --git a/chrome/renderer/media/data_source_impl.h b/chrome/renderer/media/data_source_impl.h
index c56be77..d76f0d4 100644
--- a/chrome/renderer/media/data_source_impl.h
+++ b/chrome/renderer/media/data_source_impl.h
@@ -41,7 +41,7 @@
// |-- OnReceivedData()
// |-- OnCompletedRequest()
// |-- GetURLForDebugging()
-// \-- ReleaseResources()
+// \-- OnDestroy()
//
// Pipeline thread
// +-- Initialize()
@@ -84,6 +84,7 @@
#include "media/base/factory.h"
#include "media/base/filters.h"
#include "media/base/media_format.h"
+#include "media/base/pipeline.h"
#include "net/base/completion_callback.h"
#include "net/base/file_stream.h"
#include "webkit/glue/resource_loader_bridge.h"
@@ -114,21 +115,6 @@ class DataSourceImpl : public media::DataSource,
const std::string& security_info);
virtual std::string GetURLForDebugging();
- // Release all resources associated with RenderView, particularly
- // ResourceLoaderBridge created by ResourceDispatcher. This method should only
- // be executed on render thread.
- // There are three cases for this method to be called:
- // 1. Posted as a task from DataSourceImpl::Stop() caused by an error in the
- // pipeline.
- // 2. WebMediaPlayerDelegateImpl is being destroyed and all resources
- // associated with the pipeline should go away. In this case we can call
- // to objects that live inside render thread to cleanup,
- // e.g. ResourceDispatcher.
- // 3. RenderThread is being destroyed, in this case we can't access any
- // object that lives inside render thread and should let the resources
- // leak.
- void ReleaseResources(bool is_render_thread_dying);
-
// Methods called from pipeline thread --------------------------------------
virtual bool Initialize(const std::string& url);
// media::MediaFilter implementation.
@@ -147,6 +133,9 @@ class DataSourceImpl : public media::DataSource,
private:
friend class media::FilterFactoryImpl1<DataSourceImpl,
WebMediaPlayerDelegateImpl*>;
+ // Call to filter host to trigger an error, be sure not to call this method
+ // while the lock is acquired.
+ void HandleError(media::PipelineError error);
// Methods called from render thread ----------------------------------------
explicit DataSourceImpl(WebMediaPlayerDelegateImpl* delegate);
@@ -155,6 +144,7 @@ class DataSourceImpl : public media::DataSource,
// Tasks to be posted on render thread.
void OnInitialize(std::string uri);
void OnCancel();
+ void OnDestroy();
// Methods called from IO thread --------------------------------------------
// Handlers for file reading.
@@ -174,8 +164,6 @@ class DataSourceImpl : public media::DataSource,
// A common lock for protecting members accessed by multiple threads.
Lock lock_;
-
- // A flag that indicates whether this object has been called to stop.
bool stopped_;
// URI to the resource being downloaded.
@@ -189,8 +177,7 @@ class DataSourceImpl : public media::DataSource,
bool download_completed_;
// Members related to resource loading with RenderView.
- webkit_glue::ResourceLoaderBridge* resource_loader_bridge_;
- base::WaitableEvent resource_release_event_;
+ scoped_ptr<webkit_glue::ResourceLoaderBridge> resource_loader_bridge_;
// Members used for reading.
base::WaitableEvent read_event_;
diff --git a/chrome/renderer/webmediaplayer_delegate_impl.cc b/chrome/renderer/webmediaplayer_delegate_impl.cc
index d605a99..5814389 100644
--- a/chrome/renderer/webmediaplayer_delegate_impl.cc
+++ b/chrome/renderer/webmediaplayer_delegate_impl.cc
@@ -58,7 +58,6 @@ WebMediaPlayerDelegateImpl::WebMediaPlayerDelegateImpl(RenderView* view)
main_loop_(NULL),
filter_factory_(new media::FilterFactoryCollection()),
video_renderer_(NULL),
- data_source_(NULL),
web_media_player_(NULL),
view_(view),
tasks_(kLastTaskIndex) {
@@ -76,9 +75,7 @@ WebMediaPlayerDelegateImpl::WebMediaPlayerDelegateImpl(RenderView* view)
}
WebMediaPlayerDelegateImpl::~WebMediaPlayerDelegateImpl() {
- // Stop the pipeline in the first place so we won't receive any more method
- // calls from it.
- StopPipeline(false);
+ pipeline_.Stop();
// Cancel all tasks posted on the main_loop_.
CancelAllTasks();
@@ -141,7 +138,7 @@ void WebMediaPlayerDelegateImpl::Stop() {
DCHECK(main_loop_ && MessageLoop::current() == main_loop_);
// We can fire Stop() multiple times.
- StopPipeline(false);
+ pipeline_.Stop();
}
void WebMediaPlayerDelegateImpl::Seek(float time) {
@@ -293,7 +290,7 @@ void WebMediaPlayerDelegateImpl::Paint(skia::PlatformCanvas *canvas,
}
void WebMediaPlayerDelegateImpl::WillDestroyCurrentMessageLoop() {
- StopPipeline(true);
+ pipeline_.Stop();
}
void WebMediaPlayerDelegateImpl::DidInitializePipeline(bool successful) {
@@ -320,11 +317,6 @@ void WebMediaPlayerDelegateImpl::SetVideoRenderer(
video_renderer_ = video_renderer;
}
-void WebMediaPlayerDelegateImpl::SetDataSource(
- DataSourceImpl* data_source) {
- data_source_ = data_source;
-}
-
void WebMediaPlayerDelegateImpl::DidTask(CancelableTask* task) {
AutoLock auto_lock(task_lock_);
@@ -361,18 +353,3 @@ void WebMediaPlayerDelegateImpl::PostTask(int index,
void WebMediaPlayerDelegateImpl::PostRepaintTask() {
PostTask(kRepaintTaskIndex, &webkit_glue::WebMediaPlayer::Repaint);
}
-
-void WebMediaPlayerDelegateImpl::StopPipeline(bool render_thread_is_dying) {
- // Instruct the renderers and data source to release all Renderer related
- // resources during destruction of render thread, because they won't have any
- // chance to release these resources on render thread by posting tasks on it.
- if (data_source_) {
- data_source_->ReleaseResources(render_thread_is_dying);
- data_source_ = NULL;
- }
-
- // Stop the pipeline when the render thread is being destroyed so we won't be
- // posting any more messages onto it. And we just let this object and
- // associated WebMediaPlayer to leak.
- pipeline_.Stop();
-}
diff --git a/chrome/renderer/webmediaplayer_delegate_impl.h b/chrome/renderer/webmediaplayer_delegate_impl.h
index b104ee6..08a108d 100644
--- a/chrome/renderer/webmediaplayer_delegate_impl.h
+++ b/chrome/renderer/webmediaplayer_delegate_impl.h
@@ -142,9 +142,7 @@ class WebMediaPlayerDelegateImpl : public webkit_glue::WebMediaPlayerDelegate,
// Public methods to be called from renderers and data source so that
// WebMediaPlayerDelegateImpl has references to them.
- void SetAudioRenderer(AudioRendererImpl* audio_renderer);
void SetVideoRenderer(VideoRendererImpl* video_renderer);
- void SetDataSource(DataSourceImpl* data_source);
// Called from VideoRenderer to fire a repaint task to main_loop_.
void PostRepaintTask();
@@ -161,10 +159,6 @@ class WebMediaPlayerDelegateImpl : public webkit_glue::WebMediaPlayerDelegate,
// Cancel all tasks currently lives in |main_loop_|.
void CancelAllTasks();
- // Calls to renderers and data source to release all resources that live in
- // render thread and stop the pipeline.
- void StopPipeline(bool render_thread_is_dying);
-
// Indexes for tasks.
enum {
kRepaintTaskIndex = 0,
@@ -192,9 +186,6 @@ class WebMediaPlayerDelegateImpl : public webkit_glue::WebMediaPlayerDelegate,
// from WebKit.
scoped_refptr<VideoRendererImpl> video_renderer_;
- // Pointer to DataSourceImpl so we can release render resources.
- scoped_refptr<DataSourceImpl> data_source_;
-
webkit_glue::WebMediaPlayer* web_media_player_;
RenderView* view_;