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