| 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 |
| 230 // Save the parameter of reading. | 232 // Save the parameter of reading. |
| 231 read_cb_ = read_cb; | 233 read_cb_ = read_cb; |
| 232 read_position_ = position; | 234 read_position_ = position; |
| 233 read_size_ = read_size; | 235 read_size_ = read_size; |
| 234 read_buffer_ = buffer; | 236 read_buffer_ = buffer; |
| 235 | 237 |
| 236 // Reads should immediately fail if the loader also failed. | 238 // Reads should immediately fail if the loader also failed. |
| 237 if (loader_failed_) { | 239 if (loader_failed_) { |
| 238 DoneRead(kFailed, 0); | 240 DoneRead(kFailed, 0); |
| 239 return; | 241 return; |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 809 |
| 808 void BufferedResourceLoader::Log() { | 810 void BufferedResourceLoader::Log() { |
| 809 media_log_->AddEvent( | 811 media_log_->AddEvent( |
| 810 media_log_->CreateBufferedExtentsChangedEvent( | 812 media_log_->CreateBufferedExtentsChangedEvent( |
| 811 offset_ - buffer_.backward_bytes(), | 813 offset_ - buffer_.backward_bytes(), |
| 812 offset_, | 814 offset_, |
| 813 offset_ + buffer_.forward_bytes())); | 815 offset_ + buffer_.forward_bytes())); |
| 814 } | 816 } |
| 815 | 817 |
| 816 } // namespace media | 818 } // namespace media |
| OLD | NEW |