Chromium Code Reviews| Index: media/blink/multibuffer.cc |
| diff --git a/media/blink/multibuffer.cc b/media/blink/multibuffer.cc |
| index 41c35825f53d179b8dab721f71a4dd7baa03b25a..ffa0f18a19183ce3cef3a94f7e6d5ad5022bd0c9 100644 |
| --- a/media/blink/multibuffer.cc |
| +++ b/media/blink/multibuffer.cc |
| @@ -161,9 +161,7 @@ void MultiBuffer::AddReader(const BlockId& pos, Reader* reader) { |
| } |
| if (!provider) { |
| DCHECK(writer_index_.find(pos) == writer_index_.end()); |
| - provider = writer_index_[pos] = CreateWriter(pos); |
| - provider->SetAvailableCallback(base::Bind( |
| - &MultiBuffer::DataProviderEvent, base::Unretained(this), provider)); |
| + provider = writer_index_[pos] = CreateWriter(pos).release(); |
|
xhwang
2015/11/23 23:09:21
release() seems hacky. Can we switch to use std::m
hubbe
2015/11/24 22:55:10
Done.
|
| } |
| provider->SetDeferred(false); |
| } |
| @@ -183,7 +181,7 @@ void MultiBuffer::CleanupWriters(const BlockId& pos) { |
| BlockId closest_writer = ClosestPreviousEntry(writer_index_, p2); |
| while (closest_writer > pos - kMaxWaitForWriterOffset) { |
| DCHECK(writer_index_[closest_writer]); |
| - DataProviderEvent(writer_index_[closest_writer]); |
| + OnDataProviderEvent(writer_index_[closest_writer]); |
| closest_writer = ClosestPreviousEntry(writer_index_, closest_writer - 1); |
| } |
| } |
| @@ -258,8 +256,12 @@ void MultiBuffer::ReleaseBlocks(const std::vector<MultiBufferBlockId>& blocks) { |
| } |
| } |
| } |
| + if (data_.empty()) |
| + OnEmpty(); |
| } |
| +void MultiBuffer::OnEmpty() {} |
| + |
| void MultiBuffer::AddProvider(scoped_ptr<DataProvider> provider) { |
| // If there is already a provider in the same location, we delete it. |
| DCHECK(!provider->Available()); |
| @@ -324,7 +326,7 @@ void MultiBuffer::Prune(size_t max_to_free) { |
| lru_->Prune(max_to_free); |
| } |
| -void MultiBuffer::DataProviderEvent(DataProvider* provider_tmp) { |
| +void MultiBuffer::OnDataProviderEvent(DataProvider* provider_tmp) { |
| scoped_ptr<DataProvider> provider(RemoveProvider(provider_tmp)); |
| BlockId start_pos = provider->Tell(); |
| BlockId pos = start_pos; |