| 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/buffered_data_source.h" | 5 #include "media/blink/buffered_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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 !media_has_played_ && !IsStreaming()))) { | 261 !media_has_played_ && !IsStreaming()))) { |
| 262 loader_->CancelUponDeferral(); | 262 loader_->CancelUponDeferral(); |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 | 265 |
| 266 int64_t BufferedDataSource::GetMemoryUsage() const { | 266 int64_t BufferedDataSource::GetMemoryUsage() const { |
| 267 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 267 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 268 return loader_ ? loader_->GetMemoryUsage() : 0; | 268 return loader_ ? loader_->GetMemoryUsage() : 0; |
| 269 } | 269 } |
| 270 | 270 |
| 271 GURL BufferedDataSource::GetUrlAfterRedirects() const { |
| 272 return response_original_url_; |
| 273 } |
| 274 |
| 271 void BufferedDataSource::Read(int64_t position, | 275 void BufferedDataSource::Read(int64_t position, |
| 272 int size, | 276 int size, |
| 273 uint8_t* data, | 277 uint8_t* data, |
| 274 const DataSource::ReadCB& read_cb) { | 278 const DataSource::ReadCB& read_cb) { |
| 275 DVLOG(1) << "Read: " << position << " offset, " << size << " bytes"; | 279 DVLOG(1) << "Read: " << position << " offset, " << size << " bytes"; |
| 276 DCHECK(!read_cb.is_null()); | 280 DCHECK(!read_cb.is_null()); |
| 277 | 281 |
| 278 { | 282 { |
| 279 base::AutoLock auto_lock(lock_); | 283 base::AutoLock auto_lock(lock_); |
| 280 DCHECK(!read_op_); | 284 DCHECK(!read_op_); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 } | 625 } |
| 622 | 626 |
| 623 // If media is currently playing or the page indicated preload=auto or the | 627 // If media is currently playing or the page indicated preload=auto or the |
| 624 // the server does not support the byte range request or we do not want to go | 628 // the server does not support the byte range request or we do not want to go |
| 625 // too far ahead of the read head, use threshold strategy to enable/disable | 629 // too far ahead of the read head, use threshold strategy to enable/disable |
| 626 // deferring when the buffer is full/depleted. | 630 // deferring when the buffer is full/depleted. |
| 627 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 631 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); |
| 628 } | 632 } |
| 629 | 633 |
| 630 } // namespace media | 634 } // namespace media |
| OLD | NEW |