| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return ERR_UNEXPECTED; | 175 return ERR_UNEXPECTED; |
| 176 | 176 |
| 177 // We don't need to track this operation for anything. | 177 // We don't need to track this operation for anything. |
| 178 // It could be possible to check if there is something already written and | 178 // It could be possible to check if there is something already written and |
| 179 // avoid writing again (it should be the same, right?), but let's allow the | 179 // avoid writing again (it should be the same, right?), but let's allow the |
| 180 // caller to "update" the contents with something new. | 180 // caller to "update" the contents with something new. |
| 181 return entry_->disk_entry->WriteData(kMetadataIndex, 0, buf, buf_len, | 181 return entry_->disk_entry->WriteData(kMetadataIndex, 0, buf, buf_len, |
| 182 callback, true); | 182 callback, true); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void HttpCache::Transaction::UpdateRankForExternalCacheHit() { |
| 186 DCHECK(entry_); |
| 187 entry_->disk_entry->UpdateRankForExternalCacheHit(); |
| 188 } |
| 189 |
| 185 bool HttpCache::Transaction::AddTruncatedFlag() { | 190 bool HttpCache::Transaction::AddTruncatedFlag() { |
| 186 DCHECK(mode_ & WRITE); | 191 DCHECK(mode_ & WRITE); |
| 187 | 192 |
| 188 // Don't set the flag for sparse entries. | 193 // Don't set the flag for sparse entries. |
| 189 if (partial_.get() && !truncated_) | 194 if (partial_.get() && !truncated_) |
| 190 return true; | 195 return true; |
| 191 | 196 |
| 192 if (!CanResume(true)) | 197 if (!CanResume(true)) |
| 193 return false; | 198 return false; |
| 194 | 199 |
| (...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2045 return false; | 2050 return false; |
| 2046 | 2051 |
| 2047 return true; | 2052 return true; |
| 2048 } | 2053 } |
| 2049 | 2054 |
| 2050 void HttpCache::Transaction::OnIOComplete(int result) { | 2055 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2051 DoLoop(result); | 2056 DoLoop(result); |
| 2052 } | 2057 } |
| 2053 | 2058 |
| 2054 } // namespace net | 2059 } // namespace net |
| OLD | NEW |