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

Issue 11358243: Redesigned and refactored ScopedMTPDeviceMapEntry, MTPDeviceMapService & MTPDeviceDelegate classes. (Closed)

Created:
8 years, 1 month ago by kmadhusu
Modified:
8 years ago
Reviewers:
Lei Zhang, kinuko
CC:
chromium-reviews, tzik+watch_chromium.org, kinuko+watch, darin-cc_chromium.org, feature-media-reviews_chromium.org
Visibility:
Public.

Description

Redesigned and refactored MTPDeviceMapService and MTPDeviceDelegate. Previously, MTPDeviceDelegate classes were ref-counted. Since the MTPDeviceDelegate was ref-counted, the design was complicated and the ownership of the MTPDeviceDelegateImpl object was not clearly defined. In this CL, (1) MTPDeviceDelegate supports weak pointers and is not ref-counted. (2) MediaFileSystemRegistry manages ScopedMTPDeviceMapEntry object. (3) ScopedMTPDeviceMapEntry manages the lifetime of MTPDeviceDelegateImpl object via MTPDeviceMapService class. (4) ScopedMTPDeviceMapEntry adds an entry in MTPDeviceMapService when the MTP device is registered as a media gallery file system by an extension. (5) ScopedMTPDeviceMapEntry removes an entry from MTPDeviceMapService, when the browser is in shutdown mode or when the last extension using the device delegate is destroyed or when the device is detached from the system or when the user revoke the device gallery permissions. (7) FileSystemOperationContext stores a weak pointer of MTPDeviceDelegate object. (8) DeviceMediaFileUtil validates the weak pointer before forwarding any file operation request to the MTPDeviceDelegateImpl. (9) When an entry is removed from MTPDeviceMapService, the ownership of the |MTPDeviceDelegateImpl| is handed off to the |MTPDeviceDelegateImpl| object which takes care of deleting itself on the right thread. BUG=144527 TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=169991

Patch Set 1 : '' #

Total comments: 8

Patch Set 2 : Addressed comments #

Patch Set 3 : Rebase #

Patch Set 4 : Fix unit test #

Total comments: 38

Patch Set 5 : Addressed review comments. #

Total comments: 2

Patch Set 6 : Addressed review comments #

Total comments: 5

Patch Set 7 : Fixed comment. #

Total comments: 2

Patch Set 8 : Rebase #

Patch Set 9 : '' #

Patch Set 10 : '' #

Total comments: 2

Patch Set 11 : Fixed GetFileInfoWorker #

Unified diffs Side-by-side diffs Delta from patch set Stats (+219 lines, -136 lines) Patch
M chrome/browser/media_gallery/media_file_system_registry.h View 1 2 3 4 5 5 chunks +15 lines, -20 lines 0 comments Download
M chrome/browser/media_gallery/media_file_system_registry.cc View 1 2 3 4 5 6 7 8 4 chunks +11 lines, -10 lines 0 comments Download
M chrome/browser/media_gallery/mtp_device_delegate_impl_linux.h View 1 2 3 4 4 chunks +25 lines, -27 lines 0 comments Download
M chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc View 1 2 3 4 5 6 7 8 9 10 21 chunks +101 lines, -27 lines 0 comments Download
M webkit/fileapi/file_system_operation_context.h View 1 2 3 4 5 3 chunks +11 lines, -5 lines 0 comments Download
M webkit/fileapi/isolated_mount_point_provider.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M webkit/fileapi/media/device_media_file_util.cc View 1 2 3 4 4 chunks +12 lines, -4 lines 0 comments Download
M webkit/fileapi/media/mtp_device_delegate.h View 1 2 3 4 3 chunks +20 lines, -22 lines 0 comments Download
M webkit/fileapi/media/mtp_device_map_service.h View 1 2 3 4 2 chunks +18 lines, -16 lines 0 comments Download
M webkit/fileapi/media/mtp_device_map_service.cc View 1 3 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 29 (0 generated)
kmadhusu
thestig: Please review media gallery code. kinuko: Please review webkit/fileapi code. Thanks.
8 years, 1 month ago (2012-11-15 03:09:34 UTC) #1
kinuko
I'm afraid this doesn't work in the current architecture since FileSystemOperationContext may access the delegate ...
8 years, 1 month ago (2012-11-15 10:23:38 UTC) #2
kmadhusu
kinuko@: I am all in to convert the synchronous file util functions to asynchronous functions. ...
8 years, 1 month ago (2012-11-15 17:52:23 UTC) #3
kinuko
On 2012/11/15 17:52:23, kmadhusu wrote: > kinuko@: I am all in to convert the synchronous ...
8 years, 1 month ago (2012-11-16 05:05:55 UTC) #4
kmadhusu
kinuko@: Added more comments in FileSystemOperationContext regarding |mtp_device_delegate_|. thestig@: CL is ready for review. Please ...
8 years, 1 month ago (2012-11-19 23:39:51 UTC) #5
kinuko
webkit/fileapi lgtm http://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.h File chrome/browser/media_gallery/mtp_device_delegate_impl_linux.h (right): http://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.h#newcode30 chrome/browser/media_gallery/mtp_device_delegate_impl_linux.h:30: // supports weak pointers because fileapi::MTPDeviceDelegate supports ...
8 years, 1 month ago (2012-11-20 06:25:33 UTC) #6
Lei Zhang
https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc File chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc (right): https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc#newcode205 chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc:205: base::CancellationFlag cancel_tasks_flag_; Do you need both |cancel_tasks_flag_| and |on_shutdown_event_| ...
8 years, 1 month ago (2012-11-21 01:33:30 UTC) #7
Lei Zhang
https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/media_file_system_registry.h File chrome/browser/media_gallery/media_file_system_registry.h (right): https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/media_file_system_registry.h#newcode61 chrome/browser/media_gallery/media_file_system_registry.h:61: // media transfer protocol(MTP) device. This object is constructed ...
8 years, 1 month ago (2012-11-21 02:32:48 UTC) #8
kmadhusu
Addressed review comments. PTAL. Thanks. https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/media_file_system_registry.h File chrome/browser/media_gallery/media_file_system_registry.h (right): https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/media_file_system_registry.h#newcode61 chrome/browser/media_gallery/media_file_system_registry.h:61: // media transfer protocol(MTP) ...
8 years, 1 month ago (2012-11-21 04:09:53 UTC) #9
Lei Zhang
https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/media_file_system_registry.h File chrome/browser/media_gallery/media_file_system_registry.h (right): https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/media_file_system_registry.h#newcode163 chrome/browser/media_gallery/media_file_system_registry.h:163: typedef std::map<const FilePath::StringType, ExtensionGalleriesHostSet> On 2012/11/21 04:09:53, kmadhusu wrote: ...
8 years, 1 month ago (2012-11-21 06:46:38 UTC) #10
kmadhusu
https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/media_file_system_registry.h File chrome/browser/media_gallery/media_file_system_registry.h (right): https://codereview.chromium.org/11358243/diff/15013/chrome/browser/media_gallery/media_file_system_registry.h#newcode163 chrome/browser/media_gallery/media_file_system_registry.h:163: typedef std::map<const FilePath::StringType, ExtensionGalleriesHostSet> On 2012/11/21 06:46:39, Lei Zhang ...
8 years, 1 month ago (2012-11-22 00:49:07 UTC) #11
Lei Zhang
Still thinking about the cancellation flag... https://chromiumcodereview.appspot.com/11358243/diff/20022/chrome/browser/media_gallery/media_file_system_registry.cc File chrome/browser/media_gallery/media_file_system_registry.cc (right): https://chromiumcodereview.appspot.com/11358243/diff/20022/chrome/browser/media_gallery/media_file_system_registry.cc#newcode727 chrome/browser/media_gallery/media_file_system_registry.cc:727: device_location, base::Bind( Why ...
8 years, 1 month ago (2012-11-22 02:25:25 UTC) #12
kmadhusu
https://chromiumcodereview.appspot.com/11358243/diff/20022/chrome/browser/media_gallery/media_file_system_registry.cc File chrome/browser/media_gallery/media_file_system_registry.cc (right): https://chromiumcodereview.appspot.com/11358243/diff/20022/chrome/browser/media_gallery/media_file_system_registry.cc#newcode727 chrome/browser/media_gallery/media_file_system_registry.cc:727: device_location, base::Bind( On 2012/11/22 02:25:25, Lei Zhang wrote: > ...
8 years, 1 month ago (2012-11-22 02:41:10 UTC) #13
Lei Zhang
https://chromiumcodereview.appspot.com/11358243/diff/15013/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc File chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc (right): https://chromiumcodereview.appspot.com/11358243/diff/15013/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc#newcode205 chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc:205: base::CancellationFlag cancel_tasks_flag_; On 2012/11/21 04:09:53, kmadhusu wrote: > On ...
8 years, 1 month ago (2012-11-22 03:09:41 UTC) #14
kmadhusu
https://chromiumcodereview.appspot.com/11358243/diff/15013/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc File chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc (right): https://chromiumcodereview.appspot.com/11358243/diff/15013/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc#newcode205 chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc:205: base::CancellationFlag cancel_tasks_flag_; On 2012/11/22 03:09:41, Lei Zhang wrote: > ...
8 years ago (2012-11-26 23:23:50 UTC) #15
Lei Zhang
https://chromiumcodereview.appspot.com/11358243/diff/16018/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc File chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc (right): https://chromiumcodereview.appspot.com/11358243/diff/16018/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc#newcode178 chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc:178: if (!cancel_tasks_flag_.IsSet()) Can we check is the cancellation flag ...
8 years ago (2012-11-27 00:13:01 UTC) #16
kmadhusu
https://chromiumcodereview.appspot.com/11358243/diff/16018/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc File chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc (right): https://chromiumcodereview.appspot.com/11358243/diff/16018/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc#newcode178 chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc:178: if (!cancel_tasks_flag_.IsSet()) On 2012/11/27 00:13:01, Lei Zhang wrote: > ...
8 years ago (2012-11-27 01:44:03 UTC) #17
Lei Zhang
On 2012/11/27 01:44:03, kmadhusu wrote: > https://chromiumcodereview.appspot.com/11358243/diff/16018/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc > File chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc (right): > > https://chromiumcodereview.appspot.com/11358243/diff/16018/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc#newcode178 > ...
8 years ago (2012-11-27 01:57:23 UTC) #18
kmadhusu
Modified other worker classes callback handlers to check the cancel_tasks_flag_ status before processing the response ...
8 years ago (2012-11-27 02:41:57 UTC) #19
Lei Zhang
Just return an error for the GetFileInfo worker on shutdown and then lgtm. https://chromiumcodereview.appspot.com/11358243/diff/28014/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc File ...
8 years ago (2012-11-27 04:10:26 UTC) #20
kmadhusu
https://chromiumcodereview.appspot.com/11358243/diff/28014/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc File chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc (right): https://chromiumcodereview.appspot.com/11358243/diff/28014/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc#newcode292 chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc:292: if (cancel_tasks_flag_.IsSet()) On 2012/11/27 04:10:26, Lei Zhang wrote: > ...
8 years ago (2012-11-27 18:15:20 UTC) #21
Lei Zhang
lgtm
8 years ago (2012-11-27 19:38:43 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kmadhusu@chromium.org/11358243/16022
8 years ago (2012-11-27 23:25:35 UTC) #23
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
8 years ago (2012-11-28 00:49:35 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kmadhusu@chromium.org/11358243/16022
8 years ago (2012-11-28 01:02:23 UTC) #25
commit-bot: I haz the power
Retried try job too often for step(s) aura_unit_tests, browser_tests, view_unittests
8 years ago (2012-11-28 02:09:11 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kmadhusu@chromium.org/11358243/16022
8 years ago (2012-11-28 02:17:40 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kmadhusu@chromium.org/11358243/16022
8 years ago (2012-11-28 15:07:25 UTC) #28
commit-bot: I haz the power
8 years ago (2012-11-28 17:52:34 UTC) #29
Message was sent while issue was closed.
Change committed as 169991

Powered by Google App Engine
This is Rietveld 408576698