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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_upload_file_info.cc

Issue 10540132: gdata: Convert GDataFileSystem::AddUploadFile() to asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments to explain why Patch Set #11 is necesary. Created 8 years, 6 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 | Annotate | Revision Log
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 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" 5 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "chrome/browser/chromeos/gdata/gdata_parser.h" 8 #include "chrome/browser/chromeos/gdata/gdata_parser.h"
9 9
10 namespace gdata { 10 namespace gdata {
11 11
12 UploadFileInfo::UploadFileInfo() 12 UploadFileInfo::UploadFileInfo()
13 : upload_id(-1), 13 : upload_id(-1),
14 file_size(0), 14 file_size(0),
15 content_length(0), 15 content_length(0),
16 file_stream(NULL), 16 file_stream(NULL),
17 buf_len(0), 17 buf_len(0),
18 start_range(0), 18 start_range(0),
19 end_range(-1), 19 end_range(-1),
20 all_bytes_present(false), 20 all_bytes_present(false),
21 upload_paused(false), 21 upload_paused(false),
22 should_retry_file_open(false), 22 should_retry_file_open(false),
23 num_file_open_tries(0) { 23 num_file_open_tries(0) {
24 } 24 }
25 25
26 UploadFileInfo::~UploadFileInfo() { 26 UploadFileInfo::~UploadFileInfo() {
27 // The file stream is closed by the destructor asynchronously.
28 if (file_stream) {
29 delete file_stream;
30 file_stream = NULL;
31 }
27 } 32 }
28 33
29 int64 UploadFileInfo::SizeRemaining() const { 34 int64 UploadFileInfo::SizeRemaining() const {
30 DCHECK(file_size > end_range); 35 DCHECK(file_size > end_range);
31 // Note that uploaded_bytes = end_range + 1; 36 // Note that uploaded_bytes = end_range + 1;
32 return file_size - end_range - 1; 37 return file_size - end_range - 1;
33 } 38 }
34 39
35 std::string UploadFileInfo::DebugString() const { 40 std::string UploadFileInfo::DebugString() const {
36 return "title=[" + title + 41 return "title=[" + title +
37 "], file_path=[" + file_path.value() + 42 "], file_path=[" + file_path.value() +
38 "], content_type=[" + content_type + 43 "], content_type=[" + content_type +
39 "], file_size=[" + base::UintToString(file_size) + 44 "], file_size=[" + base::UintToString(file_size) +
40 "], gdata_path=[" + gdata_path.value() + 45 "], gdata_path=[" + gdata_path.value() +
41 "]"; 46 "]";
42 } 47 }
43 48
44 } // namespace gdata 49 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_upload_file_info.h ('k') | chrome/browser/chromeos/gdata/gdata_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698