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

Unified Diff: net/url_request/url_fetcher_core.cc

Issue 14578004: Support range uploading of a file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
Index: net/url_request/url_fetcher_core.cc
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index 31d09475f61a11f1d13f6c9b13d44daec31fd875..24d4b46889f50c8db220bd7459b8ff1b76c17d13 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -78,6 +78,8 @@ URLFetcherCore::URLFetcherCore(URLFetcher* fetcher,
url_request_data_key_(NULL),
was_fetched_via_proxy_(false),
upload_content_set_(false),
+ upload_range_offset_(0),
+ upload_range_length_(0),
is_chunked_upload_(false),
was_cancelled_(false),
file_writer_(NULL),
@@ -145,16 +147,22 @@ void URLFetcherCore::SetUploadData(const std::string& upload_content_type,
void URLFetcherCore::SetUploadFilePath(
const std::string& upload_content_type,
const base::FilePath& file_path,
+ uint64 range_offset,
+ uint64 range_length,
scoped_refptr<base::TaskRunner> file_task_runner) {
DCHECK(!is_chunked_upload_);
DCHECK(!upload_content_set_);
DCHECK(upload_content_.empty());
DCHECK(upload_file_path_.empty());
+ DCHECK_EQ(upload_range_offset_, 0ULL);
+ DCHECK_EQ(upload_range_length_, 0ULL);
DCHECK(upload_content_type_.empty());
DCHECK(!upload_content_type.empty());
upload_content_type_ = upload_content_type;
upload_file_path_ = file_path;
+ upload_range_offset_ = range_offset;
+ upload_range_length_ = range_length;
upload_file_task_runner_ = file_task_runner;
upload_content_set_ = true;
}
@@ -569,7 +577,9 @@ void URLFetcherCore::StartURLRequest() {
scoped_ptr<UploadElementReader> reader(new UploadFileElementReader(
upload_file_task_runner_,
upload_file_path_,
- 0, kuint64max, base::Time()));
+ upload_range_offset_,
+ upload_range_length_,
+ base::Time()));
request_->set_upload(make_scoped_ptr(
UploadDataStream::CreateWithReader(reader.Pass(), 0)));
}

Powered by Google App Engine
This is Rietveld 408576698