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 #include "base/files/file_path_watcher.h" | 5 #include "base/files/file_path_watcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (!message_loop()->BelongsToCurrentThread()) { | 122 if (!message_loop()->BelongsToCurrentThread()) { |
123 message_loop()->PostTask(FROM_HERE, | 123 message_loop()->PostTask(FROM_HERE, |
124 Bind(&FilePathWatcher::CancelWatch, | 124 Bind(&FilePathWatcher::CancelWatch, |
125 make_scoped_refptr(this))); | 125 make_scoped_refptr(this))); |
126 } else { | 126 } else { |
127 CancelOnMessageLoopThread(); | 127 CancelOnMessageLoopThread(); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 void FilePathWatcherImpl::CancelOnMessageLoopThread() { | 131 void FilePathWatcherImpl::CancelOnMessageLoopThread() { |
| 132 DCHECK(message_loop()->BelongsToCurrentThread()); |
132 set_cancelled(); | 133 set_cancelled(); |
133 | 134 |
134 if (handle_ != INVALID_HANDLE_VALUE) | 135 if (handle_ != INVALID_HANDLE_VALUE) |
135 DestroyWatch(); | 136 DestroyWatch(); |
136 | 137 |
137 if (!callback_.is_null()) { | 138 if (!callback_.is_null()) { |
138 MessageLoop::current()->RemoveDestructionObserver(this); | 139 MessageLoop::current()->RemoveDestructionObserver(this); |
139 callback_.Reset(); | 140 callback_.Reset(); |
140 } | 141 } |
141 } | 142 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 handle_ = INVALID_HANDLE_VALUE; | 293 handle_ = INVALID_HANDLE_VALUE; |
293 } | 294 } |
294 | 295 |
295 } // namespace | 296 } // namespace |
296 | 297 |
297 FilePathWatcher::FilePathWatcher() { | 298 FilePathWatcher::FilePathWatcher() { |
298 impl_ = new FilePathWatcherImpl(); | 299 impl_ = new FilePathWatcherImpl(); |
299 } | 300 } |
300 | 301 |
301 } // namespace base | 302 } // namespace base |
OLD | NEW |