OLD | NEW |
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_uploader.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 DeleteUpload(upload_file_info); | 361 DeleteUpload(upload_file_info); |
362 } | 362 } |
363 | 363 |
364 void GDataUploader::UploadFailed(UploadFileInfo* upload_file_info) { | 364 void GDataUploader::UploadFailed(UploadFileInfo* upload_file_info) { |
365 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 365 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
366 LOG(ERROR) << "Upload failed " << upload_file_info->DebugString(); | 366 LOG(ERROR) << "Upload failed " << upload_file_info->DebugString(); |
367 if (!upload_file_info->completion_callback.is_null()) { | 367 if (!upload_file_info->completion_callback.is_null()) { |
368 upload_file_info->completion_callback.Run(base::PLATFORM_FILE_ERROR_ABORT, | 368 upload_file_info->completion_callback.Run(base::PLATFORM_FILE_ERROR_ABORT, |
369 upload_file_info); | 369 upload_file_info); |
370 } | 370 } |
371 file_system_->GetOperationRegistry()->CancelForFilePath( | |
372 upload_file_info->gdata_path); | |
373 DeleteUpload(upload_file_info); | 371 DeleteUpload(upload_file_info); |
374 } | 372 } |
375 | 373 |
376 void GDataUploader::DeleteUpload(UploadFileInfo* upload_file_info) { | 374 void GDataUploader::DeleteUpload(UploadFileInfo* upload_file_info) { |
377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 375 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
378 | 376 |
379 DVLOG(1) << "Deleting upload " << upload_file_info->gdata_path.value(); | 377 DVLOG(1) << "Deleting upload " << upload_file_info->gdata_path.value(); |
380 pending_uploads_.erase(upload_file_info->upload_id); | 378 pending_uploads_.erase(upload_file_info->upload_id); |
381 | 379 |
382 // The file stream is closed by the destructor asynchronously. | 380 // The file stream is closed by the destructor asynchronously. |
383 delete upload_file_info->file_stream; | 381 delete upload_file_info->file_stream; |
384 delete upload_file_info; | 382 delete upload_file_info; |
385 } | 383 } |
386 | 384 |
387 } // namespace gdata | 385 } // namespace gdata |
OLD | NEW |