Index: net/http/http_cache.cc |
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc |
index d7461193762e31baf6c9c7608f1cc7ce345b9235..1a7e492c24b4f0ad2dd30a8b8cf2e0ad67d4f08a 100644 |
--- a/net/http/http_cache.cc |
+++ b/net/http/http_cache.cc |
@@ -30,6 +30,7 @@ |
#include "net/base/net_errors.h" |
#include "net/base/upload_data_stream.h" |
#include "net/disk_cache/disk_cache.h" |
+#include "net/disk_cache/pending_create_entry.h" |
#include "net/http/http_cache_transaction.h" |
#include "net/http/http_network_layer.h" |
#include "net/http/http_network_session.h" |
@@ -711,7 +712,9 @@ int HttpCache::OpenEntry(const std::string& key, ActiveEntry** entry, |
int HttpCache::CreateEntry(const std::string& key, ActiveEntry** entry, |
Transaction* trans) { |
- DCHECK(!FindActiveEntry(key)); |
+ if (FindActiveEntry(key)) { |
+ return ERR_CACHE_RACE; |
+ } |
WorkItem* item = new WorkItem(WI_CREATE_ENTRY, trans, entry); |
PendingOp* pending_op = GetPendingOp(key); |
@@ -726,8 +729,8 @@ int HttpCache::CreateEntry(const std::string& key, ActiveEntry** entry, |
pending_op->callback = base::Bind(&HttpCache::OnPendingOpComplete, |
AsWeakPtr(), pending_op); |
- int rv = disk_cache_->CreateEntry(key, &(pending_op->disk_entry), |
- pending_op->callback); |
+ int rv = disk_cache::PendingCreateEntry(disk_cache_.get(), key, |
+ &(pending_op->disk_entry)); |
if (rv != ERR_IO_PENDING) { |
item->ClearTransaction(); |
pending_op->callback.Run(rv); |