Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: content/browser/renderer_host/resource_dispatcher_host.cc

Issue 7461106: Inform disk cache of WebKit memory cache hits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move http check Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/resource_dispatcher_host.cc
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc
index 0b78183547b3aaf56fdaeba238350cee743a8188..f0d933bdbec50cbf021bb993f8347cd8bf34a00a 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")))
James Simonsen 2011/08/02 00:14:28 I had to add this check, because WebKit was sendin
+ 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,
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host.h ('k') | content/browser/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698