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_transaction.h" | 5 #include "net/http/http_cache_transaction.h" |
6 | 6 |
7 #include "build/build_config.h" // For OS_POSIX | 7 #include "build/build_config.h" // For OS_POSIX |
8 | 8 |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 | 1153 |
1154 // If there is a failure, the cache should have taken care of new_entry_. | 1154 // If there is a failure, the cache should have taken care of new_entry_. |
1155 new_entry_ = NULL; | 1155 new_entry_ = NULL; |
1156 | 1156 |
1157 if (result == ERR_CACHE_RACE) { | 1157 if (result == ERR_CACHE_RACE) { |
1158 next_state_ = STATE_INIT_ENTRY; | 1158 next_state_ = STATE_INIT_ENTRY; |
1159 return OK; | 1159 return OK; |
1160 } | 1160 } |
1161 | 1161 |
1162 if (result == ERR_CACHE_LOCK_TIMEOUT) { | 1162 if (result == ERR_CACHE_LOCK_TIMEOUT) { |
| 1163 if (mode_ == READ) |
| 1164 return ERR_CACHE_MISS; |
| 1165 |
1163 // The cache is busy, bypass it for this transaction. | 1166 // The cache is busy, bypass it for this transaction. |
1164 mode_ = NONE; | 1167 mode_ = NONE; |
1165 next_state_ = STATE_SEND_REQUEST; | 1168 next_state_ = STATE_SEND_REQUEST; |
1166 if (partial_) { | 1169 if (partial_) { |
1167 partial_->RestoreHeaders(&custom_request_->extra_headers); | 1170 partial_->RestoreHeaders(&custom_request_->extra_headers); |
1168 partial_.reset(); | 1171 partial_.reset(); |
1169 } | 1172 } |
1170 return OK; | 1173 return OK; |
1171 } | 1174 } |
1172 | 1175 |
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 default: | 2995 default: |
2993 NOTREACHED(); | 2996 NOTREACHED(); |
2994 } | 2997 } |
2995 } | 2998 } |
2996 | 2999 |
2997 void HttpCache::Transaction::OnIOComplete(int result) { | 3000 void HttpCache::Transaction::OnIOComplete(int result) { |
2998 DoLoop(result); | 3001 DoLoop(result); |
2999 } | 3002 } |
3000 | 3003 |
3001 } // namespace net | 3004 } // namespace net |
OLD | NEW |