| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 NOTREACHED(); | 451 NOTREACHED(); |
| 452 rv = ERR_FAILED; | 452 rv = ERR_FAILED; |
| 453 } | 453 } |
| 454 return rv; | 454 return rv; |
| 455 } | 455 } |
| 456 | 456 |
| 457 bool HttpCache::Transaction::AddTruncatedFlag() { | 457 bool HttpCache::Transaction::AddTruncatedFlag() { |
| 458 DCHECK(mode_ & WRITE); | 458 DCHECK(mode_ & WRITE); |
| 459 | 459 |
| 460 // Don't set the flag for sparse entries. | 460 // Don't set the flag for sparse entries. |
| 461 if (partial_.get()) | 461 if (partial_.get() && !truncated_) |
| 462 return true; | 462 return true; |
| 463 | 463 |
| 464 // Double check that there is something worth keeping. | 464 // Double check that there is something worth keeping. |
| 465 if (!entry_->disk_entry->GetDataSize(kResponseContentIndex)) | 465 if (!entry_->disk_entry->GetDataSize(kResponseContentIndex)) |
| 466 return false; | 466 return false; |
| 467 | 467 |
| 468 truncated_ = true; | 468 truncated_ = true; |
| 469 WriteResponseInfoToEntry(true); | 469 WriteResponseInfoToEntry(true); |
| 470 return true; | 470 return true; |
| 471 } | 471 } |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 void HttpCache::Transaction::OnCacheWriteCompleted(int result) { | 1370 void HttpCache::Transaction::OnCacheWriteCompleted(int result) { |
| 1371 DoCacheWriteCompleted(result); | 1371 DoCacheWriteCompleted(result); |
| 1372 } | 1372 } |
| 1373 | 1373 |
| 1374 void HttpCache::Transaction::OnCacheEntryReady(int result) { | 1374 void HttpCache::Transaction::OnCacheEntryReady(int result) { |
| 1375 DCHECK_EQ(OK, result); | 1375 DCHECK_EQ(OK, result); |
| 1376 ValidateEntryHeadersAndContinue(true); | 1376 ValidateEntryHeadersAndContinue(true); |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 } // namespace net | 1379 } // namespace net |
| OLD | NEW |