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()); | |
133 set_cancelled(); | 132 set_cancelled(); |
134 | 133 |
135 if (handle_ != INVALID_HANDLE_VALUE) | 134 if (handle_ != INVALID_HANDLE_VALUE) |
136 DestroyWatch(); | 135 DestroyWatch(); |
137 | 136 |
138 if (!callback_.is_null()) { | 137 if (!callback_.is_null()) { |
139 MessageLoop::current()->RemoveDestructionObserver(this); | 138 MessageLoop::current()->RemoveDestructionObserver(this); |
140 callback_.Reset(); | 139 callback_.Reset(); |
141 } | 140 } |
142 } | 141 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 handle_ = INVALID_HANDLE_VALUE; | 292 handle_ = INVALID_HANDLE_VALUE; |
294 } | 293 } |
295 | 294 |
296 } // namespace | 295 } // namespace |
297 | 296 |
298 FilePathWatcher::FilePathWatcher() { | 297 FilePathWatcher::FilePathWatcher() { |
299 impl_ = new FilePathWatcherImpl(); | 298 impl_ = new FilePathWatcherImpl(); |
300 } | 299 } |
301 | 300 |
302 } // namespace base | 301 } // namespace base |
OLD | NEW |