| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 5 #ifndef WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
| 6 #define WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 6 #define WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 int64* last_byte_position, int64* instance_size); | 204 int64* last_byte_position, int64* instance_size); |
| 205 | 205 |
| 206 private: | 206 private: |
| 207 friend class BufferedDataSourceTest; | 207 friend class BufferedDataSourceTest; |
| 208 friend class BufferedResourceLoaderTest; | 208 friend class BufferedResourceLoaderTest; |
| 209 friend class MockBufferedDataSource; | 209 friend class MockBufferedDataSource; |
| 210 | 210 |
| 211 // Updates the |buffer_|'s forward and backward capacities. | 211 // Updates the |buffer_|'s forward and backward capacities. |
| 212 void UpdateBufferWindow(); | 212 void UpdateBufferWindow(); |
| 213 | 213 |
| 214 // Returns true if we should defer resource loading based on the current | |
| 215 // buffering scheme. | |
| 216 bool ShouldEnableDefer() const; | |
| 217 | |
| 218 // Returns true if we should enable resource loading based on the current | |
| 219 // buffering scheme. | |
| 220 bool ShouldDisableDefer() const; | |
| 221 | |
| 222 // Updates deferring behavior based on current buffering scheme. | 214 // Updates deferring behavior based on current buffering scheme. |
| 223 void UpdateDeferBehavior(); | 215 void UpdateDeferBehavior(); |
| 224 | 216 |
| 225 // Set defer state to |deferred| and cease/continue downloading data | 217 // Sets |active_loader_|'s defer state and fires |loading_cb_| if the state |
| 226 // accordingly. | 218 // changed. |
| 227 void SetDeferred(bool deferred); | 219 void SetDeferred(bool deferred); |
| 228 | 220 |
| 221 // Returns true if we should defer resource loading based on the current |
| 222 // buffering scheme. |
| 223 bool ShouldDefer() const; |
| 224 |
| 229 // Returns true if the current read request can be fulfilled by what is in | 225 // Returns true if the current read request can be fulfilled by what is in |
| 230 // the buffer. | 226 // the buffer. |
| 231 bool CanFulfillRead() const; | 227 bool CanFulfillRead() const; |
| 232 | 228 |
| 233 // Returns true if the current read request will be fulfilled in the future. | 229 // Returns true if the current read request will be fulfilled in the future. |
| 234 bool WillFulfillRead() const; | 230 bool WillFulfillRead() const; |
| 235 | 231 |
| 236 // Method that does the actual read and calls the |read_cb_|, assuming the | 232 // Method that does the actual read and calls the |read_cb_|, assuming the |
| 237 // request range is in |buffer_|. | 233 // request range is in |buffer_|. |
| 238 void ReadInternal(); | 234 void ReadInternal(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 float playback_rate_; | 324 float playback_rate_; |
| 329 | 325 |
| 330 scoped_refptr<media::MediaLog> media_log_; | 326 scoped_refptr<media::MediaLog> media_log_; |
| 331 | 327 |
| 332 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 328 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
| 333 }; | 329 }; |
| 334 | 330 |
| 335 } // namespace webkit_media | 331 } // namespace webkit_media |
| 336 | 332 |
| 337 #endif // WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 333 #endif // WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
| OLD | NEW |