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" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1116 if (!cache_.get()) | 1116 if (!cache_.get()) |
1117 return ERR_UNEXPECTED; | 1117 return ERR_UNEXPECTED; |
1118 | 1118 |
1119 // If requested, and we have a readable cache entry, and we have | 1119 // If requested, and we have a readable cache entry, and we have |
1120 // an error indicating that we're offline as opposed to in contact | 1120 // an error indicating that we're offline as opposed to in contact |
1121 // with a bad server, read from cache anyway. | 1121 // with a bad server, read from cache anyway. |
1122 if (IsOfflineError(result)) { | 1122 if (IsOfflineError(result)) { |
1123 if (mode_ == READ_WRITE && entry_ && !partial_) { | 1123 if (mode_ == READ_WRITE && entry_ && !partial_) { |
1124 RecordOfflineStatus(effective_load_flags_, | 1124 RecordOfflineStatus(effective_load_flags_, |
1125 OFFLINE_STATUS_DATA_AVAILABLE_OFFLINE); | 1125 OFFLINE_STATUS_DATA_AVAILABLE_OFFLINE); |
1126 if (effective_load_flags_ & LOAD_FROM_CACHE_IF_OFFLINE) { | |
1127 UpdateTransactionPattern(PATTERN_NOT_COVERED); | |
1128 response_.server_data_unavailable = true; | |
1129 return SetupEntryForRead(); | |
1130 } | |
1131 } else { | 1126 } else { |
1132 RecordOfflineStatus(effective_load_flags_, | 1127 RecordOfflineStatus(effective_load_flags_, |
1133 OFFLINE_STATUS_DATA_UNAVAILABLE_OFFLINE); | 1128 OFFLINE_STATUS_DATA_UNAVAILABLE_OFFLINE); |
1134 } | 1129 } |
1135 } else { | 1130 } else { |
1136 RecordOfflineStatus(effective_load_flags_, | 1131 RecordOfflineStatus(effective_load_flags_, |
1137 (result == OK ? OFFLINE_STATUS_NETWORK_SUCCEEDED : | 1132 (result == OK ? OFFLINE_STATUS_NETWORK_SUCCEEDED : |
1138 OFFLINE_STATUS_NETWORK_FAILED)); | 1133 OFFLINE_STATUS_NETWORK_FAILED)); |
1139 } | 1134 } |
mmenke
2015/04/23 13:16:45
This entire block of code is related to the load f
g.mehndiratt
2015/04/23 14:26:34
Acknowledged.
g.mehndiratt
2015/04/23 14:26:35
Other points are accepted. but if i will remove Re
mmenke
2015/04/23 14:41:28
Correct, that line isn't needed anymore, either.
| |
1140 | 1135 |
1141 // If we tried to conditionalize the request and failed, we know | 1136 // If we tried to conditionalize the request and failed, we know |
1142 // we won't be reading from the cache after this point. | 1137 // we won't be reading from the cache after this point. |
1143 if (couldnt_conditionalize_request_) | 1138 if (couldnt_conditionalize_request_) |
1144 mode_ = WRITE; | 1139 mode_ = WRITE; |
1145 | 1140 |
1146 if (result == OK) { | 1141 if (result == OK) { |
1147 next_state_ = STATE_SUCCESSFUL_SEND_REQUEST; | 1142 next_state_ = STATE_SUCCESSFUL_SEND_REQUEST; |
1148 return OK; | 1143 return OK; |
1149 } | 1144 } |
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3032 default: | 3027 default: |
3033 NOTREACHED(); | 3028 NOTREACHED(); |
3034 } | 3029 } |
3035 } | 3030 } |
3036 | 3031 |
3037 void HttpCache::Transaction::OnIOComplete(int result) { | 3032 void HttpCache::Transaction::OnIOComplete(int result) { |
3038 DoLoop(result); | 3033 DoLoop(result); |
3039 } | 3034 } |
3040 | 3035 |
3041 } // namespace net | 3036 } // namespace net |
OLD | NEW |