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

Unified Diff: chrome/browser/google_apis/base_operations.cc

Issue 12246002: Implement GetUploadStatusOperation on GData WAPI. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148632_create_base_operation
Patch Set: Rebase Created 7 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 | « no previous file | chrome/browser/google_apis/gdata_wapi_operations.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/base_operations.cc
diff --git a/chrome/browser/google_apis/base_operations.cc b/chrome/browser/google_apis/base_operations.cc
index d74bda16e73d9c4adb4e0fe09b12c6352de1e209..4deebea60396685c64a65465108e8a07f70532e7 100644
--- a/chrome/browser/google_apis/base_operations.cc
+++ b/chrome/browser/google_apis/base_operations.cc
@@ -477,8 +477,11 @@ void UploadRangeOperationBase::ProcessURLFetchResults(
if (code == HTTP_RESUME_INCOMPLETE) {
// Retrieve value of the first "Range" header.
- int64 start_position_received = -1;
- int64 end_position_received = -1;
+ // The Range header is appeared only if there is at least one received
+ // byte. So, initialize the positions by 0 so that the [0,0) will be
+ // returned via the |callback_| for empty data case.
+ int64 start_position_received = 0;
+ int64 end_position_received = 0;
std::string range_received;
hdrs->EnumerateHeader(NULL, kUploadResponseRange, &range_received);
if (!range_received.empty()) { // Parse the range header.
@@ -494,6 +497,9 @@ void UploadRangeOperationBase::ProcessURLFetchResults(
end_position_received = ranges[0].last_byte_position() + 1;
}
}
+ // The Range header has the received data range, so the start position
+ // should be always 0.
+ DCHECK_EQ(start_position_received, 0);
DVLOG(1) << "Got response for [" << drive_file_path_.value()
<< "]: code=" << code
<< ", range_hdr=[" << range_received
« no previous file with comments | « no previous file | chrome/browser/google_apis/gdata_wapi_operations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698