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

Issue 10540132: gdata: Convert GDataFileSystem::AddUploadFile() to asynchronous. (Closed)

Created:
8 years, 6 months ago by hshi1
Modified:
8 years, 6 months ago
Reviewers:
achuithb, satorux1
CC:
chromium-reviews, achuith+watch_chromium.org, stevenjb+watch_chromium.org, davemoore+watch_chromium.org, oshima+watch_chromium.org, nkostylev+watch_chromium.org
Visibility:
Public.

Description

gdata: Convert GDataFileSystem::AddUploadFile() to asynchronous. This is part 3 of converting public synchronous functions in GDataFileSystem to asynchronous. Convert GDataFileSystem::AddUploadFile() to an asynchronous function. Upon completion it will invoke the callback on the UI thread. Pass scoped_ptr<UploadFileInfo> instead of a UploadFileInfo* pointer to GDataUploader::UploadFailed, UploadCompletedCallback callbacks, and to the callback function for GDataFileSystem::AddUploadedFile, to signify transfer of ownership. Decouple the UploadFileInfo entry removal in UploadFileInfoMap |pending_uploads_| from the deletion of the UploadFileInfo object. Rename GDataUploader::DeleteUpload() to GDataUploader::RemoveUpload() and make it private. This function only removes entry from |pending_uploads_| but no longer deletes the UploadFileInfo object. Defer deletion of UploadFileInfo object until the asynchronous function call is complete. Object is automatically deleted when the scoped pointer is no longer passed on. BUG=132389 TEST=unit_tests, browser_tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=142515

Patch Set 1 #

Patch Set 2 : Decouple the removal of UploadFileInfo from UploadFileInfoMap and object deletion #

Patch Set 3 : Rebase svn:trunk/src@142185 and resolve conflicts. #

Total comments: 6

Patch Set 4 : Address Satoru's comments. #

Total comments: 3

Patch Set 5 : Change RemoveUpload to use upload_id instead of UploadFileInfo*. #

Patch Set 6 : Get rid of the lock as suggested by Satoru. #

Total comments: 19

Patch Set 7 : Use scoped_ptr for cleaner ownership transfers and automatic deletion. #

Total comments: 4

Patch Set 8 : Call 'RemoveUpload' before the async function to ensure the map does not have deleted pointers. #

Patch Set 9 : Rebase svn:trunk/src@142413 and resolve merge conflicts with Satoru's change. #

Patch Set 10 : Rebase svn:trunk/src@142436 and resolve merge conflicts with Satoru's and Toni's changes this morni… #

Patch Set 11 : Fix a possible NULL pointer due to base::Passed. #

Total comments: 4

Patch Set 12 : Add comments to explain why Patch Set #11 is necesary. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -67 lines) Patch
M chrome/browser/chromeos/gdata/gdata_download_observer.h View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/gdata/gdata_download_observer.cc View 1 2 3 4 5 6 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/browser/chromeos/gdata/gdata_file_system.h View 1 2 3 4 5 6 7 8 9 4 chunks +18 lines, -11 lines 0 comments Download
M chrome/browser/chromeos/gdata/gdata_file_system.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +74 lines, -23 lines 0 comments Download
M chrome/browser/chromeos/gdata/gdata_upload_file_info.h View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/gdata/gdata_upload_file_info.cc View 1 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/gdata/gdata_uploader.h View 1 2 3 4 5 6 2 chunks +6 lines, -5 lines 0 comments Download
M chrome/browser/chromeos/gdata/gdata_uploader.cc View 1 2 3 4 5 6 7 7 chunks +31 lines, -21 lines 0 comments Download
M chrome/browser/chromeos/gdata/mock_gdata_file_system.h View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -2 lines 0 comments Download

Messages

Total messages: 40 (0 generated)
hshi1
Achuith: this CL is the 3rd and last part of the planned sync-to-async conversion of ...
8 years, 6 months ago (2012-06-12 22:59:30 UTC) #1
hshi1
My apologies, this CL is causing problems on real devices (when attempting to "save as" ...
8 years, 6 months ago (2012-06-12 23:40:27 UTC) #2
achuithb
On 2012/06/12 23:40:27, hshi1 wrote: > My apologies, this CL is causing problems on real ...
8 years, 6 months ago (2012-06-13 00:05:44 UTC) #3
hshi1
This looks tricky. The async AddUploadFile() is re-entrant. Suppose the DownloadObserver receives an IN_PROGRESS update ...
8 years, 6 months ago (2012-06-13 00:56:55 UTC) #4
hshi
Hi Achuith, It appears that the current Patch Set, which is a simple mechanical conversion ...
8 years, 6 months ago (2012-06-13 01:16:52 UTC) #5
hshi1
Hi Satoru and Achuith, can you please review Patch Set #2. In order to make ...
8 years, 6 months ago (2012-06-14 19:11:07 UTC) #6
hshi1
Sorry please ignore Patch Set #2 and review Patch Set #3 instead. This is rebased ...
8 years, 6 months ago (2012-06-14 20:29:16 UTC) #7
satorux1
http://codereview.chromium.org/10540132/diff/12004/chrome/browser/chromeos/gdata/gdata_file_system.cc File chrome/browser/chromeos/gdata/gdata_file_system.cc (right): http://codereview.chromium.org/10540132/diff/12004/chrome/browser/chromeos/gdata/gdata_file_system.cc#newcode1186 chrome/browser/chromeos/gdata/gdata_file_system.cc:1186: } else { maybe: else if (upload_file_info->entry.get()) { http://codereview.chromium.org/10540132/diff/12004/chrome/browser/chromeos/gdata/gdata_file_system.cc#newcode3609 ...
8 years, 6 months ago (2012-06-14 20:30:06 UTC) #8
hshi1
http://codereview.chromium.org/10540132/diff/12004/chrome/browser/chromeos/gdata/gdata_file_system.cc File chrome/browser/chromeos/gdata/gdata_file_system.cc (right): http://codereview.chromium.org/10540132/diff/12004/chrome/browser/chromeos/gdata/gdata_file_system.cc#newcode1186 chrome/browser/chromeos/gdata/gdata_file_system.cc:1186: } else { In the original code there is ...
8 years, 6 months ago (2012-06-14 20:47:27 UTC) #9
satorux1
Please get this reviewed by achuith. He's more familiar with the code. http://codereview.chromium.org/10540132/diff/7015/chrome/browser/chromeos/gdata/gdata_uploader.cc File chrome/browser/chromeos/gdata/gdata_uploader.cc ...
8 years, 6 months ago (2012-06-14 21:32:34 UTC) #10
hshi1
Patch Set #5: I think it is safer for RemoveUpload() to take an int upload_id ...
8 years, 6 months ago (2012-06-14 21:40:16 UTC) #11
satorux1
http://codereview.chromium.org/10540132/diff/7015/chrome/browser/chromeos/gdata/gdata_uploader.cc File chrome/browser/chromeos/gdata/gdata_uploader.cc (right): http://codereview.chromium.org/10540132/diff/7015/chrome/browser/chromeos/gdata/gdata_uploader.cc#newcode77 chrome/browser/chromeos/gdata/gdata_uploader.cc:77: content::DownloadItem* download) { On 2012/06/14 21:40:17, hshi1 wrote: > ...
8 years, 6 months ago (2012-06-14 21:47:25 UTC) #12
hshi1
Aha, I think you're correct. Previously I had to introduce the lock because the DeleteUpload() ...
8 years, 6 months ago (2012-06-14 21:50:30 UTC) #13
hshi1
Please check Patch Set #6, removed all locks as suggested. To clarify, the reason why ...
8 years, 6 months ago (2012-06-14 22:18:24 UTC) #14
achuithb
Could you please update the CL description so we describe everything that's going on in ...
8 years, 6 months ago (2012-06-14 22:27:17 UTC) #15
achuithb
http://codereview.chromium.org/10540132/diff/11005/chrome/browser/chromeos/gdata/gdata_file_system.cc File chrome/browser/chromeos/gdata/gdata_file_system.cc (right): http://codereview.chromium.org/10540132/diff/11005/chrome/browser/chromeos/gdata/gdata_file_system.cc#newcode3558 chrome/browser/chromeos/gdata/gdata_file_system.cc:3558: // Post a task to the same thread, rather ...
8 years, 6 months ago (2012-06-14 22:33:33 UTC) #16
satorux1
On 2012/06/14 22:27:17, achuith.bhandarkar wrote: > Could you please update the CL description so we ...
8 years, 6 months ago (2012-06-14 22:38:01 UTC) #17
achuithb
On 2012/06/14 22:38:01, satorux1 wrote: > On 2012/06/14 22:27:17, achuith.bhandarkar wrote: > > Could you ...
8 years, 6 months ago (2012-06-14 22:56:52 UTC) #18
hshi1
Achuith, can you review Patch Set #7? I think by using scoped_ptr we won't need ...
8 years, 6 months ago (2012-06-15 00:16:28 UTC) #19
hshi1
On 2012/06/14 22:56:52, achuith.bhandarkar wrote: > There are a number of manual test cases - ...
8 years, 6 months ago (2012-06-15 00:36:13 UTC) #20
achuithb
Could you please update the patch description to describe all changes in this patch?
8 years, 6 months ago (2012-06-15 01:20:39 UTC) #21
achuithb
> > The downside with postponing landing this is that there will be a 2-3 ...
8 years, 6 months ago (2012-06-15 01:27:25 UTC) #22
achuithb
http://codereview.chromium.org/10540132/diff/11005/chrome/browser/chromeos/gdata/gdata_file_system.cc File chrome/browser/chromeos/gdata/gdata_file_system.cc (right): http://codereview.chromium.org/10540132/diff/11005/chrome/browser/chromeos/gdata/gdata_file_system.cc#newcode3558 chrome/browser/chromeos/gdata/gdata_file_system.cc:3558: // Post a task to the same thread, rather ...
8 years, 6 months ago (2012-06-15 01:27:33 UTC) #23
hshi1
Achuith - I have updated the changelist description. On 2012/06/15 01:27:33, achuith.bhandarkar wrote: > I've ...
8 years, 6 months ago (2012-06-15 01:47:16 UTC) #24
achuithb
http://codereview.chromium.org/10540132/diff/6021/chrome/browser/chromeos/gdata/gdata_uploader.cc File chrome/browser/chromeos/gdata/gdata_uploader.cc (right): http://codereview.chromium.org/10540132/diff/6021/chrome/browser/chromeos/gdata/gdata_uploader.cc#newcode331 chrome/browser/chromeos/gdata/gdata_uploader.cc:331: RemoveUpload(upload_id); RemoveUpload first before passing upload_file_info to the callback. ...
8 years, 6 months ago (2012-06-15 01:53:10 UTC) #25
hshi1
Done with Patch Set #8. Thanks! http://codereview.chromium.org/10540132/diff/6021/chrome/browser/chromeos/gdata/gdata_uploader.cc File chrome/browser/chromeos/gdata/gdata_uploader.cc (right): http://codereview.chromium.org/10540132/diff/6021/chrome/browser/chromeos/gdata/gdata_uploader.cc#newcode331 chrome/browser/chromeos/gdata/gdata_uploader.cc:331: RemoveUpload(upload_id); On 2012/06/15 ...
8 years, 6 months ago (2012-06-15 02:02:46 UTC) #26
achuithb
lgtm. Please wait for Satoru-san, in case he wants to review this again. Please run ...
8 years, 6 months ago (2012-06-15 02:03:48 UTC) #27
satorux1
LGTM. The latest version looks a lot simpler than the original patch, thanks to achuith's ...
8 years, 6 months ago (2012-06-15 05:41:48 UTC) #28
achuithb
Thanks again for doing all the cleanup. I think I left the code in a ...
8 years, 6 months ago (2012-06-15 09:55:22 UTC) #29
hshi1
I resolved some merge conflicts with TOT this morning and re-ran manual tests with different ...
8 years, 6 months ago (2012-06-15 18:32:52 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hshi@chromium.org/10540132/20001
8 years, 6 months ago (2012-06-15 18:55:27 UTC) #31
commit-bot: I haz the power
Failed to apply patch for chrome/browser/chromeos/gdata/gdata_file_system.cc: While running patch -p1 --forward --force; patching file chrome/browser/chromeos/gdata/gdata_file_system.cc ...
8 years, 6 months ago (2012-06-15 18:55:38 UTC) #32
hshi1
Looks like two more changes got landed in gdata_file_system.cc this morning after my previous rebase. ...
8 years, 6 months ago (2012-06-15 18:59:55 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hshi@chromium.org/10540132/21015
8 years, 6 months ago (2012-06-15 19:21:05 UTC) #34
hshi1
Satoru can you review this (Patch Set #11)? Looks like the scoped_ptr upload_file_info may be ...
8 years, 6 months ago (2012-06-15 21:51:56 UTC) #35
achuithb
http://codereview.chromium.org/10540132/diff/31003/chrome/browser/chromeos/gdata/gdata_file_system.cc File chrome/browser/chromeos/gdata/gdata_file_system.cc (right): http://codereview.chromium.org/10540132/diff/31003/chrome/browser/chromeos/gdata/gdata_file_system.cc#newcode1181 chrome/browser/chromeos/gdata/gdata_file_system.cc:1181: const UploadFileInfo* upload_file_info_ptr = upload_file_info.get(); Please add a comment.
8 years, 6 months ago (2012-06-15 21:53:57 UTC) #36
satorux1
http://codereview.chromium.org/10540132/diff/31003/chrome/browser/chromeos/gdata/gdata_file_system.cc File chrome/browser/chromeos/gdata/gdata_file_system.cc (right): http://codereview.chromium.org/10540132/diff/31003/chrome/browser/chromeos/gdata/gdata_file_system.cc#newcode1181 chrome/browser/chromeos/gdata/gdata_file_system.cc:1181: const UploadFileInfo* upload_file_info_ptr = upload_file_info.get(); On 2012/06/15 21:53:58, achuith.bhandarkar ...
8 years, 6 months ago (2012-06-15 21:59:15 UTC) #37
hshi1
http://codereview.chromium.org/10540132/diff/31003/chrome/browser/chromeos/gdata/gdata_file_system.cc File chrome/browser/chromeos/gdata/gdata_file_system.cc (right): http://codereview.chromium.org/10540132/diff/31003/chrome/browser/chromeos/gdata/gdata_file_system.cc#newcode1181 chrome/browser/chromeos/gdata/gdata_file_system.cc:1181: const UploadFileInfo* upload_file_info_ptr = upload_file_info.get(); On 2012/06/15 21:53:58, achuith.bhandarkar ...
8 years, 6 months ago (2012-06-15 22:05:48 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hshi@chromium.org/10540132/27006
8 years, 6 months ago (2012-06-15 22:10:10 UTC) #39
commit-bot: I haz the power
8 years, 6 months ago (2012-06-15 23:14:40 UTC) #40
Change committed as 142515

Powered by Google App Engine
This is Rietveld 408576698