| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/blink/multibuffer_data_source.h" | 5 #include "media/blink/multibuffer_data_source.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 reader_.reset(nullptr); | 321 reader_.reset(nullptr); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 | 324 |
| 325 int64_t MultibufferDataSource::GetMemoryUsage() const { | 325 int64_t MultibufferDataSource::GetMemoryUsage() const { |
| 326 // TODO(hubbe): Make more accurate when url_data_ is shared. | 326 // TODO(hubbe): Make more accurate when url_data_ is shared. |
| 327 return url_data_->CachedSize() | 327 return url_data_->CachedSize() |
| 328 << url_data_->multibuffer()->block_size_shift(); | 328 << url_data_->multibuffer()->block_size_shift(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 GURL MultibufferDataSource::GetUrlAfterRedirects() const { |
| 332 return url_data_->url(); |
| 333 } |
| 334 |
| 331 void MultibufferDataSource::Read(int64_t position, | 335 void MultibufferDataSource::Read(int64_t position, |
| 332 int size, | 336 int size, |
| 333 uint8_t* data, | 337 uint8_t* data, |
| 334 const DataSource::ReadCB& read_cb) { | 338 const DataSource::ReadCB& read_cb) { |
| 335 DVLOG(1) << "Read: " << position << " offset, " << size << " bytes"; | 339 DVLOG(1) << "Read: " << position << " offset, " << size << " bytes"; |
| 336 // Reading is not allowed until after initialization. | 340 // Reading is not allowed until after initialization. |
| 337 DCHECK(init_cb_.is_null()); | 341 DCHECK(init_cb_.is_null()); |
| 338 DCHECK(!read_cb.is_null()); | 342 DCHECK(!read_cb.is_null()); |
| 339 | 343 |
| 340 { | 344 { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra); | 595 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra); |
| 592 | 596 |
| 593 if (preload_ == METADATA) { | 597 if (preload_ == METADATA) { |
| 594 reader_->SetPreload(0, 0); | 598 reader_->SetPreload(0, 0); |
| 595 } else { | 599 } else { |
| 596 reader_->SetPreload(preload_high, preload); | 600 reader_->SetPreload(preload_high, preload); |
| 597 } | 601 } |
| 598 } | 602 } |
| 599 | 603 |
| 600 } // namespace media | 604 } // namespace media |
| OLD | NEW |