| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 if (skip_validation) { | 1509 if (skip_validation) { |
| 1510 if (partial_.get()) { | 1510 if (partial_.get()) { |
| 1511 // We are going to return the saved response headers to the caller, so | 1511 // We are going to return the saved response headers to the caller, so |
| 1512 // we may need to adjust them first. | 1512 // we may need to adjust them first. |
| 1513 next_state_ = STATE_PARTIAL_HEADERS_RECEIVED; | 1513 next_state_ = STATE_PARTIAL_HEADERS_RECEIVED; |
| 1514 return OK; | 1514 return OK; |
| 1515 } | 1515 } |
| 1516 cache_->ConvertWriterToReader(entry_); | 1516 cache_->ConvertWriterToReader(entry_); |
| 1517 mode_ = READ; | 1517 mode_ = READ; |
| 1518 | 1518 |
| 1519 if (entry_ && entry_->disk_entry->GetDataSize(kMetadataIndex)) | 1519 if (entry_->disk_entry->GetDataSize(kMetadataIndex)) |
| 1520 next_state_ = STATE_CACHE_READ_METADATA; | 1520 next_state_ = STATE_CACHE_READ_METADATA; |
| 1521 } else { | 1521 } else { |
| 1522 // Make the network request conditional, to see if we may reuse our cached | 1522 // Make the network request conditional, to see if we may reuse our cached |
| 1523 // response. If we cannot do so, then we just resort to a normal fetch. | 1523 // response. If we cannot do so, then we just resort to a normal fetch. |
| 1524 // Our mode remains READ_WRITE for a conditional request. We'll switch to | 1524 // Our mode remains READ_WRITE for a conditional request. We'll switch to |
| 1525 // either READ or WRITE mode once we hear back from the server. | 1525 // either READ or WRITE mode once we hear back from the server. |
| 1526 if (!ConditionalizeRequest()) { | 1526 if (!ConditionalizeRequest()) { |
| 1527 DCHECK(!partial_.get()); | 1527 DCHECK(!partial_.get()); |
| 1528 DCHECK_NE(206, response_.headers->response_code()); | 1528 DCHECK_NE(206, response_.headers->response_code()); |
| 1529 mode_ = WRITE; | 1529 mode_ = WRITE; |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 return false; | 2016 return false; |
| 2017 | 2017 |
| 2018 return true; | 2018 return true; |
| 2019 } | 2019 } |
| 2020 | 2020 |
| 2021 void HttpCache::Transaction::OnIOComplete(int result) { | 2021 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2022 DoLoop(result); | 2022 DoLoop(result); |
| 2023 } | 2023 } |
| 2024 | 2024 |
| 2025 } // namespace net | 2025 } // namespace net |
| OLD | NEW |