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 13 matching lines...) Expand all Loading... | |
24 } | 24 } |
25 | 25 |
26 namespace webkit_media { | 26 namespace webkit_media { |
27 | 27 |
28 const int64 kPositionNotSpecified = -1; | 28 const int64 kPositionNotSpecified = -1; |
29 | 29 |
30 const char kHttpScheme[] = "http"; | 30 const char kHttpScheme[] = "http"; |
31 const char kHttpsScheme[] = "https"; | 31 const char kHttpsScheme[] = "https"; |
32 const char kDataScheme[] = "data"; | 32 const char kDataScheme[] = "data"; |
33 | 33 |
34 // This class works inside demuxer thread and render thread. It contains a | 34 // Wraps a WebURLLoader to maintain an in-memory buffer of downloaded |
35 // WebURLLoader and does the actual resource loading. This object does | 35 // data according to the current defer strategy. |
36 // buffering internally, it defers the resource loading if buffer is full | |
37 // and un-defers the resource loading if it is under buffered. | |
38 class BufferedResourceLoader : public WebKit::WebURLLoaderClient { | 36 class BufferedResourceLoader : public WebKit::WebURLLoaderClient { |
39 public: | 37 public: |
40 // kNeverDefer - Aggresively buffer; never defer loading while paused. | 38 // kNeverDefer - Aggresively buffer; never defer loading while paused. |
41 // kReadThenDefer - Request only enough data to fulfill read requests. | 39 // kReadThenDefer - Request only enough data to fulfill read requests. |
42 // kThresholdDefer - Try to keep amount of buffered data at a threshold. | 40 // kThresholdDefer - Try to keep amount of buffered data at capacity. |
43 enum DeferStrategy { | 41 enum DeferStrategy { |
44 kNeverDefer, | 42 kNeverDefer, |
45 kReadThenDefer, | 43 kReadThenDefer, |
46 kThresholdDefer, | 44 kThresholdDefer, |
Ami GONE FROM CHROMIUM
2012/07/09 17:27:41
Needs a rename.
scherkus (not reviewing)
2012/07/11 00:49:37
Done.
| |
47 }; | 45 }; |
48 | 46 |
49 // Status codes for start/read operations on BufferedResourceLoader. | 47 // Status codes for start/read operations on BufferedResourceLoader. |
50 enum Status { | 48 enum Status { |
51 // Everything went as planned. | 49 // Everything went as planned. |
52 kOk, | 50 kOk, |
53 | 51 |
54 // The operation failed, which may have been due to: | 52 // The operation failed, which may have been due to: |
55 // - Page navigation | 53 // - Page navigation |
56 // - Server replied 4xx/5xx | 54 // - Server replied 4xx/5xx |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 float playback_rate_; | 314 float playback_rate_; |
317 | 315 |
318 scoped_refptr<media::MediaLog> media_log_; | 316 scoped_refptr<media::MediaLog> media_log_; |
319 | 317 |
320 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 318 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
321 }; | 319 }; |
322 | 320 |
323 } // namespace webkit_media | 321 } // namespace webkit_media |
324 | 322 |
325 #endif // WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 323 #endif // WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
OLD | NEW |