OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 | 10 |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
715 if (rv != ERR_IO_PENDING) { | 715 if (rv != ERR_IO_PENDING) { |
716 item->ClearTransaction(); | 716 item->ClearTransaction(); |
717 pending_op->callback.Run(rv); | 717 pending_op->callback.Run(rv); |
718 } | 718 } |
719 | 719 |
720 return rv; | 720 return rv; |
721 } | 721 } |
722 | 722 |
723 int HttpCache::CreateEntry(const std::string& key, ActiveEntry** entry, | 723 int HttpCache::CreateEntry(const std::string& key, ActiveEntry** entry, |
724 Transaction* trans) { | 724 Transaction* trans) { |
725 DCHECK(!FindActiveEntry(key)); | 725 if (FindActiveEntry(key)) { |
726 return ERR_CACHE_RACE; | |
727 } | |
728 | |
gavinp
2013/05/03 11:19:27
Nit: extra blank line.
felipeg
2013/05/03 11:47:28
Done.
| |
726 | 729 |
727 WorkItem* item = new WorkItem(WI_CREATE_ENTRY, trans, entry); | 730 WorkItem* item = new WorkItem(WI_CREATE_ENTRY, trans, entry); |
728 PendingOp* pending_op = GetPendingOp(key); | 731 PendingOp* pending_op = GetPendingOp(key); |
729 if (pending_op->writer) { | 732 if (pending_op->writer) { |
730 pending_op->pending_queue.push_back(item); | 733 pending_op->pending_queue.push_back(item); |
731 return ERR_IO_PENDING; | 734 return ERR_IO_PENDING; |
732 } | 735 } |
733 | 736 |
734 DCHECK(pending_op->pending_queue.empty()); | 737 DCHECK(pending_op->pending_queue.empty()); |
735 | 738 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1127 building_backend_ = false; | 1130 building_backend_ = false; |
1128 DeletePendingOp(pending_op); | 1131 DeletePendingOp(pending_op); |
1129 } | 1132 } |
1130 | 1133 |
1131 // The cache may be gone when we return from the callback. | 1134 // The cache may be gone when we return from the callback. |
1132 if (!item->DoCallback(result, backend)) | 1135 if (!item->DoCallback(result, backend)) |
1133 item->NotifyTransaction(result, NULL); | 1136 item->NotifyTransaction(result, NULL); |
1134 } | 1137 } |
1135 | 1138 |
1136 } // namespace net | 1139 } // namespace net |
OLD | NEW |