| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <errno.h> | 7 #include <errno.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <sys/inotify.h> | 9 #include <sys/inotify.h> |
| 10 #include <sys/ioctl.h> | 10 #include <sys/ioctl.h> |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 bool recursive, | 363 bool recursive, |
| 364 const FilePathWatcher::Callback& callback) { | 364 const FilePathWatcher::Callback& callback) { |
| 365 DCHECK(target_.empty()); | 365 DCHECK(target_.empty()); |
| 366 DCHECK(MessageLoopForIO::current()); | 366 DCHECK(MessageLoopForIO::current()); |
| 367 if (recursive) { | 367 if (recursive) { |
| 368 // Recursive watch is not supported on this platform. | 368 // Recursive watch is not supported on this platform. |
| 369 NOTIMPLEMENTED(); | 369 NOTIMPLEMENTED(); |
| 370 return false; | 370 return false; |
| 371 } | 371 } |
| 372 | 372 |
| 373 set_message_loop(base::MessageLoopProxy::current()); | 373 set_message_loop(base::MessageLoopProxy::current().get()); |
| 374 callback_ = callback; | 374 callback_ = callback; |
| 375 target_ = path; | 375 target_ = path; |
| 376 MessageLoop::current()->AddDestructionObserver(this); | 376 MessageLoop::current()->AddDestructionObserver(this); |
| 377 | 377 |
| 378 std::vector<FilePath::StringType> comps; | 378 std::vector<FilePath::StringType> comps; |
| 379 target_.GetComponents(&comps); | 379 target_.GetComponents(&comps); |
| 380 DCHECK(!comps.empty()); | 380 DCHECK(!comps.empty()); |
| 381 std::vector<FilePath::StringType>::const_iterator comp = comps.begin(); | 381 std::vector<FilePath::StringType>::const_iterator comp = comps.begin(); |
| 382 for (++comp; comp != comps.end(); ++comp) | 382 for (++comp; comp != comps.end(); ++comp) |
| 383 watches_.push_back(WatchEntry(InotifyReader::kInvalidWatch, *comp)); | 383 watches_.push_back(WatchEntry(InotifyReader::kInvalidWatch, *comp)); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 return true; | 478 return true; |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace | 481 } // namespace |
| 482 | 482 |
| 483 FilePathWatcher::FilePathWatcher() { | 483 FilePathWatcher::FilePathWatcher() { |
| 484 impl_ = new FilePathWatcherImpl(); | 484 impl_ = new FilePathWatcherImpl(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace base | 487 } // namespace base |
| OLD | NEW |