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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_download_observer.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_download_observer.h" 5 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 8 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
9 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" 9 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h"
10 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" 10 #include "chrome/browser/chromeos/gdata/gdata_uploader.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 upload_file_info->all_bytes_present = download->AllDataSaved(); 369 upload_file_info->all_bytes_present = download->AllDataSaved();
370 370
371 upload_file_info->completion_callback = 371 upload_file_info->completion_callback =
372 base::Bind(&GDataDownloadObserver::OnUploadComplete, 372 base::Bind(&GDataDownloadObserver::OnUploadComplete,
373 weak_ptr_factory_.GetWeakPtr(), 373 weak_ptr_factory_.GetWeakPtr(),
374 download->GetId()); 374 download->GetId());
375 375
376 return upload_file_info.Pass(); 376 return upload_file_info.Pass();
377 } 377 }
378 378
379 void GDataDownloadObserver::OnUploadComplete(int32 download_id, 379 void GDataDownloadObserver::OnUploadComplete(
380 base::PlatformFileError error, 380 int32 download_id,
381 UploadFileInfo* upload_file_info) { 381 base::PlatformFileError error,
382 scoped_ptr<UploadFileInfo> upload_file_info) {
382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
383 DownloadMap::iterator iter = pending_downloads_.find(download_id); 384 DownloadMap::iterator iter = pending_downloads_.find(download_id);
384 if (iter == pending_downloads_.end()) { 385 if (iter == pending_downloads_.end()) {
385 DVLOG(1) << "Pending download not found" << download_id; 386 DVLOG(1) << "Pending download not found" << download_id;
386 return; 387 return;
387 } 388 }
388 DVLOG(1) << "Completing upload for download ID " << download_id; 389 DVLOG(1) << "Completing upload for download ID " << download_id;
389 DownloadItem* download_item = iter->second; 390 DownloadItem* download_item = iter->second;
390 UploadingExternalData* upload_data = GetUploadingExternalData(download_item); 391 UploadingExternalData* upload_data = GetUploadingExternalData(download_item);
391 DCHECK(upload_data); 392 DCHECK(upload_data);
392 upload_data->CompleteDownload(); 393 upload_data->CompleteDownload();
393 } 394 }
394 395
395 } // namespace gdata 396 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_download_observer.h ('k') | chrome/browser/chromeos/gdata/gdata_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698