| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 13 #include "media/base/seekable_buffer.h" | 13 #include "media/base/seekable_buffer.h" |
| 14 #include "media/blink/active_loader.h" | 14 #include "media/blink/active_loader.h" |
| 15 #include "media/blink/url_index.h" // for kPositionNotSpecified |
| 15 #include "third_party/WebKit/public/platform/WebURLLoader.h" | 16 #include "third_party/WebKit/public/platform/WebURLLoader.h" |
| 16 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 17 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
| 17 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 18 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 18 #include "third_party/WebKit/public/web/WebFrame.h" | 19 #include "third_party/WebKit/public/web/WebFrame.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 class MediaLog; | 23 class MediaLog; |
| 23 class SeekableBuffer; | 24 class SeekableBuffer; |
| 24 | 25 |
| 25 const int64 kPositionNotSpecified = -1; | |
| 26 | |
| 27 // BufferedResourceLoader is single threaded and must be accessed on the | 26 // BufferedResourceLoader is single threaded and must be accessed on the |
| 28 // render thread. It wraps a WebURLLoader and does in-memory buffering, | 27 // render thread. It wraps a WebURLLoader and does in-memory buffering, |
| 29 // pausing resource loading when the in-memory buffer is full and resuming | 28 // pausing resource loading when the in-memory buffer is full and resuming |
| 30 // resource loading when there is available capacity. | 29 // resource loading when there is available capacity. |
| 31 class MEDIA_EXPORT BufferedResourceLoader | 30 class MEDIA_EXPORT BufferedResourceLoader |
| 32 : NON_EXPORTED_BASE(public blink::WebURLLoaderClient) { | 31 : NON_EXPORTED_BASE(public blink::WebURLLoaderClient) { |
| 33 public: | 32 public: |
| 34 // kNeverDefer - Aggresively buffer; never defer loading while paused. | 33 // kNeverDefer - Aggresively buffer; never defer loading while paused. |
| 35 // kReadThenDefer - Request only enough data to fulfill read requests. | 34 // kReadThenDefer - Request only enough data to fulfill read requests. |
| 36 // kCapacityDefer - Try to keep amount of buffered data at capacity. | 35 // kCapacityDefer - Try to keep amount of buffered data at capacity. |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 scoped_refptr<MediaLog> media_log_; | 325 scoped_refptr<MediaLog> media_log_; |
| 327 | 326 |
| 328 bool cancel_upon_deferral_; | 327 bool cancel_upon_deferral_; |
| 329 | 328 |
| 330 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 329 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
| 331 }; | 330 }; |
| 332 | 331 |
| 333 } // namespace media | 332 } // namespace media |
| 334 | 333 |
| 335 #endif // MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ | 334 #endif // MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ |
| OLD | NEW |