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

Unified Diff: google_apis/drive/base_requests.cc

Issue 1130183003: Notify upload progress from batch request to its child requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments and fix msan test. Created 5 years, 7 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 | « google_apis/drive/base_requests.h ('k') | google_apis/drive/drive_api_requests.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/base_requests.cc
diff --git a/google_apis/drive/base_requests.cc b/google_apis/drive/base_requests.cc
index 164be2e16a3b3fb7197bed7be2706bbefaf78b2a..6a485e621d8262344bce1ac8611cfde967b550d5 100644
--- a/google_apis/drive/base_requests.cc
+++ b/google_apis/drive/base_requests.cc
@@ -128,8 +128,8 @@ bool GetMultipartContent(const std::string& predetermined_boundary,
return false;
google_apis::ContentTypeAndData output;
- GenerateMultipartBody(
- google_apis::MULTIPART_RELATED, predetermined_boundary, parts, &output);
+ GenerateMultipartBody(google_apis::MULTIPART_RELATED, predetermined_boundary,
+ parts, &output, nullptr);
upload_content_type->swap(output.type);
upload_content_data->swap(output.data);
return true;
@@ -166,7 +166,8 @@ scoped_ptr<base::Value> ParseJson(const std::string& json) {
void GenerateMultipartBody(MultipartType multipart_type,
const std::string& predetermined_boundary,
const std::vector<ContentTypeAndData>& parts,
- ContentTypeAndData* output) {
+ ContentTypeAndData* output,
+ std::vector<uint64>* data_offset) {
std::string boundary;
// Generate random boundary.
if (predetermined_boundary.empty()) {
@@ -202,9 +203,13 @@ void GenerateMultipartBody(MultipartType multipart_type,
}
output->data.clear();
+ if (data_offset)
+ data_offset->clear();
for (auto& part : parts) {
output->data.append(base::StringPrintf(
kMultipartItemHeaderFormat, boundary.c_str(), part.type.c_str()));
+ if (data_offset)
+ data_offset->push_back(output->data.size());
output->data.append(part.data);
output->data.append("\n");
}
« no previous file with comments | « google_apis/drive/base_requests.h ('k') | google_apis/drive/drive_api_requests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698