| 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 "content/common/file_path_watcher/file_path_watcher.h" | 5 #include "content/common/file_path_watcher/file_path_watcher.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/event.h> | 8 #include <sys/event.h> |
| 9 #include <sys/param.h> | 9 #include <sys/param.h> |
| 10 | 10 |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 467 } |
| 468 | 468 |
| 469 void FilePathWatcherImpl::CancelOnMessageLoopThread() { | 469 void FilePathWatcherImpl::CancelOnMessageLoopThread() { |
| 470 DCHECK(MessageLoopForIO::current()); | 470 DCHECK(MessageLoopForIO::current()); |
| 471 if (!is_cancelled()) { | 471 if (!is_cancelled()) { |
| 472 set_cancelled(); | 472 set_cancelled(); |
| 473 kqueue_watcher_.StopWatchingFileDescriptor(); | 473 kqueue_watcher_.StopWatchingFileDescriptor(); |
| 474 CloseFileDescriptor(&kqueue_); | 474 CloseFileDescriptor(&kqueue_); |
| 475 std::for_each(events_.begin(), events_.end(), ReleaseEvent); | 475 std::for_each(events_.begin(), events_.end(), ReleaseEvent); |
| 476 events_.clear(); | 476 events_.clear(); |
| 477 io_message_loop_.release(); | 477 io_message_loop_ = NULL; |
| 478 MessageLoop::current()->RemoveDestructionObserver(this); | 478 MessageLoop::current()->RemoveDestructionObserver(this); |
| 479 delegate_ = NULL; | 479 delegate_ = NULL; |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace | 483 } // namespace |
| 484 | 484 |
| 485 FilePathWatcher::FilePathWatcher() { | 485 FilePathWatcher::FilePathWatcher() { |
| 486 impl_ = new FilePathWatcherImpl(); | 486 impl_ = new FilePathWatcherImpl(); |
| 487 } | 487 } |
| OLD | NEW |