| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MEDIA_BLINK_MULTIBUFFER_READER_H_ | 5 #ifndef MEDIA_BLINK_MULTIBUFFER_READER_H_ |
| 6 #define MEDIA_BLINK_MULTIBUFFER_READER_H_ | 6 #define MEDIA_BLINK_MULTIBUFFER_READER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 bool IsLoading() const; | 89 bool IsLoading() const; |
| 90 | 90 |
| 91 // Reader implementation. | 91 // Reader implementation. |
| 92 void NotifyAvailableRange(const Interval<MultiBufferBlockId>& range) override; | 92 void NotifyAvailableRange(const Interval<MultiBufferBlockId>& range) override; |
| 93 | 93 |
| 94 // Getters | 94 // Getters |
| 95 int64_t preload_high() const { return preload_high_; } | 95 int64_t preload_high() const { return preload_high_; } |
| 96 int64_t preload_low() const { return preload_low_; } | 96 int64_t preload_low() const { return preload_low_; } |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 friend class MultibufferDataSourceTest; |
| 100 |
| 99 // Returns the block for a particular byte position. | 101 // Returns the block for a particular byte position. |
| 100 MultiBufferBlockId block(int64_t byte_pos) const { | 102 MultiBufferBlockId block(int64_t byte_pos) const { |
| 101 return byte_pos >> multibuffer_->block_size_shift(); | 103 return byte_pos >> multibuffer_->block_size_shift(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 // Returns the block for a particular byte position, rounding up. | 106 // Returns the block for a particular byte position, rounding up. |
| 105 MultiBufferBlockId block_ceil(int64_t byte_pos) const { | 107 MultiBufferBlockId block_ceil(int64_t byte_pos) const { |
| 106 return block(byte_pos + (1LL << multibuffer_->block_size_shift()) - 1); | 108 return block(byte_pos + (1LL << multibuffer_->block_size_shift()) - 1); |
| 107 } | 109 } |
| 108 | 110 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 168 |
| 167 // Progress callback. | 169 // Progress callback. |
| 168 base::Callback<void(int64_t, int64_t)> progress_callback_; | 170 base::Callback<void(int64_t, int64_t)> progress_callback_; |
| 169 | 171 |
| 170 base::WeakPtrFactory<MultiBufferReader> weak_factory_; | 172 base::WeakPtrFactory<MultiBufferReader> weak_factory_; |
| 171 }; | 173 }; |
| 172 | 174 |
| 173 } // namespace media | 175 } // namespace media |
| 174 | 176 |
| 175 #endif // MEDIA_BLINK_MULTIBUFFER_READER_H_ | 177 #endif // MEDIA_BLINK_MULTIBUFFER_READER_H_ |
| OLD | NEW |