| 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 WEBKIT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
| 6 #define WEBKIT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 6 #define CONTENT_RENDERER_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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "content/common/content_export.h" |
| 14 #include "content/renderer/media/active_loader.h" |
| 13 #include "media/base/seekable_buffer.h" | 15 #include "media/base/seekable_buffer.h" |
| 14 #include "third_party/WebKit/public/platform/WebURLLoader.h" | 16 #include "third_party/WebKit/public/platform/WebURLLoader.h" |
| 15 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 17 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
| 16 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 18 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 17 #include "third_party/WebKit/public/web/WebFrame.h" | 19 #include "third_party/WebKit/public/web/WebFrame.h" |
| 18 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 19 #include "webkit/renderer/media/active_loader.h" | |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 class MediaLog; | 23 class MediaLog; |
| 23 class SeekableBuffer; | 24 class SeekableBuffer; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace webkit_media { | 27 namespace content { |
| 27 | 28 |
| 28 const int64 kPositionNotSpecified = -1; | 29 const int64 kPositionNotSpecified = -1; |
| 29 | 30 |
| 30 const char kHttpScheme[] = "http"; | 31 const char kHttpScheme[] = "http"; |
| 31 const char kHttpsScheme[] = "https"; | 32 const char kHttpsScheme[] = "https"; |
| 32 | 33 |
| 33 // BufferedResourceLoader is single threaded and must be accessed on the | 34 // BufferedResourceLoader is single threaded and must be accessed on the |
| 34 // render thread. It wraps a WebURLLoader and does in-memory buffering, | 35 // render thread. It wraps a WebURLLoader and does in-memory buffering, |
| 35 // pausing resource loading when the in-memory buffer is full and resuming | 36 // pausing resource loading when the in-memory buffer is full and resuming |
| 36 // resource loading when there is available capacity. | 37 // resource loading when there is available capacity. |
| 37 class BufferedResourceLoader : public WebKit::WebURLLoaderClient { | 38 class CONTENT_EXPORT BufferedResourceLoader |
| 39 : NON_EXPORTED_BASE(public WebKit::WebURLLoaderClient) { |
| 38 public: | 40 public: |
| 39 // kNeverDefer - Aggresively buffer; never defer loading while paused. | 41 // kNeverDefer - Aggresively buffer; never defer loading while paused. |
| 40 // kReadThenDefer - Request only enough data to fulfill read requests. | 42 // kReadThenDefer - Request only enough data to fulfill read requests. |
| 41 // kCapacityDefer - Try to keep amount of buffered data at capacity. | 43 // kCapacityDefer - Try to keep amount of buffered data at capacity. |
| 42 enum DeferStrategy { | 44 enum DeferStrategy { |
| 43 kNeverDefer, | 45 kNeverDefer, |
| 44 kReadThenDefer, | 46 kReadThenDefer, |
| 45 kCapacityDefer, | 47 kCapacityDefer, |
| 46 }; | 48 }; |
| 47 | 49 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 int bitrate_; | 321 int bitrate_; |
| 320 | 322 |
| 321 // Playback rate of the media. | 323 // Playback rate of the media. |
| 322 float playback_rate_; | 324 float playback_rate_; |
| 323 | 325 |
| 324 scoped_refptr<media::MediaLog> media_log_; | 326 scoped_refptr<media::MediaLog> media_log_; |
| 325 | 327 |
| 326 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 328 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
| 327 }; | 329 }; |
| 328 | 330 |
| 329 } // namespace webkit_media | 331 } // namespace content |
| 330 | 332 |
| 331 #endif // WEBKIT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 333 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
| OLD | NEW |