| OLD | NEW |
| 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 // 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 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // A custom Task that always cleans up the PlatformDelegate, either when | 54 // A custom Task that always cleans up the PlatformDelegate, either when |
| 55 // executed or when deleted without having been executed at all, as can | 55 // executed or when deleted without having been executed at all, as can |
| 56 // happen during shutdown. | 56 // happen during shutdown. |
| 57 class CancelTask : public Task { | 57 class CancelTask : public Task { |
| 58 public: | 58 public: |
| 59 CancelTask(PlatformDelegate* delegate): delegate_(delegate) {} | 59 CancelTask(PlatformDelegate* delegate): delegate_(delegate) {} |
| 60 virtual ~CancelTask() { | 60 virtual ~CancelTask() { |
| 61 delegate_->CancelOnMessageLoopThread(); | 61 delegate_->CancelOnMessageLoopThread(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual void Run() { | 64 virtual void Run() OVERRIDE { |
| 65 delegate_->CancelOnMessageLoopThread(); | 65 delegate_->CancelOnMessageLoopThread(); |
| 66 } | 66 } |
| 67 private: | 67 private: |
| 68 scoped_refptr<PlatformDelegate> delegate_; | 68 scoped_refptr<PlatformDelegate> delegate_; |
| 69 | 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(CancelTask); | 70 DISALLOW_COPY_AND_ASSIGN(CancelTask); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 // Used internally to encapsulate different members on different platforms. | 73 // Used internally to encapsulate different members on different platforms. |
| 74 class PlatformDelegate : public base::RefCountedThreadSafe<PlatformDelegate> { | 74 class PlatformDelegate : public base::RefCountedThreadSafe<PlatformDelegate> { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 private: | 120 private: |
| 121 scoped_refptr<PlatformDelegate> impl_; | 121 scoped_refptr<PlatformDelegate> impl_; |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(FilePathWatcher); | 123 DISALLOW_COPY_AND_ASSIGN(FilePathWatcher); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 } // namespace files | 126 } // namespace files |
| 127 } // namespace base | 127 } // namespace base |
| 128 | 128 |
| 129 #endif // BASE_FILES_FILE_PATH_WATCHER_H_ | 129 #endif // BASE_FILES_FILE_PATH_WATCHER_H_ |
| OLD | NEW |