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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 |
OLD | NEW |