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

Side by Side Diff: base/files/file_path_watcher.cc

Issue 2438913003: Require FilePathWatcher destructor to be called in sequence with Watch(). (Closed)
Patch Set: CR thestig #36 (fix comment) Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « base/files/file_path_watcher.h ('k') | base/files/file_path_watcher_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Cross platform methods for FilePathWatcher. See the various platform 5 // Cross platform methods for FilePathWatcher. See the various platform
6 // specific implementation files, too. 6 // specific implementation files, too.
7 7
8 #include "base/files/file_path_watcher.h" 8 #include "base/files/file_path_watcher.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h"
12 #include "build/build_config.h" 11 #include "build/build_config.h"
13 12
14 namespace base { 13 namespace base {
15 14
16 FilePathWatcher::~FilePathWatcher() { 15 FilePathWatcher::~FilePathWatcher() {
16 DCHECK(sequence_checker_.CalledOnValidSequence());
17 impl_->Cancel(); 17 impl_->Cancel();
18 } 18 }
19 19
20 // static 20 // static
21 bool FilePathWatcher::RecursiveWatchAvailable() { 21 bool FilePathWatcher::RecursiveWatchAvailable() {
22 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) || \ 22 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) || \
23 defined(OS_LINUX) || defined(OS_ANDROID) 23 defined(OS_LINUX) || defined(OS_ANDROID)
24 return true; 24 return true;
25 #else 25 #else
26 // FSEvents isn't available on iOS. 26 // FSEvents isn't available on iOS.
27 return false; 27 return false;
28 #endif 28 #endif
29 } 29 }
30 30
31 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) { 31 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) {
32 } 32 }
33 33
34 FilePathWatcher::PlatformDelegate::~PlatformDelegate() { 34 FilePathWatcher::PlatformDelegate::~PlatformDelegate() {
35 DCHECK(is_cancelled()); 35 DCHECK(is_cancelled());
36 } 36 }
37 37
38 bool FilePathWatcher::Watch(const FilePath& path, 38 bool FilePathWatcher::Watch(const FilePath& path,
39 bool recursive, 39 bool recursive,
40 const Callback& callback) { 40 const Callback& callback) {
41 DCHECK(sequence_checker_.CalledOnValidSequence());
41 DCHECK(path.IsAbsolute()); 42 DCHECK(path.IsAbsolute());
42 return impl_->Watch(path, recursive, callback); 43 return impl_->Watch(path, recursive, callback);
43 } 44 }
44 45
45 } // namespace base 46 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher.h ('k') | base/files/file_path_watcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698