| Index: chrome/common/net/url_fetcher.cc
|
| diff --git a/chrome/common/net/url_fetcher.cc b/chrome/common/net/url_fetcher.cc
|
| index 30c18fbbd6d5227900a5356d79f93c8dbc51e76c..5e5e910e74bba8d462a76026e365f4d1a45466b2 100644
|
| --- a/chrome/common/net/url_fetcher.cc
|
| +++ b/chrome/common/net/url_fetcher.cc
|
| @@ -101,11 +101,12 @@ class URLFetcher::Core
|
| // |original_url_| and |url_|.
|
| base::TimeTicks GetBackoffReleaseTime();
|
|
|
| - void CompleteAddingUploadDataChunk(const std::string& data);
|
| + void CompleteAddingUploadDataChunk(const std::string& data,
|
| + bool is_last_chunk);
|
|
|
| // Adds a block of data to be uploaded in a POST body. This can only be called
|
| // after Start().
|
| - void AppendChunkToUpload(const std::string& data);
|
| + void AppendChunkToUpload(const std::string& data, bool is_last_chunk);
|
|
|
| URLFetcher* fetcher_; // Corresponding fetcher object
|
| GURL original_url_; // The URL we were asked to fetch
|
| @@ -291,23 +292,23 @@ void URLFetcher::Core::OnResponseStarted(net::URLRequest* request) {
|
| }
|
|
|
| void URLFetcher::Core::CompleteAddingUploadDataChunk(
|
| - const std::string& content) {
|
| + const std::string& content, bool is_last_chunk) {
|
| DCHECK(is_chunked_upload_);
|
| DCHECK(request_.get());
|
| - if (content.length()) {
|
| - request_->AppendChunkToUpload(content.data(),
|
| - static_cast<int>(content.length()));
|
| - } else {
|
| - request_->MarkEndOfChunks();
|
| - }
|
| + DCHECK(!content.empty());
|
| + request_->AppendChunkToUpload(content.data(),
|
| + static_cast<int>(content.length()),
|
| + is_last_chunk);
|
| }
|
|
|
| -void URLFetcher::Core::AppendChunkToUpload(const std::string& content) {
|
| +void URLFetcher::Core::AppendChunkToUpload(const std::string& content,
|
| + bool is_last_chunk) {
|
| DCHECK(delegate_loop_proxy_);
|
| CHECK(io_message_loop_proxy_.get());
|
| io_message_loop_proxy_->PostTask(
|
| FROM_HERE,
|
| - NewRunnableMethod(this, &Core::CompleteAddingUploadDataChunk, content));
|
| + NewRunnableMethod(this, &Core::CompleteAddingUploadDataChunk, content,
|
| + is_last_chunk));
|
| }
|
|
|
| void URLFetcher::Core::OnReadCompleted(net::URLRequest* request,
|
| @@ -520,13 +521,10 @@ void URLFetcher::set_chunked_upload(const std::string& content_type) {
|
| core_->is_chunked_upload_ = true;
|
| }
|
|
|
| -void URLFetcher::AppendChunkToUpload(const std::string& data) {
|
| +void URLFetcher::AppendChunkToUpload(const std::string& data,
|
| + bool is_last_chunk) {
|
| DCHECK(data.length());
|
| - core_->AppendChunkToUpload(data);
|
| -}
|
| -
|
| -void URLFetcher::MarkEndOfChunks() {
|
| - core_->AppendChunkToUpload(std::string());
|
| + core_->AppendChunkToUpload(data, is_last_chunk);
|
| }
|
|
|
| const std::string& URLFetcher::upload_data() const {
|
|
|