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

Unified Diff: net/http/http_cache.cc

Issue 119189: Add two small features to the HttpCache for benchmarking/debugging.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.cc
===================================================================
--- net/http/http_cache.cc (revision 17638)
+++ net/http/http_cache.cc (working copy)
@@ -22,6 +22,7 @@
#include "net/base/net_errors.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_network_layer.h"
+#include "net/http/http_network_session.h"
#include "net/http/http_request_info.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
@@ -576,17 +577,24 @@
request_ = request;
effective_load_flags_ = request_->load_flags;
- // When in playback mode, we want to load exclusively from the cache.
- if (cache_->mode() == PLAYBACK)
- effective_load_flags_ |= LOAD_ONLY_FROM_CACHE;
+ switch(cache_->mode()) {
+ case NORMAL:
+ break;
+ case RECORD:
+ // When in record mode, we want to NEVER load from the cache.
+ // The reason for this is beacuse we save the Set-Cookie headers
+ // (intentionally). If we read from the cache, we replay them
+ // prematurely.
+ effective_load_flags_ |= LOAD_BYPASS_CACHE;
+ case PLAYBACK:
+ // When in playback mode, we want to load exclusively from the cache.
+ effective_load_flags_ |= LOAD_ONLY_FROM_CACHE;
+ break;
+ case DISABLE:
+ effective_load_flags_ |= LOAD_DISABLE_CACHE;
+ break;
+ }
- // When in record mode, we want to NEVER load from the cache.
- // The reason for this is beacuse we save the Set-Cookie headers
- // (intentionally). If we read from the cache, we replay them
- // prematurely.
- if (cache_->mode() == RECORD)
- effective_load_flags_ |= LOAD_BYPASS_CACHE;
-
// Some headers imply load flags. The order here is significant.
//
// LOAD_DISABLE_CACHE : no cache read or write
@@ -1165,6 +1173,7 @@
if (request->url.has_ref())
url.erase(url.find_last_of('#'));
+ DCHECK(mode_ != DISABLE);
if (mode_ == NORMAL) {
// No valid URL can begin with numerals, so we should not have to worry
// about collisions with normal URLs.
@@ -1461,6 +1470,15 @@
AddTransactionToEntry(entry, next);
}
+void HttpCache::CloseIdleConnections() {
+ net::HttpNetworkLayer* network =
+ static_cast<net::HttpNetworkLayer*>(network_layer_.get());
+ HttpNetworkSession* session = network->GetSession();
+ if (session) {
+ session->connection_pool()->CloseIdleSockets();
+ }
+}
+
//-----------------------------------------------------------------------------
} // namespace net
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698