| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This module provides a way to monitor a file or directory for changes. | 5 // This module provides a way to monitor a file or directory for changes. |
| 6 | 6 |
| 7 #ifndef BASE_FILES_FILE_PATH_WATCHER_H_ | 7 #ifndef BASE_FILES_FILE_PATH_WATCHER_H_ |
| 8 #define BASE_FILES_FILE_PATH_WATCHER_H_ | 8 #define BASE_FILES_FILE_PATH_WATCHER_H_ |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // allow to shut down properly while the object is still alive. | 46 // allow to shut down properly while the object is still alive. |
| 47 // It can be called from any thread. | 47 // It can be called from any thread. |
| 48 virtual void Cancel() = 0; | 48 virtual void Cancel() = 0; |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 friend class base::RefCountedThreadSafe<PlatformDelegate>; | 51 friend class base::RefCountedThreadSafe<PlatformDelegate>; |
| 52 friend class FilePathWatcher; | 52 friend class FilePathWatcher; |
| 53 | 53 |
| 54 virtual ~PlatformDelegate(); | 54 virtual ~PlatformDelegate(); |
| 55 | 55 |
| 56 // Stop watching. This is only called on the thread of the appropriate | |
| 57 // message loop. Since it can also be called more than once, it should | |
| 58 // check |is_cancelled()| to avoid duplicate work. | |
| 59 virtual void CancelOnMessageLoopThread() = 0; | |
| 60 | |
| 61 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const { | 56 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const { |
| 62 return task_runner_; | 57 return task_runner_; |
| 63 } | 58 } |
| 64 | 59 |
| 65 void set_task_runner(scoped_refptr<base::SingleThreadTaskRunner> runner) { | 60 void set_task_runner(scoped_refptr<base::SingleThreadTaskRunner> runner) { |
| 66 task_runner_ = std::move(runner); | 61 task_runner_ = std::move(runner); |
| 67 } | 62 } |
| 68 | 63 |
| 69 // Must be called before the PlatformDelegate is deleted. | 64 // Must be called before the PlatformDelegate is deleted. |
| 70 void set_cancelled() { | 65 void set_cancelled() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 97 |
| 103 private: | 98 private: |
| 104 scoped_refptr<PlatformDelegate> impl_; | 99 scoped_refptr<PlatformDelegate> impl_; |
| 105 | 100 |
| 106 DISALLOW_COPY_AND_ASSIGN(FilePathWatcher); | 101 DISALLOW_COPY_AND_ASSIGN(FilePathWatcher); |
| 107 }; | 102 }; |
| 108 | 103 |
| 109 } // namespace base | 104 } // namespace base |
| 110 | 105 |
| 111 #endif // BASE_FILES_FILE_PATH_WATCHER_H_ | 106 #endif // BASE_FILES_FILE_PATH_WATCHER_H_ |
| OLD | NEW |