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

Side by Side Diff: chrome/browser/google_apis/drive_uploader.h

Issue 12209035: Implement retry flow on DriveUploader. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148632_wapi_get_upload_status_operation_impl
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOADER_H_ 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOADER_H_
6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOADER_H_ 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOADER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const GURL& upload_location); 117 const GURL& upload_location);
118 118
119 // Uploads the next chunk of data from the file. 119 // Uploads the next chunk of data from the file.
120 void UploadNextChunk(scoped_ptr<UploadFileInfo> upload_file_info); 120 void UploadNextChunk(scoped_ptr<UploadFileInfo> upload_file_info);
121 121
122 // net::FileStream::Read completion callback. 122 // net::FileStream::Read completion callback.
123 void ReadCompletionCallback(scoped_ptr<UploadFileInfo> upload_file_info, 123 void ReadCompletionCallback(scoped_ptr<UploadFileInfo> upload_file_info,
124 int bytes_to_read, 124 int bytes_to_read,
125 int bytes_read); 125 int bytes_read);
126 126
127 // Calls DriveService's ResumeUpload with the current upload info. 127 // Call DriveServer's ResumeUpload with the current remaining chunk of data.
satorux1 2013/02/07 05:48:32 Calls ?
128 // |start_position| should be the position in the file, and it must be
129 // in the current chunk range. In other words, the actual data range sent
130 // to the server will be |start_position| to the end of the current chunk.
128 void ResumeUpload(scoped_ptr<UploadFileInfo> upload_file_info, 131 void ResumeUpload(scoped_ptr<UploadFileInfo> upload_file_info,
129 int bytes_to_send); 132 int64 start_position);
130 133
131 // DriveService callback for ResumeUpload. 134 // DriveService callback for ResumeUpload.
132 void OnUploadRangeResponseReceived( 135 void OnUploadRangeResponseReceived(
133 scoped_ptr<UploadFileInfo> upload_file_info, 136 scoped_ptr<UploadFileInfo> upload_file_info,
134 const UploadRangeResponse& response, 137 const UploadRangeResponse& response,
135 scoped_ptr<ResourceEntry> entry); 138 scoped_ptr<ResourceEntry> entry);
136 139
140 // The server may return 5xx server error response.
141 // In such a case, following two methods will try to resume the upload.
142 // Note that in order to avoid receiving many server errors (like
143 // when the server is overloaded), this method will wait for
144 // a certain period before connecting to the server again.
145 void ResumeInterruptedUpload(
146 scoped_ptr<UploadFileInfo> upload_file_info);
147 void ResumeInterruptedUploadAfterWait(
148 scoped_ptr<UploadFileInfo> upload_file_info);
149
137 // Handle failed uploads. 150 // Handle failed uploads.
138 void UploadFailed(scoped_ptr<UploadFileInfo> upload_file_info, 151 void UploadFailed(scoped_ptr<UploadFileInfo> upload_file_info,
139 DriveUploadError error); 152 DriveUploadError error);
140 153
141 // Pointers to DriveServiceInterface object owned by DriveSystemService. 154 // Pointers to DriveServiceInterface object owned by DriveSystemService.
142 // The lifetime of this object is guaranteed to exceed that of the 155 // The lifetime of this object is guaranteed to exceed that of the
143 // DriveUploader instance. 156 // DriveUploader instance.
144 DriveServiceInterface* drive_service_; 157 DriveServiceInterface* drive_service_;
145 158
146 // TaskRunner for opening, reading, and closing files. 159 // TaskRunner for opening, reading, and closing files.
147 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 160 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
148 161
149 // Note: This should remain the last member so it'll be destroyed and 162 // Note: This should remain the last member so it'll be destroyed and
150 // invalidate its weak pointers before any other members are destroyed. 163 // invalidate its weak pointers before any other members are destroyed.
151 base::WeakPtrFactory<DriveUploader> weak_ptr_factory_; 164 base::WeakPtrFactory<DriveUploader> weak_ptr_factory_;
152 165
153 DISALLOW_COPY_AND_ASSIGN(DriveUploader); 166 DISALLOW_COPY_AND_ASSIGN(DriveUploader);
154 }; 167 };
155 168
156 } // namespace google_apis 169 } // namespace google_apis
157 170
158 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOADER_H_ 171 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_UPLOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_uploader.cc » ('j') | chrome/browser/google_apis/drive_uploader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698