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

Unified Diff: chrome/browser/chromeos/drive/drive_uploader.cc

Issue 11231068: drive: Fix a crash in gdata::DriveUploader::ResumeUpload() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/drive_uploader.cc
diff --git a/chrome/browser/chromeos/drive/drive_uploader.cc b/chrome/browser/chromeos/drive/drive_uploader.cc
index d384787e3cb9d6ce47f0fc2b40af7ee86a73737f..b0c7dfb635e4de3b44a457e4a27b6a32f6d4f1cc 100644
--- a/chrome/browser/chromeos/drive/drive_uploader.cc
+++ b/chrome/browser/chromeos/drive/drive_uploader.cc
@@ -417,16 +417,21 @@ void DriveUploader::ReadCompletionCallback(
// The Read is asynchronously executed on BrowserThread::UI, where
// Read() was called.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ // Should be non-zero. FileStream::Read() returns 0 only at end-of-file,
+ // but we don't try to read from end-of-file.
+ DCHECK_NE(0, bytes_read);
DVLOG(1) << "ReadCompletionCallback bytes read=" << bytes_read;
UploadFileInfo* upload_file_info = GetUploadFileInfo(upload_id);
if (!upload_file_info)
return;
- // TODO(achuith): Handle this error.
- DCHECK_EQ(bytes_to_read, bytes_read);
- DCHECK_GT(bytes_read, 0) << "Error reading from file "
- << upload_file_info->file_path.value();
+ if (bytes_read < 0) {
+ LOG(ERROR) << "Error reading from file "
+ << upload_file_info->file_path.value();
+ UploadFailed(upload_file_info, google_apis::DRIVE_UPLOAD_ERROR_ABORT);
+ return;
+ }
upload_file_info->start_range = upload_file_info->end_range + 1;
upload_file_info->end_range = upload_file_info->start_range +
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698