Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: net/http/http_cache_transaction.cc

Issue 1253173002: revert is_sparse_ "simplification" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698