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

Issue 2123053004: No destruction observer in file_path_watcher_linux.cc (Closed)

Created:
4 years, 5 months ago by fdoray
Modified:
4 years, 3 months ago
Reviewers:
Mark Mentovai
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

No destruction observer in file_path_watcher_linux.cc MessageLoop::current()->Add/RemoveDestructionObserver won't be supported in base/task_scheduler. This CL removes calls to these methods from file_path_watcher_linux.cc Before this CL, FilePathWatcherImpl registered itself to be notified when the MessageLoop on which the watch was initiated was destroyed. When that notification was received, it canceled the watch. With this CL, no cancelation happens when the MessageLoop is destroyed. Instead, a cancelation happens when the FilePathWatcherImpl is destroyed. What happens if the MessageLoop is destroyed before the FilePathWatcherImpl is destroyed?: If the parent FilePathWatcher is deleted on the MessageLoop thread: - ~FilePathWatcher calls FilePathWatcherImpl::Cancel() which synchronously calls FilePathWatcherImpl::CancelOnMessageLoopThreadOrInDestructor(). That cancels the watch. The FilePathWatcherImpl is destroyed when the FilePathWatcher releases its reference. If the parent FilePathWatcher is deleted on another thread: - ~FilePathWatcher calls FilePathWatcherImpl::Cancel() which posts a FilePathWatcherImpl::CancelOnMessageLoopThread() task to the MessageLoop's TaskRunner. Since the MessageLoop has been destroyed, the task is dropped. This causes the last reference to FilePathWatcherImpl to be released. ~FilePathWatcherImpl is called synchronously (and calls FilePathWatcher::CancelOnMessageLoopThreadOrInDestructor). Since the MessageLoop doesn't exist anymore, there is no thread-safety problem. BUG=616447 Committed: https://crrev.com/7532c960faf5f59ef7031e4488fce36b6e1c1cf0 Cr-Commit-Position: refs/heads/master@{#418349}

Patch Set 1 #

Patch Set 2 : self-review #

Patch Set 3 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -19 lines) Patch
M base/files/file_path_watcher_linux.cc View 1 2 7 chunks +18 lines, -19 lines 0 comments Download

Messages

Total messages: 16 (11 generated)
fdoray
PTAL
4 years, 3 months ago (2016-09-13 19:29:47 UTC) #9
Mark Mentovai
LGTM
4 years, 3 months ago (2016-09-13 19:35:26 UTC) #10
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/2123053004/40001
4 years, 3 months ago (2016-09-13 19:36:52 UTC) #12
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 3 months ago (2016-09-13 20:14:54 UTC) #14
commit-bot: I haz the power
4 years, 3 months ago (2016-09-13 20:18:20 UTC) #16
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/7532c960faf5f59ef7031e4488fce36b6e1c1cf0
Cr-Commit-Position: refs/heads/master@{#418349}

Powered by Google App Engine
This is Rietveld 408576698