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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (!message_loop()->BelongsToCurrentThread()) { | 116 if (!message_loop()->BelongsToCurrentThread()) { |
117 message_loop()->PostTask(FROM_HERE, | 117 message_loop()->PostTask(FROM_HERE, |
118 Bind(&FilePathWatcher::CancelWatch, | 118 Bind(&FilePathWatcher::CancelWatch, |
119 make_scoped_refptr(this))); | 119 make_scoped_refptr(this))); |
120 } else { | 120 } else { |
121 CancelOnMessageLoopThread(); | 121 CancelOnMessageLoopThread(); |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 void FilePathWatcherImpl::CancelOnMessageLoopThread() { | 125 void FilePathWatcherImpl::CancelOnMessageLoopThread() { |
| 126 DCHECK(message_loop()->BelongsToCurrentThread()); |
126 set_cancelled(); | 127 set_cancelled(); |
127 | 128 |
128 if (handle_ != INVALID_HANDLE_VALUE) | 129 if (handle_ != INVALID_HANDLE_VALUE) |
129 DestroyWatch(); | 130 DestroyWatch(); |
130 | 131 |
131 if (!callback_.is_null()) { | 132 if (!callback_.is_null()) { |
132 MessageLoop::current()->RemoveDestructionObserver(this); | 133 MessageLoop::current()->RemoveDestructionObserver(this); |
133 callback_.Reset(); | 134 callback_.Reset(); |
134 } | 135 } |
135 } | 136 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 handle_ = INVALID_HANDLE_VALUE; | 284 handle_ = INVALID_HANDLE_VALUE; |
284 } | 285 } |
285 | 286 |
286 } // namespace | 287 } // namespace |
287 | 288 |
288 FilePathWatcher::FilePathWatcher() { | 289 FilePathWatcher::FilePathWatcher() { |
289 impl_ = new FilePathWatcherImpl(); | 290 impl_ = new FilePathWatcherImpl(); |
290 } | 291 } |
291 | 292 |
292 } // namespace base | 293 } // namespace base |
OLD | NEW |