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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 | 1181 |
1182 // We received 304 or 206 and we want to update the cached response headers. | 1182 // We received 304 or 206 and we want to update the cached response headers. |
1183 int HttpCache::Transaction::DoUpdateCachedResponse() { | 1183 int HttpCache::Transaction::DoUpdateCachedResponse() { |
1184 next_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; | 1184 next_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; |
1185 int rv = OK; | 1185 int rv = OK; |
1186 // Update cached response based on headers in new_response. | 1186 // Update cached response based on headers in new_response. |
1187 // TODO(wtc): should we update cached certificate (response_.ssl_info), too? | 1187 // TODO(wtc): should we update cached certificate (response_.ssl_info), too? |
1188 response_.headers->Update(*new_response_->headers); | 1188 response_.headers->Update(*new_response_->headers); |
1189 response_.response_time = new_response_->response_time; | 1189 response_.response_time = new_response_->response_time; |
1190 response_.request_time = new_response_->request_time; | 1190 response_.request_time = new_response_->request_time; |
| 1191 response_.network_accessed = new_response_->network_accessed; |
1191 | 1192 |
1192 if (response_.headers->HasHeaderValue("cache-control", "no-store")) { | 1193 if (response_.headers->HasHeaderValue("cache-control", "no-store")) { |
1193 if (!entry_->doomed) { | 1194 if (!entry_->doomed) { |
1194 int ret = cache_->DoomEntry(cache_key_, NULL); | 1195 int ret = cache_->DoomEntry(cache_key_, NULL); |
1195 DCHECK_EQ(OK, ret); | 1196 DCHECK_EQ(OK, ret); |
1196 } | 1197 } |
1197 } else { | 1198 } else { |
1198 // If we are already reading, we already updated the headers for this | 1199 // If we are already reading, we already updated the headers for this |
1199 // request; doing it again will change Content-Length. | 1200 // request; doing it again will change Content-Length. |
1200 if (!reading_) { | 1201 if (!reading_) { |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 } | 2520 } |
2520 | 2521 |
2521 int HttpCache::Transaction::ResetCacheIOStart(int return_value) { | 2522 int HttpCache::Transaction::ResetCacheIOStart(int return_value) { |
2522 DCHECK(cache_io_start_.is_null()); | 2523 DCHECK(cache_io_start_.is_null()); |
2523 if (return_value == ERR_IO_PENDING) | 2524 if (return_value == ERR_IO_PENDING) |
2524 cache_io_start_ = base::TimeTicks::Now(); | 2525 cache_io_start_ = base::TimeTicks::Now(); |
2525 return return_value; | 2526 return return_value; |
2526 } | 2527 } |
2527 | 2528 |
2528 } // namespace net | 2529 } // namespace net |
OLD | NEW |