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

Issue 2712613002: Call WatcherManager functions on the IO thread. (Closed)

Created:
3 years, 10 months ago by Shuhei Takahashi
Modified:
3 years, 8 months ago
Reviewers:
hidehiko, mtomasz, tzik
CC:
chromium-reviews, elijahtaylor+arcwatch_chromium.org, extensions-reviews_chromium.org, yamaguchi+watch_chromium.org, yusukes+watch_chromium.org, tzik, hidehiko+watch_chromium.org, oka+watch_chromium.org, nhiroki, rginda+watch_chromium.org, lhchavez+watch_chromium.org, oshima+watch_chromium.org, fukino+watch_chromium.org, chromium-apps-reviews_chromium.org, kinuko+fileapi, davemoore+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Call WatcherManager functions on the IO thread. Currently it is very difficult to correctly implement WatcherManager if it needs async operations due to following two facts: 1. WatcherManager functions do not receive storage::FileSystemOperationContext, while storage::AsyncFileUtil methods do. 2. WatcherManager functions are called on the UI thread, while other methods and destructors of its siblings (like storage::FileSystemBackend and storage::AsyncFileUtil) are all called on the IO thread. Due to (1), we can't assume WatcherManager and its siblings are alive after we post tasks to other threads in WatcherManager functions. Typically we use weak pointers to avoid this kind of race conditions, but due to (2) it is not possible because WatcherManager is destructed on the IO thread. This patch will fix the issue by requiring WatcherManager functions to be called on the IO thread. What this patch does are: - Update private_api_file_system.{cc,h}, the only caller of WatcherManager today, to call WatcherManager functions on the IO thread. - Update WatcherManager implementation for File System Providers to post tasks to the UI thread. - Update DCHECK / comments accordingly. Note that MTPWatcherManager actually expects its functions to be called on the IO thread and is broken today, so no change is needed. BUG=chromium:692586 TEST=trybot Review-Url: https://codereview.chromium.org/2712613002 Cr-Commit-Position: refs/heads/master@{#452768} Committed: https://chromium.googlesource.com/chromium/src/+/bf45258a17f7f528b652a6b033c606787f8f9a0d

Patch Set 1 #

Patch Set 2 : . #

Total comments: 5

Patch Set 3 : Rebased to ToT. #

Patch Set 4 : Updated comments as per mtomasz's request. #

Total comments: 10

Patch Set 5 : Addressed hidehiko's comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -57 lines) Patch
M chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h View 1 2 3 4 5 chunks +39 lines, -7 lines 0 comments Download
M chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc View 1 2 3 4 3 chunks +87 lines, -38 lines 0 comments Download
M chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc View 1 2 3 4 4 chunks +54 lines, -10 lines 0 comments Download
M chrome/browser/chromeos/fileapi/mtp_watcher_manager.cc View 3 chunks +6 lines, -0 lines 0 comments Download
M storage/browser/fileapi/watcher_manager.h View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 32 (21 generated)
Shuhei Takahashi
mtomasz, tzik: PTAL all hidehiko: PTAL at chrome/browser/chromeos/arc/...
3 years, 10 months ago (2017-02-22 11:27:40 UTC) #10
tzik
looks good https://codereview.chromium.org/2712613002/diff/20001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc File chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc (right): https://codereview.chromium.org/2712613002/diff/20001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc#newcode425 chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc:425: base::WeakPtr<file_manager::EventRouter> event_router) { |event_router| is not used?
3 years, 10 months ago (2017-02-23 03:57:18 UTC) #11
Shuhei Takahashi
https://codereview.chromium.org/2712613002/diff/20001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc File chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc (right): https://codereview.chromium.org/2712613002/diff/20001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc#newcode425 chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc:425: base::WeakPtr<file_manager::EventRouter> event_router) { On 2017/02/23 03:57:18, tzik wrote: > ...
3 years, 10 months ago (2017-02-23 04:05:57 UTC) #12
tzik
lgtm
3 years, 10 months ago (2017-02-23 04:10:37 UTC) #13
mtomasz
lgtm, thanks for fixing! https://codereview.chromium.org/2712613002/diff/20001/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc File chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc (right): https://codereview.chromium.org/2712613002/diff/20001/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc#newcode78 chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc:78: void WatcherManager::AddWatcher( Can we add ...
3 years, 10 months ago (2017-02-23 05:10:05 UTC) #14
Shuhei Takahashi
https://codereview.chromium.org/2712613002/diff/20001/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc File chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc (right): https://codereview.chromium.org/2712613002/diff/20001/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc#newcode78 chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc:78: void WatcherManager::AddWatcher( On 2017/02/23 05:10:05, mtomasz wrote: > Can ...
3 years, 10 months ago (2017-02-23 06:16:03 UTC) #15
hidehiko
The direction looks good. Several relatively minor requests. https://codereview.chromium.org/2712613002/diff/60001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc File chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc (right): https://codereview.chromium.org/2712613002/diff/60001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc#newcode309 chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc:309: void ...
3 years, 10 months ago (2017-02-23 11:05:58 UTC) #20
Shuhei Takahashi
PTAL https://codereview.chromium.org/2712613002/diff/60001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc File chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc (right): https://codereview.chromium.org/2712613002/diff/60001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc#newcode309 chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc:309: void CallResponseCallbackOnUIThread( On 2017/02/23 11:05:58, hidehiko wrote: > ...
3 years, 10 months ago (2017-02-24 05:13:25 UTC) #21
hidehiko
LGTM! https://codereview.chromium.org/2712613002/diff/60001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc File chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc (right): https://codereview.chromium.org/2712613002/diff/60001/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc#newcode309 chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc:309: void CallResponseCallbackOnUIThread( On 2017/02/24 05:13:24, Shuhei Takahashi wrote: ...
3 years, 10 months ago (2017-02-24 05:51:56 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2712613002/80001
3 years, 10 months ago (2017-02-24 05:53:02 UTC) #29
commit-bot: I haz the power
3 years, 10 months ago (2017-02-24 05:58:59 UTC) #32
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/bf45258a17f7f528b652a6b033c6...

Powered by Google App Engine
This is Rietveld 408576698