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

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

Issue 8633001: Http Cache: Make sure that we don't switch to mode NONE when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | 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) 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 void HttpCache::Transaction::StopCaching() { 364 void HttpCache::Transaction::StopCaching() {
365 // We really don't know where we are now. Hopefully there is no operation in 365 // We really don't know where we are now. Hopefully there is no operation in
366 // progress, but nothing really prevents this method to be called after we 366 // progress, but nothing really prevents this method to be called after we
367 // returned ERR_IO_PENDING. We cannot attempt to truncate the entry at this 367 // returned ERR_IO_PENDING. We cannot attempt to truncate the entry at this
368 // point because we need the state machine for that (and even if we are really 368 // point because we need the state machine for that (and even if we are really
369 // free, that would be an asynchronous operation). In other words, keep the 369 // free, that would be an asynchronous operation). In other words, keep the
370 // entry how it is (it will be marked as truncated at destruction), and let 370 // entry how it is (it will be marked as truncated at destruction), and let
371 // the next piece of code that executes know that we are now reading directly 371 // the next piece of code that executes know that we are now reading directly
372 // from the net. 372 // from the net.
373 if (cache_ && entry_ && (mode_ & WRITE)) 373 if (cache_ && entry_ && (mode_ & WRITE) && network_trans_.get() &&
374 !is_sparse_ && !range_requested_)
gavinp 2011/11/22 18:24:39 So this is OK because downloads are never range_re
rvargas (doing something else) 2011/11/22 18:35:03 Yes we will. 22900 is an optimization, so in this
374 mode_ = NONE; 375 mode_ = NONE;
375 } 376 }
376 377
377 void HttpCache::Transaction::DoneReading() { 378 void HttpCache::Transaction::DoneReading() {
378 if (cache_ && entry_) { 379 if (cache_ && entry_) {
379 DCHECK(reading_); 380 DCHECK(reading_);
380 DCHECK_NE(mode_, UPDATE); 381 DCHECK_NE(mode_, UPDATE);
381 if (mode_ & WRITE) 382 if (mode_ & WRITE)
382 DoneWritingToEntry(true); 383 DoneWritingToEntry(true);
383 } 384 }
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 return false; 2069 return false;
2069 2070
2070 return true; 2071 return true;
2071 } 2072 }
2072 2073
2073 void HttpCache::Transaction::OnIOComplete(int result) { 2074 void HttpCache::Transaction::OnIOComplete(int result) {
2074 DoLoop(result); 2075 DoLoop(result);
2075 } 2076 }
2076 2077
2077 } // namespace net 2078 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698