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

Unified Diff: net/http/http_cache.cc

Issue 165089: Http Cache: Deactivate entries without having the key of the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 22539)
+++ net/http/http_cache.cc (working copy)
@@ -1733,13 +1733,16 @@
#endif
// Avoid optimizing local_entry out of the code.
void HttpCache::DeactivateEntry(ActiveEntry* entry) {
+ std::string key = entry->disk_entry->GetKey();
+ if (key.empty())
+ return SlowDeactivateEntry(entry);
+
// TODO(rvargas): remove this code and go back to DCHECKS once we find out
// why are we crashing. I'm just trying to gather more info for bug 3931.
ActiveEntry local_entry = *entry;
size_t readers_size = local_entry.readers.size();
size_t pending_size = local_entry.pending_queue.size();
- std::string key = entry->disk_entry->GetKey();
ActiveEntriesMap::iterator it = active_entries_.find(key);
if (it == active_entries_.end() || it->second != entry ||
local_entry.will_process_pending_queue || local_entry.doomed ||
@@ -1767,6 +1770,18 @@
#pragma optimize("", on)
#endif
+// 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);
« 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