| OLD | NEW |
| 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 "content/common/net/url_fetcher_core.h" | 5 #include "content/common/net/url_fetcher_core.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util_proxy.h" | 8 #include "base/file_util_proxy.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 socket_address_ = request_->GetSocketAddress(); | 555 socket_address_ = request_->GetSocketAddress(); |
| 556 was_fetched_via_proxy_ = request_->was_fetched_via_proxy(); | 556 was_fetched_via_proxy_ = request_->was_fetched_via_proxy(); |
| 557 total_response_bytes_ = request_->GetExpectedContentSize(); | 557 total_response_bytes_ = request_->GetExpectedContentSize(); |
| 558 } | 558 } |
| 559 | 559 |
| 560 ReadResponse(); | 560 ReadResponse(); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void URLFetcherCore::CompleteAddingUploadDataChunk( | 563 void URLFetcherCore::CompleteAddingUploadDataChunk( |
| 564 const std::string& content, bool is_last_chunk) { | 564 const std::string& content, bool is_last_chunk) { |
| 565 if (was_cancelled_) { |
| 566 // Since CompleteAddingUploadDataChunk() is posted as a *delayed* task, it |
| 567 // may run after the URLFetcher was already stopped. |
| 568 return; |
| 569 } |
| 565 DCHECK(is_chunked_upload_); | 570 DCHECK(is_chunked_upload_); |
| 566 DCHECK(request_.get()); | 571 DCHECK(request_.get()); |
| 567 DCHECK(!content.empty()); | 572 DCHECK(!content.empty()); |
| 568 request_->AppendChunkToUpload(content.data(), | 573 request_->AppendChunkToUpload(content.data(), |
| 569 static_cast<int>(content.length()), | 574 static_cast<int>(content.length()), |
| 570 is_last_chunk); | 575 is_last_chunk); |
| 571 } | 576 } |
| 572 | 577 |
| 573 // Return true if the write was done and reading may continue. | 578 // Return true if the write was done and reading may continue. |
| 574 // Return false if the write is pending, and the next read will | 579 // Return false if the write is pending, and the next read will |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 original_url_throttler_entry_ != url_throttler_entry_) { | 920 original_url_throttler_entry_ != url_throttler_entry_) { |
| 916 destination_url_backoff = | 921 destination_url_backoff = |
| 917 url_throttler_entry_->GetExponentialBackoffReleaseTime(); | 922 url_throttler_entry_->GetExponentialBackoffReleaseTime(); |
| 918 } | 923 } |
| 919 | 924 |
| 920 return original_url_backoff > destination_url_backoff ? | 925 return original_url_backoff > destination_url_backoff ? |
| 921 original_url_backoff : destination_url_backoff; | 926 original_url_backoff : destination_url_backoff; |
| 922 } | 927 } |
| 923 | 928 |
| 924 } // namespace content | 929 } // namespace content |
| OLD | NEW |