Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: webkit/glue/media/buffered_data_source.cc

Issue 7484054: Migrate Pipeline & PipelineImpl to PipelineStatusCB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix CR nits Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/media/buffered_data_source.h ('k') | webkit/glue/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/media/buffered_data_source.cc
diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc
index c125dd63de129d1bea64f5a630389fd04ec6adf0..1a008cbd991e73635943067738fb3b6fd4037417 100644
--- a/webkit/glue/media/buffered_data_source.cc
+++ b/webkit/glue/media/buffered_data_source.cc
@@ -46,7 +46,6 @@ BufferedDataSource::BufferedDataSource(
frame_(frame),
loader_(NULL),
network_activity_(false),
- initialize_callback_(NULL),
read_callback_(NULL),
read_position_(0),
read_size_(0),
@@ -85,23 +84,21 @@ void BufferedDataSource::set_host(media::FilterHost* host) {
}
void BufferedDataSource::Initialize(const std::string& url,
- media::PipelineStatusCallback* callback) {
+ const media::PipelineStatusCB& callback) {
// Saves the url.
url_ = GURL(url);
// This data source doesn't support data:// protocol so reject it.
if (url_.SchemeIs(kDataScheme)) {
- callback->Run(media::DATASOURCE_ERROR_URL_NOT_SUPPORTED);
- delete callback;
+ callback.Run(media::DATASOURCE_ERROR_URL_NOT_SUPPORTED);
return;
} else if (!IsProtocolSupportedForMedia(url_)) {
- callback->Run(media::PIPELINE_ERROR_NETWORK);
- delete callback;
+ callback.Run(media::PIPELINE_ERROR_NETWORK);
return;
}
- DCHECK(callback);
- initialize_callback_.reset(callback);
+ DCHECK(!callback.is_null());
+ initialize_cb_ = callback;
// Post a task to complete the initialization task.
render_loop_->PostTask(FROM_HERE,
@@ -110,9 +107,9 @@ void BufferedDataSource::Initialize(const std::string& url,
void BufferedDataSource::CancelInitialize() {
base::AutoLock auto_lock(lock_);
- DCHECK(initialize_callback_.get());
+ DCHECK(!initialize_cb_.is_null());
- initialize_callback_.reset();
+ initialize_cb_.Reset();
render_loop_->PostTask(
FROM_HERE, NewRunnableMethod(this, &BufferedDataSource::CleanupTask));
@@ -202,7 +199,7 @@ void BufferedDataSource::Abort() {
void BufferedDataSource::InitializeTask() {
DCHECK(MessageLoop::current() == render_loop_);
DCHECK(!loader_.get());
- if (stopped_on_render_loop_ || !initialize_callback_.get())
+ if (stopped_on_render_loop_ || initialize_cb_.is_null())
return;
if (url_.SchemeIs(kHttpScheme) || url_.SchemeIs(kHttpsScheme)) {
@@ -379,12 +376,11 @@ void BufferedDataSource::DoneRead_Locked(int error) {
void BufferedDataSource::DoneInitialization_Locked(
media::PipelineStatus status) {
DCHECK(MessageLoop::current() == render_loop_);
- DCHECK(initialize_callback_.get());
+ DCHECK(!initialize_cb_.is_null());
lock_.AssertAcquired();
- scoped_ptr<media::PipelineStatusCallback> initialize_callback(
- initialize_callback_.release());
- initialize_callback->Run(status);
+ initialize_cb_.Run(status);
+ initialize_cb_.Reset();
}
/////////////////////////////////////////////////////////////////////////////
@@ -396,7 +392,7 @@ void BufferedDataSource::HttpInitialStartCallback(int error) {
int64 instance_size = loader_->instance_size();
bool success = error == net::OK;
- if (!initialize_callback_.get()) {
+ if (initialize_cb_.is_null()) {
loader_->Stop();
return;
}
@@ -426,7 +422,7 @@ void BufferedDataSource::HttpInitialStartCallback(int error) {
return;
}
- // Reference to prevent destruction while inside the |initialize_callback_|
+ // Reference to prevent destruction while inside the |initialize_cb_|
// call. This is a temporary fix to prevent crashes caused by holding the
// lock and running the destructor.
// TODO: Review locking in this class and figure out a way to run the callback
@@ -459,7 +455,7 @@ void BufferedDataSource::NonHttpInitialStartCallback(int error) {
DCHECK(MessageLoop::current() == render_loop_);
DCHECK(loader_.get());
- if (!initialize_callback_.get()) {
+ if (initialize_cb_.is_null()) {
loader_->Stop();
return;
}
@@ -475,7 +471,7 @@ void BufferedDataSource::NonHttpInitialStartCallback(int error) {
loader_->Stop();
}
- // Reference to prevent destruction while inside the |initialize_callback_|
+ // Reference to prevent destruction while inside the |initialize_cb_|
// call. This is a temporary fix to prevent crashes caused by holding the
// lock and running the destructor.
// TODO: Review locking in this class and figure out a way to run the callback
@@ -491,7 +487,7 @@ void BufferedDataSource::NonHttpInitialStartCallback(int error) {
// this object when Stop() method is ever called. Locking this method is
// safe because |lock_| is only acquired in tasks on render thread.
base::AutoLock auto_lock(lock_);
- if (stop_signal_received_ || !initialize_callback_.get())
+ if (stop_signal_received_ || initialize_cb_.is_null())
return;
if (!success) {
« no previous file with comments | « webkit/glue/media/buffered_data_source.h ('k') | webkit/glue/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698