| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/glue/media/buffered_resource_loader.h" | 5 #include "webkit/glue/media/buffered_resource_loader.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "media/base/media_log.h" | 10 #include "media/base/media_log.h" |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 // Then do the read. | 727 // Then do the read. |
| 728 int read = static_cast<int>(buffer_->Read(read_buffer_, read_size_)); | 728 int read = static_cast<int>(buffer_->Read(read_buffer_, read_size_)); |
| 729 offset_ += first_offset_ + read; | 729 offset_ += first_offset_ + read; |
| 730 | 730 |
| 731 // And report with what we have read. | 731 // And report with what we have read. |
| 732 DoneRead(read); | 732 DoneRead(read); |
| 733 } | 733 } |
| 734 | 734 |
| 735 bool BufferedResourceLoader::VerifyPartialResponse( | 735 bool BufferedResourceLoader::VerifyPartialResponse( |
| 736 const WebURLResponse& response) { | 736 const WebURLResponse& response) { |
| 737 int first_byte_position, last_byte_position, instance_size; | 737 int64 first_byte_position, last_byte_position, instance_size; |
| 738 | 738 |
| 739 if (!MultipartResponseDelegate::ReadContentRanges(response, | 739 if (!MultipartResponseDelegate::ReadContentRanges(response, |
| 740 &first_byte_position, | 740 &first_byte_position, |
| 741 &last_byte_position, | 741 &last_byte_position, |
| 742 &instance_size)) { | 742 &instance_size)) { |
| 743 return false; | 743 return false; |
| 744 } | 744 } |
| 745 | 745 |
| 746 if (instance_size != kPositionNotSpecified) { | 746 if (instance_size != kPositionNotSpecified) { |
| 747 instance_size_ = instance_size; | 747 instance_size_ = instance_size; |
| 748 } | 748 } |
| 749 | 749 |
| 750 if (first_byte_position_ != kPositionNotSpecified && | 750 if (first_byte_position_ != kPositionNotSpecified && |
| 751 first_byte_position_ != first_byte_position) { | 751 first_byte_position_ != first_byte_position) { |
| 752 return false; | 752 return false; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 if (buffer_.get()) { | 811 if (buffer_.get()) { |
| 812 media_log_->AddEvent( | 812 media_log_->AddEvent( |
| 813 media_log_->CreateBufferedExtentsChangedEvent( | 813 media_log_->CreateBufferedExtentsChangedEvent( |
| 814 offset_ - buffer_->backward_bytes(), | 814 offset_ - buffer_->backward_bytes(), |
| 815 offset_, | 815 offset_, |
| 816 offset_ + buffer_->forward_bytes())); | 816 offset_ + buffer_->forward_bytes())); |
| 817 } | 817 } |
| 818 } | 818 } |
| 819 | 819 |
| 820 } // namespace webkit_glue | 820 } // namespace webkit_glue |
| OLD | NEW |