| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 // progress, but nothing really prevents this method to be called after we | 442 // progress, but nothing really prevents this method to be called after we |
| 443 // returned ERR_IO_PENDING. We cannot attempt to truncate the entry at this | 443 // returned ERR_IO_PENDING. We cannot attempt to truncate the entry at this |
| 444 // point because we need the state machine for that (and even if we are really | 444 // point because we need the state machine for that (and even if we are really |
| 445 // free, that would be an asynchronous operation). In other words, keep the | 445 // free, that would be an asynchronous operation). In other words, keep the |
| 446 // entry how it is (it will be marked as truncated at destruction), and let | 446 // entry how it is (it will be marked as truncated at destruction), and let |
| 447 // the next piece of code that executes know that we are now reading directly | 447 // the next piece of code that executes know that we are now reading directly |
| 448 // from the net. | 448 // from the net. |
| 449 if (cache_.get() && entry_ && (mode_ & WRITE) && network_trans_.get() && | 449 if (cache_.get() && entry_ && (mode_ & WRITE) && network_trans_.get() && |
| 450 !is_sparse_ && !range_requested_) { | 450 !is_sparse_ && !range_requested_) { |
| 451 mode_ = NONE; | 451 mode_ = NONE; |
| 452 // We need to deactivate the cache entry. |
| 453 // Otherwise subsequent requests for this resource will fail. |
| 454 cache_->DoomEntry(cache_key_, NULL); |
| 452 } | 455 } |
| 453 } | 456 } |
| 454 | 457 |
| 455 bool HttpCache::Transaction::GetFullRequestHeaders( | 458 bool HttpCache::Transaction::GetFullRequestHeaders( |
| 456 HttpRequestHeaders* headers) const { | 459 HttpRequestHeaders* headers) const { |
| 457 if (network_trans_) | 460 if (network_trans_) |
| 458 return network_trans_->GetFullRequestHeaders(headers); | 461 return network_trans_->GetFullRequestHeaders(headers); |
| 459 | 462 |
| 460 // TODO(ttuttle): Read headers from cache. | 463 // TODO(ttuttle): Read headers from cache. |
| 461 return false; | 464 return false; |
| (...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 default: | 2520 default: |
| 2518 NOTREACHED(); | 2521 NOTREACHED(); |
| 2519 } | 2522 } |
| 2520 } | 2523 } |
| 2521 | 2524 |
| 2522 void HttpCache::Transaction::OnIOComplete(int result) { | 2525 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2523 DoLoop(result); | 2526 DoLoop(result); |
| 2524 } | 2527 } |
| 2525 | 2528 |
| 2526 } // namespace net | 2529 } // namespace net |
| OLD | NEW |