diff options
author | simonjam@chromium.org <simonjam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 20:13:28 +0000 |
---|---|---|
committer | simonjam@chromium.org <simonjam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 20:13:28 +0000 |
commit | 704359693f5c8507635155ae117c466a7149065a (patch) | |
tree | 55778bdae67f960440441085372fc98c1f974c80 /content/browser/renderer_host/resource_dispatcher_host.cc | |
parent | 89b2312b5aca51da726b93e966842ffd5f642402 (diff) | |
download | chromium_src-704359693f5c8507635155ae117c466a7149065a.zip chromium_src-704359693f5c8507635155ae117c466a7149065a.tar.gz chromium_src-704359693f5c8507635155ae117c466a7149065a.tar.bz2 |
Inform disk cache of WebKit memory cache hits.
BUG=37112
TEST=net_unittests
Review URL: http://codereview.chromium.org/7461106
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95145 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/resource_dispatcher_host.cc')
-rw-r--r-- | content/browser/renderer_host/resource_dispatcher_host.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc index 0b78183..f0d933b 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.cc +++ b/content/browser/renderer_host/resource_dispatcher_host.cc @@ -68,7 +68,9 @@ #include "net/base/request_priority.h" #include "net/base/ssl_cert_request_info.h" #include "net/base/upload_data.h" +#include "net/http/http_cache.h" #include "net/http/http_response_headers.h" +#include "net/http/http_transaction_factory.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_job_factory.h" @@ -338,9 +340,17 @@ bool ResourceDispatcherHost::OnMessageReceived(const IPC::Message& message, IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) + IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, + OnDidLoadResourceFromMemoryCache) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() + if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { + // We just needed to peek at this message. We still want it to reach its + // normal destination. + handled = false; + } + filter_ = NULL; return handled; } @@ -675,6 +685,18 @@ void ResourceDispatcherHost::OnSwapOutACK( &RenderViewHost::OnSwapOutACK); } +void ResourceDispatcherHost::OnDidLoadResourceFromMemoryCache( + const GURL& url, + const std::string& security_info, + const std::string& http_method, + ResourceType::Type resource_type) { + if (!url.is_valid() || !(url.SchemeIs("http") || url.SchemeIs("https"))) + return; + + filter_->GetURLRequestContext(resource_type)->http_transaction_factory()-> + GetCache()->OnExternalCacheHit(url, http_method); +} + // We are explicitly forcing the download of 'url'. void ResourceDispatcherHost::BeginDownload( const GURL& url, |