Chromium Code Reviews| Index: content/renderer/media/buffered_data_source.cc |
| diff --git a/content/renderer/media/buffered_data_source.cc b/content/renderer/media/buffered_data_source.cc |
| index 1d9b33f6d7b49ffb59c99d0a5d8f0b43fdd40501..296d8fb1bd9003da2c9eadc6c3eba71902c87a3e 100644 |
| --- a/content/renderer/media/buffered_data_source.cc |
| +++ b/content/renderer/media/buffered_data_source.cc |
| @@ -144,7 +144,7 @@ void BufferedDataSource::Initialize( |
| url_ = url; |
| cors_mode_ = cors_mode; |
| - init_cb_ = init_cb; |
| + init_cb_ = CreateInitializeCB(media_log_, init_cb); |
| if (url_.SchemeIs(kHttpScheme) || url_.SchemeIs(kHttpsScheme)) { |
| // Do an unbounded range request starting at the beginning. If the server |
| @@ -166,6 +166,31 @@ void BufferedDataSource::Initialize( |
| frame_); |
| } |
| +// TODO(tyoverby): remove this typedef |
| +typedef base::Callback<void(bool)> InitializeCB; |
|
Ty Overby
2013/08/20 23:06:38
scherkus@: How do I get rid of this line? I threw
|
| + |
| +// The reason that we need to stitch this into the normal callback |
| +// is because the methods that are called require Initialize() to be called |
| +// before they can be called. |
| +static void OnInit(const scoped_refptr<media::MediaLog>& media_log, |
| + BufferedDataSource* data_source, |
| + const InitializeCB& init_cb, |
| + bool success) { |
| + media_log->SetBooleanProperty("single_origin", |
| + data_source->HasSingleOrigin()); |
| + media_log->SetBooleanProperty("pass_cors_access_check", |
| + data_source->DidPassCORSAccessCheck()); |
| + |
| + init_cb.Run(success); |
| +} |
| + |
| +InitializeCB BufferedDataSource::CreateInitializeCB( |
| + const scoped_refptr<media::MediaLog>& media_log, |
| + const InitializeCB& init_cb) { |
| + |
| + return base::Bind(&OnInit, media_log, this, init_cb); |
| +} |
| + |
| void BufferedDataSource::SetPreload(Preload preload) { |
| DCHECK(render_loop_->BelongsToCurrentThread()); |
| preload_ = preload; |
| @@ -371,10 +396,15 @@ void BufferedDataSource::StartCallback( |
| total_bytes_ = loader_->instance_size(); |
| streaming_ = !assume_fully_buffered_ && |
| (total_bytes_ == kPositionNotSpecified || !loader_->range_supported()); |
| + |
| + media_log_->SetIntegerProperty("total_bytes", total_bytes_); |
|
scherkus (not reviewing)
2013/08/21 20:28:41
note that total_bytes_ might be -1 (kPositionNotSp
Ty Overby
2013/08/21 22:19:52
That's right; I forgot that we already had it from
Ty Overby
2013/08/21 22:19:52
Done.
|
| } else { |
| loader_->Stop(); |
| } |
| + // HTTP range header |
| + media_log_->SetBooleanProperty("range_supported", loader_->range_supported()); |
| + |
| // TODO(scherkus): we shouldn't have to lock to signal host(), see |
| // http://crbug.com/113712 for details. |
| base::AutoLock auto_lock(lock_); |
| @@ -429,6 +459,8 @@ void BufferedDataSource::ReadCallback( |
| read_op_->retries() < kNumCacheMissRetries) { |
| read_op_->IncrementRetries(); |
| + media_log_->SetIntegerProperty("read_retries", read_op_->retries()); |
|
scherkus (not reviewing)
2013/08/21 20:28:41
I wouldn't bother with this one -- ReadCallback()
Ty Overby
2013/08/21 22:19:52
It's only called if there is a miss I believe, and
|
| + |
| // Recreate a loader starting from where we last left off until the |
| // end of the resource. |
| loader_.reset(CreateResourceLoader( |