Chromium Code Reviews| Index: webkit/media/buffered_resource_loader.h |
| diff --git a/webkit/media/buffered_resource_loader.h b/webkit/media/buffered_resource_loader.h |
| index 32779413e6710890b417e3cf5534b54947ceb09d..035f9e5a8af09ebbe4065cd2dff1457a2939380d 100644 |
| --- a/webkit/media/buffered_resource_loader.h |
| +++ b/webkit/media/buffered_resource_loader.h |
| @@ -65,6 +65,13 @@ class BufferedResourceLoader : public WebKit::WebURLLoaderClient { |
| kCacheMiss, |
| }; |
| + enum LoadingState { |
| + kLoading, // Actively attempting to download data. |
| + kLoadingDeferred, // Loading intentionally deferred. |
| + kLoadingFinished, // Loading finished normally; no more data will arrive. |
| + kLoadingFailed, // Loading finished abnormally; no more data will arrive. |
| + }; |
| + |
| // |url| - URL for the resource to be loaded. |
| // |first_byte_position| - First byte to start loading from, |
| // |kPositionNotSpecified| for not specified. |
| @@ -84,15 +91,14 @@ class BufferedResourceLoader : public WebKit::WebURLLoaderClient { |
| // Start the resource loading with the specified URL and range. |
| // |
| - // |event_cb| is called to notify the client of network activity in the |
| - // following situations: |
| - // - Data was received |
| - // - Reading was suspended/resumed |
| - // - Loading completed |
| - // - Loading failed |
| + // |progress_cb| is executed when additional data has arrived. |
| + // |loading_cb| is executed when the loading state has changed. |
|
Ami GONE FROM CHROMIUM
2012/07/09 00:25:46
Flip order of these two lines to match the orders
scherkus (not reviewing)
2012/07/09 18:53:30
Done.
|
| typedef base::Callback<void(Status)> StartCB; |
| + typedef base::Callback<void(LoadingState)> LoadingCB; |
| + typedef base::Callback<void(int64)> ProgressCB; |
| void Start(const StartCB& start_cb, |
| - const base::Closure& event_cb, |
| + const LoadingCB& loading_cb, |
| + const ProgressCB& progress_cb, |
| WebKit::WebFrame* frame); |
| // Stops everything associated with this loader, including active URL loads |
| @@ -113,10 +119,6 @@ class BufferedResourceLoader : public WebKit::WebURLLoaderClient { |
| void Read(int64 position, int read_size, |
| uint8* buffer, const ReadCB& read_cb); |
| - // Returns the position of the last byte buffered. Returns |
| - // |kPositionNotSpecified| if such value is not available. |
| - int64 GetBufferedPosition(); |
|
Ami GONE FROM CHROMIUM
2012/07/09 00:25:46
hawt!
|
| - |
| // Gets the content length in bytes of the instance after this loader has been |
| // started. If this value is |kPositionNotSpecified|, then content length is |
| // unknown. |
| @@ -246,9 +248,6 @@ class BufferedResourceLoader : public WebKit::WebURLLoaderClient { |
| // Done with start. Invokes the start callback and reset it. |
| void DoneStart(Status status); |
| - // Calls |event_cb_| in terms of a network event. |
| - void NotifyNetworkEvent(); |
| - |
| bool HasPendingRead() { return !read_cb_.is_null(); } |
| // Helper function that returns true if a range request was specified. |
| @@ -285,8 +284,12 @@ class BufferedResourceLoader : public WebKit::WebURLLoaderClient { |
| int64 last_byte_position_; |
| bool single_origin_; |
| - // Closure that listens to network events. |
| - base::Closure event_cb_; |
| + // Executed whenever the state of resource loading has changed. |
| + LoadingCB loading_cb_; |
|
Ami GONE FROM CHROMIUM
2012/07/09 00:25:46
LoadingStateChangedCB?
LoadingCB sounds to me like
scherkus (not reviewing)
2012/07/09 18:53:30
It's a mouthful but I agree that LoadingCB is a bi
|
| + |
| + // Executed whenever additional data has been downloaded and reports the |
| + // zero-indexed file offset of the leading buffered byte. |
|
Ami GONE FROM CHROMIUM
2012/07/09 00:25:46
s/leading/furthest/?
scherkus (not reviewing)
2012/07/09 18:53:30
Done.
|
| + ProgressCB progress_cb_; |
| // Members used during request start. |
| StartCB start_cb_; |