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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 watches_.clear(); | 416 watches_.clear(); |
417 target_.clear(); | 417 target_.clear(); |
418 } | 418 } |
419 | 419 |
420 void FilePathWatcherImpl::WillDestroyCurrentMessageLoop() { | 420 void FilePathWatcherImpl::WillDestroyCurrentMessageLoop() { |
421 CancelOnMessageLoopThread(); | 421 CancelOnMessageLoopThread(); |
422 } | 422 } |
423 | 423 |
424 bool FilePathWatcherImpl::UpdateWatches() { | 424 bool FilePathWatcherImpl::UpdateWatches() { |
425 // Ensure this runs on the message_loop_ exclusively in order to avoid | 425 // Ensure this runs on the |message_loop_| exclusively in order to avoid |
426 // concurrency issues. | 426 // concurrency issues. |
427 DCHECK(message_loop()->BelongsToCurrentThread()); | 427 DCHECK(message_loop()->BelongsToCurrentThread()); |
428 | 428 |
429 // Walk the list of watches and update them as we go. | 429 // Walk the list of watches and update them as we go. |
430 FilePath path(FILE_PATH_LITERAL("/")); | 430 FilePath path(FILE_PATH_LITERAL("/")); |
431 bool path_valid = true; | 431 bool path_valid = true; |
432 for (WatchVector::iterator watch_entry(watches_.begin()); | 432 for (WatchVector::iterator watch_entry(watches_.begin()); |
433 watch_entry != watches_.end(); ++watch_entry) { | 433 watch_entry != watches_.end(); ++watch_entry) { |
434 InotifyReader::Watch old_watch = watch_entry->watch_; | 434 InotifyReader::Watch old_watch = watch_entry->watch_; |
435 if (path_valid) { | 435 if (path_valid) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } | 474 } |
475 | 475 |
476 } // namespace | 476 } // namespace |
477 | 477 |
478 FilePathWatcher::FilePathWatcher() { | 478 FilePathWatcher::FilePathWatcher() { |
479 impl_ = new FilePathWatcherImpl(); | 479 impl_ = new FilePathWatcherImpl(); |
480 } | 480 } |
481 | 481 |
482 } // namespace files | 482 } // namespace files |
483 } // namespace base | 483 } // namespace base |
OLD | NEW |