diff options
author | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-17 15:28:22 +0000 |
---|---|---|
committer | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-17 15:28:22 +0000 |
commit | b67f19cbe25b385272b34666226657a15298ac66 (patch) | |
tree | 0d3eeb6610db1c6f441f11deee9fdc9a2770d7d8 /webkit | |
parent | ef944e059c2a1bde47f19f8d87a86742f766d94c (diff) | |
download | chromium_src-b67f19cbe25b385272b34666226657a15298ac66.zip chromium_src-b67f19cbe25b385272b34666226657a15298ac66.tar.gz chromium_src-b67f19cbe25b385272b34666226657a15298ac66.tar.bz2 |
Glue for sending/receiving cacheable metadata.
TEST=None
BUG=32407
Review URL: http://codereview.chromium.org/1742004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/resource_fetcher.cc | 8 | ||||
-rw-r--r-- | webkit/glue/resource_fetcher.h | 5 | ||||
-rw-r--r-- | webkit/glue/resource_loader_bridge.h | 4 | ||||
-rw-r--r-- | webkit/glue/weburlloader_impl.cc | 8 |
4 files changed, 25 insertions, 0 deletions
diff --git a/webkit/glue/resource_fetcher.cc b/webkit/glue/resource_fetcher.cc index f29b63b..186092b 100644 --- a/webkit/glue/resource_fetcher.cc +++ b/webkit/glue/resource_fetcher.cc @@ -80,6 +80,14 @@ void ResourceFetcher::didReceiveData( data_.append(data, data_length); } +void ResourceFetcher::didReceiveCachedMetadata( + WebURLLoader* loader, const char* data, int data_length) { + DCHECK(!completed_); + DCHECK(data_length > 0); + + metadata_.assign(data, data_length); +} + void ResourceFetcher::didFinishLoading(WebURLLoader* loader) { DCHECK(!completed_); completed_ = true; diff --git a/webkit/glue/resource_fetcher.h b/webkit/glue/resource_fetcher.h index 75eb3ab..7910fc1 100644 --- a/webkit/glue/resource_fetcher.h +++ b/webkit/glue/resource_fetcher.h @@ -61,6 +61,8 @@ class ResourceFetcher : public WebKit::WebURLLoaderClient { unsigned long long total_bytes_to_be_sent); virtual void didReceiveResponse( WebKit::WebURLLoader* loader, const WebKit::WebURLResponse& response); + virtual void didReceiveCachedMetadata( + WebKit::WebURLLoader* loader, const char* data, int data_length); virtual void didReceiveData( WebKit::WebURLLoader* loader, const char* data, int data_length); virtual void didFinishLoading(WebKit::WebURLLoader* loader); @@ -87,6 +89,9 @@ class ResourceFetcher : public WebKit::WebURLLoaderClient { // Buffer to hold the content from the server. std::string data_; + + // Buffer to hold metadata from the cache. + std::string metadata_; }; ///////////////////////////////////////////////////////////////////////////// diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h index 26253f8..a1773e9 100644 --- a/webkit/glue/resource_loader_bridge.h +++ b/webkit/glue/resource_loader_bridge.h @@ -181,6 +181,10 @@ class ResourceLoaderBridge { // be called multiple times or not at all if an error occurs. virtual void OnReceivedData(const char* data, int len) = 0; + // Called when metadata generated by the renderer is retrieved from the + // cache. This method may be called zero or one times. + virtual void OnReceivedCachedMetadata(const char* data, int len) { } + // Called when the response is complete. This method signals completion of // the resource load.ff virtual void OnCompletedRequest(const URLRequestStatus& status, diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc index 43b0edc..db97cf3 100644 --- a/webkit/glue/weburlloader_impl.cc +++ b/webkit/glue/weburlloader_impl.cc @@ -163,6 +163,7 @@ void PopulateURLResponse( const ResourceLoaderBridge::ResponseInfo& info, WebURLResponse* response) { response->setURL(url); + response->setResponseTime(info.response_time.ToDoubleT()); response->setMIMEType(WebString::fromUTF8(info.mime_type)); response->setTextEncodingName(WebString::fromUTF8(info.charset)); response->setExpectedContentLength(info.content_length); @@ -232,6 +233,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, virtual void OnReceivedResponse( const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); virtual void OnReceivedData(const char* data, int len); + virtual void OnReceivedCachedMetadata(const char* data, int len); virtual void OnCompletedRequest( const URLRequestStatus& status, const std::string& security_info); virtual GURL GetURLForDebugging() const; @@ -532,6 +534,12 @@ void WebURLLoaderImpl::Context::OnReceivedData(const char* data, int len) { } } +void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( + const char* data, int len) { + if (client_) + client_->didReceiveCachedMetadata(loader_, data, len); +} + void WebURLLoaderImpl::Context::OnCompletedRequest( const URLRequestStatus& status, const std::string& security_info) { |