summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/common/net/url_fetcher.cc32
-rw-r--r--chrome/common/net/url_fetcher.h7
2 files changed, 16 insertions, 23 deletions
diff --git a/chrome/common/net/url_fetcher.cc b/chrome/common/net/url_fetcher.cc
index 30c18fb..5e5e910 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 {
diff --git a/chrome/common/net/url_fetcher.h b/chrome/common/net/url_fetcher.h
index 20f6ea7..e3e7eff 100644
--- a/chrome/common/net/url_fetcher.h
+++ b/chrome/common/net/url_fetcher.h
@@ -140,12 +140,7 @@ class URLFetcher {
// Adds the given bytes to a request's POST data transmitted using chunked
// transfer encoding.
// This method should be called ONLY after calling Start().
- void AppendChunkToUpload(const std::string& data);
-
- // Signals the end of a chunked transfer encoded data stream. This method
- // should be called ONLY after calling Start(), set_chunked_upload() and
- // typically one or more calls to AppendChunkToUpload.
- void MarkEndOfChunks();
+ void AppendChunkToUpload(const std::string& data, bool is_last_chunk);
// Set one or more load flags as defined in net/base/load_flags.h. Must be
// called before the request is started.