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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 if (entry->writer) { | 853 if (entry->writer) { |
854 DCHECK(trans == entry->writer); | 854 DCHECK(trans == entry->writer); |
855 | 855 |
856 // Assume there was a failure. | 856 // Assume there was a failure. |
857 bool success = false; | 857 bool success = false; |
858 if (cancel) { | 858 if (cancel) { |
859 DCHECK(entry->disk_entry); | 859 DCHECK(entry->disk_entry); |
860 // This is a successful operation in the sense that we want to keep the | 860 // This is a successful operation in the sense that we want to keep the |
861 // entry. | 861 // entry. |
862 success = trans->AddTruncatedFlag(); | 862 success = trans->AddTruncatedFlag(); |
| 863 // The previous operation may have deleted the entry. |
| 864 if (!trans->entry()) |
| 865 return; |
863 } | 866 } |
864 DoneWritingToEntry(entry, success); | 867 DoneWritingToEntry(entry, success); |
865 } else { | 868 } else { |
866 DoneReadingFromEntry(entry, trans); | 869 DoneReadingFromEntry(entry, trans); |
867 } | 870 } |
868 } | 871 } |
869 | 872 |
870 void HttpCache::DoneWritingToEntry(ActiveEntry* entry, bool success) { | 873 void HttpCache::DoneWritingToEntry(ActiveEntry* entry, bool success) { |
871 DCHECK(entry->readers.empty()); | 874 DCHECK(entry->readers.empty()); |
872 | 875 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 building_backend_ = false; | 1176 building_backend_ = false; |
1174 DeletePendingOp(pending_op); | 1177 DeletePendingOp(pending_op); |
1175 } | 1178 } |
1176 | 1179 |
1177 // The cache may be gone when we return from the callback. | 1180 // The cache may be gone when we return from the callback. |
1178 if (!item->DoCallback(result, backend)) | 1181 if (!item->DoCallback(result, backend)) |
1179 item->NotifyTransaction(result, NULL); | 1182 item->NotifyTransaction(result, NULL); |
1180 } | 1183 } |
1181 | 1184 |
1182 } // namespace net | 1185 } // namespace net |
OLD | NEW |