| 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 #ifndef MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ | 5 #ifndef MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ |
| 6 #define MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ | 6 #define MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "media/base/seekable_buffer.h" | 15 #include "media/base/seekable_buffer.h" |
| 16 #include "media/blink/active_loader.h" | 16 #include "media/blink/active_loader.h" |
| 17 #include "media/blink/media_blink_export.h" | 17 #include "media/blink/media_blink_export.h" |
| 18 #include "media/blink/url_index.h" // for kPositionNotSpecified | 18 #include "media/blink/url_index.h" // for kPositionNotSpecified |
| 19 #include "third_party/WebKit/public/platform/WebURLLoader.h" | 19 #include "third_party/WebKit/public/platform/WebURLLoader.h" |
| 20 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 20 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
| 21 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 21 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 22 #include "third_party/WebKit/public/web/WebFrame.h" | 22 #include "third_party/WebKit/public/web/WebFrame.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 | 24 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 // Helper function that returns true if a range request was specified. | 261 // Helper function that returns true if a range request was specified. |
| 262 bool IsRangeRequest() const; | 262 bool IsRangeRequest() const; |
| 263 | 263 |
| 264 // Log everything interesting to |media_log_|. | 264 // Log everything interesting to |media_log_|. |
| 265 void Log(); | 265 void Log(); |
| 266 | 266 |
| 267 // A sliding window of buffer. | 267 // A sliding window of buffer. |
| 268 SeekableBuffer buffer_; | 268 SeekableBuffer buffer_; |
| 269 | 269 |
| 270 // Keeps track of an active WebURLLoader and associated state. | 270 // Keeps track of an active WebURLLoader and associated state. |
| 271 scoped_ptr<ActiveLoader> active_loader_; | 271 std::unique_ptr<ActiveLoader> active_loader_; |
| 272 | 272 |
| 273 // Tracks if |active_loader_| failed. If so, then all calls to Read() will | 273 // Tracks if |active_loader_| failed. If so, then all calls to Read() will |
| 274 // fail. | 274 // fail. |
| 275 bool loader_failed_; | 275 bool loader_failed_; |
| 276 | 276 |
| 277 // Current buffering algorithm in place for resource loading. | 277 // Current buffering algorithm in place for resource loading. |
| 278 DeferStrategy defer_strategy_; | 278 DeferStrategy defer_strategy_; |
| 279 | 279 |
| 280 // True if the currently-reading response might be used to satisfy a future | 280 // True if the currently-reading response might be used to satisfy a future |
| 281 // request from the cache. | 281 // request from the cache. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 312 int64_t read_position_; | 312 int64_t read_position_; |
| 313 int read_size_; | 313 int read_size_; |
| 314 uint8_t* read_buffer_; | 314 uint8_t* read_buffer_; |
| 315 | 315 |
| 316 // Offsets of the requested first byte and last byte in |buffer_|. They are | 316 // Offsets of the requested first byte and last byte in |buffer_|. They are |
| 317 // written by Read(). | 317 // written by Read(). |
| 318 int first_offset_; | 318 int first_offset_; |
| 319 int last_offset_; | 319 int last_offset_; |
| 320 | 320 |
| 321 // Injected WebURLLoader instance for testing purposes. | 321 // Injected WebURLLoader instance for testing purposes. |
| 322 scoped_ptr<blink::WebURLLoader> test_loader_; | 322 std::unique_ptr<blink::WebURLLoader> test_loader_; |
| 323 | 323 |
| 324 // Bitrate of the media. Set to 0 if unknown. | 324 // Bitrate of the media. Set to 0 if unknown. |
| 325 int bitrate_; | 325 int bitrate_; |
| 326 | 326 |
| 327 // Playback rate of the media. | 327 // Playback rate of the media. |
| 328 double playback_rate_; | 328 double playback_rate_; |
| 329 | 329 |
| 330 GURL response_original_url_; | 330 GURL response_original_url_; |
| 331 | 331 |
| 332 scoped_refptr<MediaLog> media_log_; | 332 scoped_refptr<MediaLog> media_log_; |
| 333 | 333 |
| 334 bool cancel_upon_deferral_; | 334 bool cancel_upon_deferral_; |
| 335 | 335 |
| 336 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 336 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
| 337 }; | 337 }; |
| 338 | 338 |
| 339 } // namespace media | 339 } // namespace media |
| 340 | 340 |
| 341 #endif // MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ | 341 #endif // MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ |
| OLD | NEW |