| 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" // For OS_POSIX | 7 #include "build/build_config.h" // For OS_POSIX |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // avoid writing again (it should be the same, right?), but let's allow the | 320 // avoid writing again (it should be the same, right?), but let's allow the |
| 321 // caller to "update" the contents with something new. | 321 // caller to "update" the contents with something new. |
| 322 return entry_->disk_entry->WriteData(kMetadataIndex, 0, buf, buf_len, | 322 return entry_->disk_entry->WriteData(kMetadataIndex, 0, buf, buf_len, |
| 323 callback, true); | 323 callback, true); |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool HttpCache::Transaction::AddTruncatedFlag() { | 326 bool HttpCache::Transaction::AddTruncatedFlag() { |
| 327 DCHECK(mode_ & WRITE || mode_ == NONE); | 327 DCHECK(mode_ & WRITE || mode_ == NONE); |
| 328 | 328 |
| 329 // Don't set the flag for sparse entries. | 329 // Don't set the flag for sparse entries. |
| 330 if (is_sparse_) | 330 if (partial_ && !truncated_) |
| 331 return true; | 331 return true; |
| 332 | 332 |
| 333 if (!CanResume(true)) | 333 if (!CanResume(true)) |
| 334 return false; | 334 return false; |
| 335 | 335 |
| 336 // We may have received the whole resource already. | 336 // We may have received the whole resource already. |
| 337 if (done_reading_) | 337 if (done_reading_) |
| 338 return true; | 338 return true; |
| 339 | 339 |
| 340 truncated_ = true; | 340 truncated_ = true; |
| (...skipping 2577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2918 default: | 2918 default: |
| 2919 NOTREACHED(); | 2919 NOTREACHED(); |
| 2920 } | 2920 } |
| 2921 } | 2921 } |
| 2922 | 2922 |
| 2923 void HttpCache::Transaction::OnIOComplete(int result) { | 2923 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2924 DoLoop(result); | 2924 DoLoop(result); |
| 2925 } | 2925 } |
| 2926 | 2926 |
| 2927 } // namespace net | 2927 } // namespace net |
| OLD | NEW |