diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-30 17:49:41 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-30 17:49:41 +0000 |
commit | 3979b7df049bbcf8197cfe0849c1f526795b7c56 (patch) | |
tree | 80735491fbc9220a449133ce4064bfa645f128c5 /webkit/glue/media/buffered_data_source.h | |
parent | 09642233be151b5dc640043e594b043850cbac69 (diff) | |
download | chromium_src-3979b7df049bbcf8197cfe0849c1f526795b7c56.zip chromium_src-3979b7df049bbcf8197cfe0849c1f526795b7c56.tar.gz chromium_src-3979b7df049bbcf8197cfe0849c1f526795b7c56.tar.bz2 |
Enable <video> using cache
Retrying the following two patches:
http://codereview.chromium.org/253001/show
http://codereview.chromium.org/248012/show
TBR=scherkus
Review URL: http://codereview.chromium.org/242073
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/media/buffered_data_source.h')
-rw-r--r-- | webkit/glue/media/buffered_data_source.h | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h index f3282cc..532fa56 100644 --- a/webkit/glue/media/buffered_data_source.h +++ b/webkit/glue/media/buffered_data_source.h @@ -51,8 +51,6 @@ class BufferedResourceLoader : // |callback| is called with the following values: // - net::OK // The request has started successfully. - // - net::ERR_REQUEST_RANGE_NOT_SATISFIABLE - // A range request was made to the server but the server doesn't support it. // - net::ERR_FAILED // The request has failed because of an error with the network. // - net::ERR_INVALID_RESPONSE @@ -85,6 +83,10 @@ class BufferedResourceLoader : // the size is unknown. virtual int64 instance_size() { return instance_size_; } + // Returns true if the response for this loader is a partial response. + // It means a 206 response in HTTP/HTTPS protocol. + virtual bool partial_response() { return partial_response_; } + ///////////////////////////////////////////////////////////////////////////// // webkit_glue::ResourceLoaderBridge::Peer implementations. virtual void OnUploadProgress(uint64 position, uint64 size) {} @@ -137,10 +139,18 @@ class BufferedResourceLoader : // A sliding window of buffer. scoped_ptr<media::SeekableBuffer> buffer_; + // True if resource loading was deferred. bool deferred_; + + // True if resource loading has completed. bool completed_; + + // True if a range request was made. bool range_requested_; + // True if response data received is a partial range. + bool partial_response_; + webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_; GURL url_; int64 first_byte_position_; @@ -253,13 +263,15 @@ class BufferedDataSource : public media::DataSource { // Calls |initialize_callback_| and reset it. void DoneInitialization(); - // Callback method for |loader_|. This method is called when response for - // initial request is received. - void InitialStartCallback(int error); + // Callback method for |loader_| if URL for the resource requested is using + // HTTP protocol. This method is called when response for initial request is + // received. + void HttpInitialStartCallback(int error); - // Callback method for |probe_loader_|. This method is called when the - // response for probe request is received. - void ProbeStartCallback(int error); + // Callback method for |loader_| if URL for the resource requested is using + // a non-HTTP protocol, e.g. local files. This method is called when response + // for initial request is received. + void NonHttpInitialStartCallback(int error); // Callback method to be passed to BufferedResourceLoader during range // request. Once a resource request has started, this method will be called @@ -293,9 +305,6 @@ class BufferedDataSource : public media::DataSource { // A resource loader for the media resource. scoped_refptr<BufferedResourceLoader> loader_; - // A resource loader that probes the server's ability to serve range requests. - scoped_refptr<BufferedResourceLoader> probe_loader_; - // Callback method from the pipeline for initialization. scoped_ptr<media::FilterCallback> initialize_callback_; @@ -307,12 +316,6 @@ class BufferedDataSource : public media::DataSource { base::Time read_submitted_time_; int read_attempts_; - // This flag is set to true if the initial request has started. - bool initial_response_received_; - - // This flag is set to true if the probe request has started. - bool probe_response_received_; - // This buffer is intermediate, we use it for BufferedResourceLoader to write // to. And when read in BufferedResourceLoader is done, we copy data from // this buffer to |read_buffer_|. The reason for an additional copy is that |