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

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

Issue 2372513005: Remove FilePathWatcher::PlatformDelegate::CancelOnMessageLoopThread(). (Closed)
Patch Set: self-review Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « base/files/file_path_watcher.h ('k') | base/files/file_path_watcher_fsevents.h » ('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" 11 #include "base/message_loop/message_loop.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 13
14 namespace base { 14 namespace base {
15 15
16 FilePathWatcher::~FilePathWatcher() { 16 FilePathWatcher::~FilePathWatcher() {
17 impl_->Cancel(); 17 impl_->Cancel();
18 } 18 }
19 19
20 // static 20 // static
21 void FilePathWatcher::CancelWatch(
22 const scoped_refptr<PlatformDelegate>& delegate) {
23 delegate->CancelOnMessageLoopThread();
24 }
25
26 // static
27 bool FilePathWatcher::RecursiveWatchAvailable() { 21 bool FilePathWatcher::RecursiveWatchAvailable() {
28 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) || \ 22 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) || \
29 defined(OS_LINUX) || defined(OS_ANDROID) 23 defined(OS_LINUX) || defined(OS_ANDROID)
30 return true; 24 return true;
31 #else 25 #else
32 // FSEvents isn't available on iOS. 26 // FSEvents isn't available on iOS.
33 return false; 27 return false;
34 #endif 28 #endif
35 } 29 }
36 30
37 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) { 31 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) {
38 } 32 }
39 33
40 FilePathWatcher::PlatformDelegate::~PlatformDelegate() { 34 FilePathWatcher::PlatformDelegate::~PlatformDelegate() {
41 DCHECK(is_cancelled()); 35 DCHECK(is_cancelled());
42 } 36 }
43 37
44 bool FilePathWatcher::Watch(const FilePath& path, 38 bool FilePathWatcher::Watch(const FilePath& path,
45 bool recursive, 39 bool recursive,
46 const Callback& callback) { 40 const Callback& callback) {
47 DCHECK(path.IsAbsolute()); 41 DCHECK(path.IsAbsolute());
48 return impl_->Watch(path, recursive, callback); 42 return impl_->Watch(path, recursive, callback);
49 } 43 }
50 44
51 } // namespace base 45 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher.h ('k') | base/files/file_path_watcher_fsevents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698