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

Unified Diff: base/files/file_path_watcher_linux.cc

Issue 7655028: Mirror Windows implementation of CancelOnMessageLoopThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_path_watcher_linux.cc
diff --git a/base/files/file_path_watcher_linux.cc b/base/files/file_path_watcher_linux.cc
index 0fb10e4590e448dadb90f23e5492e153efce0297..96350e95124de1d1e6a33be7256dc6031f6fc298 100644
--- a/base/files/file_path_watcher_linux.cc
+++ b/base/files/file_path_watcher_linux.cc
@@ -404,19 +404,21 @@ void FilePathWatcherImpl::Cancel() {
}
void FilePathWatcherImpl::CancelOnMessageLoopThread() {
- if (!is_cancelled()) {
+ if (!is_cancelled())
set_cancelled();
- MessageLoop::current()->RemoveDestructionObserver(this);
- for (WatchVector::iterator watch_entry(watches_.begin());
- watch_entry != watches_.end(); ++watch_entry) {
- if (watch_entry->watch_ != InotifyReader::kInvalidWatch)
- g_inotify_reader.Get().RemoveWatch(watch_entry->watch_, this);
- }
- watches_.clear();
+ if (delegate_) {
+ MessageLoop::current()->RemoveDestructionObserver(this);
delegate_ = NULL;
- target_.clear();
}
+
+ for (WatchVector::iterator watch_entry(watches_.begin());
+ watch_entry != watches_.end(); ++watch_entry) {
+ if (watch_entry->watch_ != InotifyReader::kInvalidWatch)
+ g_inotify_reader.Get().RemoveWatch(watch_entry->watch_, this);
+ }
+ watches_.clear();
+ target_.clear();
}
void FilePathWatcherImpl::WillDestroyCurrentMessageLoop() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698