summaryrefslogtreecommitdiffstats
path: root/net/http/http_cache.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-08 23:51:23 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-08 23:51:23 +0000
commit4d91e2fea8f51b76679542893668e19fc274b287 (patch)
tree7ea8fd7c2a84b35fbd87ff95444357dae6b556a1 /net/http/http_cache.cc
parente9adf0702e30800cdfaebce8cfacff7b444b4e79 (diff)
downloadchromium_src-4d91e2fea8f51b76679542893668e19fc274b287.zip
chromium_src-4d91e2fea8f51b76679542893668e19fc274b287.tar.gz
chromium_src-4d91e2fea8f51b76679542893668e19fc274b287.tar.bz2
Http cache: Reorder the files after the previous mess-up.
No real code change. BUG=none TEST=none Review URL: http://codereview.chromium.org/669142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_cache.cc')
-rw-r--r--net/http/http_cache.cc124
1 files changed, 62 insertions, 62 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 32e8e55..8b0811f 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -317,14 +317,6 @@ void HttpCache::Suspend(bool suspend) {
}
// static
-bool HttpCache::ParseResponseInfo(const char* data, int len,
- HttpResponseInfo* response_info,
- bool* response_truncated) {
- Pickle pickle(data, len);
- return response_info->InitFromPickle(pickle, response_truncated);
-}
-
-// static
bool HttpCache::ReadResponseInfo(disk_cache::Entry* disk_entry,
HttpResponseInfo* response_info,
bool* response_truncated) {
@@ -358,6 +350,14 @@ bool HttpCache::WriteResponseInfo(disk_cache::Entry* disk_entry,
true) == len;
}
+// static
+bool HttpCache::ParseResponseInfo(const char* data, int len,
+ HttpResponseInfo* response_info,
+ bool* response_truncated) {
+ Pickle pickle(data, len);
+ return response_info->InitFromPickle(pickle, response_truncated);
+}
+
void HttpCache::WriteMetadata(const GURL& url,
base::Time expected_response_time, IOBuffer* buf,
int buf_len) {
@@ -373,6 +373,20 @@ void HttpCache::WriteMetadata(const GURL& url,
writer->Write(url, expected_response_time, buf, buf_len);
}
+void HttpCache::CloseCurrentConnections() {
+ net::HttpNetworkLayer* network =
+ static_cast<net::HttpNetworkLayer*>(network_layer_.get());
+ HttpNetworkSession* session = network->GetSession();
+ if (session) {
+ session->tcp_socket_pool()->CloseIdleSockets();
+ if (session->spdy_session_pool())
+ session->spdy_session_pool()->CloseAllSessions();
+ session->ReplaceTCPSocketPool();
+ }
+}
+
+//-----------------------------------------------------------------------------
+
// Generate a key that can be used inside the cache.
std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) {
// Strip out the reference, username, and password sections of the URL.
@@ -477,6 +491,46 @@ HttpCache::ActiveEntry* HttpCache::FindActiveEntry(const std::string& key) {
return it != active_entries_.end() ? it->second : NULL;
}
+HttpCache::ActiveEntry* HttpCache::ActivateEntry(
+ const std::string& key,
+ disk_cache::Entry* disk_entry) {
+ DCHECK(!FindActiveEntry(key));
+ ActiveEntry* entry = new ActiveEntry(disk_entry);
+ active_entries_[key] = entry;
+ return entry;
+}
+
+void HttpCache::DeactivateEntry(ActiveEntry* entry) {
+ DCHECK(!entry->will_process_pending_queue);
+ DCHECK(!entry->doomed);
+ DCHECK(!entry->writer);
+ DCHECK(entry->readers.empty());
+ DCHECK(entry->pending_queue.empty());
+
+ std::string key = entry->disk_entry->GetKey();
+ if (key.empty())
+ return SlowDeactivateEntry(entry);
+
+ ActiveEntriesMap::iterator it = active_entries_.find(key);
+ DCHECK(it != active_entries_.end());
+ DCHECK(it->second == entry);
+
+ active_entries_.erase(it);
+ delete entry;
+}
+
+// We don't know this entry's key so we have to find it without it.
+void HttpCache::SlowDeactivateEntry(ActiveEntry* entry) {
+ for (ActiveEntriesMap::iterator it = active_entries_.begin();
+ it != active_entries_.end(); ++it) {
+ if (it->second == entry) {
+ active_entries_.erase(it);
+ delete entry;
+ break;
+ }
+ }
+}
+
HttpCache::NewEntry* HttpCache::GetNewEntry(const std::string& key) {
DCHECK(!FindActiveEntry(key));
@@ -573,46 +627,6 @@ void HttpCache::DestroyEntry(ActiveEntry* entry) {
}
}
-HttpCache::ActiveEntry* HttpCache::ActivateEntry(
- const std::string& key,
- disk_cache::Entry* disk_entry) {
- DCHECK(!FindActiveEntry(key));
- ActiveEntry* entry = new ActiveEntry(disk_entry);
- active_entries_[key] = entry;
- return entry;
-}
-
-void HttpCache::DeactivateEntry(ActiveEntry* entry) {
- DCHECK(!entry->will_process_pending_queue);
- DCHECK(!entry->doomed);
- DCHECK(!entry->writer);
- DCHECK(entry->readers.empty());
- DCHECK(entry->pending_queue.empty());
-
- std::string key = entry->disk_entry->GetKey();
- if (key.empty())
- return SlowDeactivateEntry(entry);
-
- ActiveEntriesMap::iterator it = active_entries_.find(key);
- DCHECK(it != active_entries_.end());
- DCHECK(it->second == entry);
-
- active_entries_.erase(it);
- delete entry;
-}
-
-// We don't know this entry's key so we have to find it without it.
-void HttpCache::SlowDeactivateEntry(ActiveEntry* entry) {
- for (ActiveEntriesMap::iterator it = active_entries_.begin();
- it != active_entries_.end(); ++it) {
- if (it->second == entry) {
- active_entries_.erase(it);
- delete entry;
- break;
- }
- }
-}
-
int HttpCache::AddTransactionToEntry(ActiveEntry* entry, Transaction* trans) {
DCHECK(entry);
@@ -900,18 +914,4 @@ void HttpCache::OnIOComplete(int result, NewEntry* new_entry) {
}
}
-void HttpCache::CloseCurrentConnections() {
- net::HttpNetworkLayer* network =
- static_cast<net::HttpNetworkLayer*>(network_layer_.get());
- HttpNetworkSession* session = network->GetSession();
- if (session) {
- session->tcp_socket_pool()->CloseIdleSockets();
- if (session->spdy_session_pool())
- session->spdy_session_pool()->CloseAllSessions();
- session->ReplaceTCPSocketPool();
- }
-}
-
-//-----------------------------------------------------------------------------
-
} // namespace net