| 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_resource_loader.h" | 5 #include "media/blink/buffered_resource_loader.h" |
| 6 | 6 |
| 7 #include "base/bits.h" | 7 #include "base/bits.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 int64 position, | 220 int64 position, |
| 221 int read_size, | 221 int read_size, |
| 222 uint8* buffer, | 222 uint8* buffer, |
| 223 const ReadCB& read_cb) { | 223 const ReadCB& read_cb) { |
| 224 DCHECK(start_cb_.is_null()); | 224 DCHECK(start_cb_.is_null()); |
| 225 DCHECK(read_cb_.is_null()); | 225 DCHECK(read_cb_.is_null()); |
| 226 DCHECK(!read_cb.is_null()); | 226 DCHECK(!read_cb.is_null()); |
| 227 DCHECK(buffer); | 227 DCHECK(buffer); |
| 228 DCHECK_GT(read_size, 0); | 228 DCHECK_GT(read_size, 0); |
| 229 | 229 |
| 230 DVLOG(2) << "READ " << read_size << " @ " << position; | |
| 231 | |
| 232 // Save the parameter of reading. | 230 // Save the parameter of reading. |
| 233 read_cb_ = read_cb; | 231 read_cb_ = read_cb; |
| 234 read_position_ = position; | 232 read_position_ = position; |
| 235 read_size_ = read_size; | 233 read_size_ = read_size; |
| 236 read_buffer_ = buffer; | 234 read_buffer_ = buffer; |
| 237 | 235 |
| 238 // Reads should immediately fail if the loader also failed. | 236 // Reads should immediately fail if the loader also failed. |
| 239 if (loader_failed_) { | 237 if (loader_failed_) { |
| 240 DoneRead(kFailed, 0); | 238 DoneRead(kFailed, 0); |
| 241 return; | 239 return; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 | 808 |
| 811 void BufferedResourceLoader::Log() { | 809 void BufferedResourceLoader::Log() { |
| 812 media_log_->AddEvent( | 810 media_log_->AddEvent( |
| 813 media_log_->CreateBufferedExtentsChangedEvent( | 811 media_log_->CreateBufferedExtentsChangedEvent( |
| 814 offset_ - buffer_.backward_bytes(), | 812 offset_ - buffer_.backward_bytes(), |
| 815 offset_, | 813 offset_, |
| 816 offset_ + buffer_.forward_bytes())); | 814 offset_ + buffer_.forward_bytes())); |
| 817 } | 815 } |
| 818 | 816 |
| 819 } // namespace media | 817 } // namespace media |
| OLD | NEW |