OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 | 8 |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 | 1520 |
1521 int HttpCache::Transaction::DoCacheWriteDataComplete(int result) { | 1521 int HttpCache::Transaction::DoCacheWriteDataComplete(int result) { |
1522 // Balance the AddRef from DoCacheWriteData. | 1522 // Balance the AddRef from DoCacheWriteData. |
1523 cache_callback_->Release(); | 1523 cache_callback_->Release(); |
1524 if (!cache_) | 1524 if (!cache_) |
1525 return ERR_UNEXPECTED; | 1525 return ERR_UNEXPECTED; |
1526 | 1526 |
1527 if (result < 0) | 1527 if (result < 0) |
1528 return result; | 1528 return result; |
1529 | 1529 |
1530 if (partial_.get()) | 1530 if (partial_.get()) { |
1531 return DoPartialNetworkReadCompleted(result); | 1531 // This may be the last request. |
| 1532 if (!(result == 0 && !truncated_ && |
| 1533 (partial_->IsLastRange() || mode_ == WRITE))) |
| 1534 return DoPartialNetworkReadCompleted(result); |
| 1535 } |
1532 | 1536 |
1533 if (result == 0) // End of file. | 1537 if (result == 0) // End of file. |
1534 DoneWritingToEntry(true); | 1538 DoneWritingToEntry(true); |
1535 | 1539 |
1536 return result; | 1540 return result; |
1537 } | 1541 } |
1538 | 1542 |
1539 // We received the response headers and there is no error. | 1543 // We received the response headers and there is no error. |
1540 int HttpCache::Transaction::DoSuccessfulSendRequest() { | 1544 int HttpCache::Transaction::DoSuccessfulSendRequest() { |
1541 DCHECK(!new_response_); | 1545 DCHECK(!new_response_); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 // |value| goes from 0 to 63. Actually, the max value should be 47 (0x2f) | 1740 // |value| goes from 0 to 63. Actually, the max value should be 47 (0x2f) |
1737 // but we'll see. | 1741 // but we'll see. |
1738 UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65); | 1742 UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65); |
1739 } | 1743 } |
1740 | 1744 |
1741 void HttpCache::Transaction::OnIOComplete(int result) { | 1745 void HttpCache::Transaction::OnIOComplete(int result) { |
1742 DoLoop(result); | 1746 DoLoop(result); |
1743 } | 1747 } |
1744 | 1748 |
1745 } // namespace net | 1749 } // namespace net |
OLD | NEW |