Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4222)

Unified Diff: chrome/common/net/url_fetcher.cc

Issue 6292013: Add chunked uploads support to SPDY (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/net/url_fetcher.h ('k') | net/base/upload_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « chrome/common/net/url_fetcher.h ('k') | net/base/upload_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698