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 <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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 FilePathWatcher::Delegate* delegate) { | 420 FilePathWatcher::Delegate* delegate) { |
421 DCHECK(MessageLoopForIO::current()); | 421 DCHECK(MessageLoopForIO::current()); |
422 DCHECK(target_.value().empty()); // Can only watch one path. | 422 DCHECK(target_.value().empty()); // Can only watch one path. |
423 DCHECK(delegate); | 423 DCHECK(delegate); |
424 DCHECK_EQ(kqueue_, -1); | 424 DCHECK_EQ(kqueue_, -1); |
425 | 425 |
426 delegate_ = delegate; | 426 delegate_ = delegate; |
427 target_ = path; | 427 target_ = path; |
428 | 428 |
429 MessageLoop::current()->AddDestructionObserver(this); | 429 MessageLoop::current()->AddDestructionObserver(this); |
430 io_message_loop_ = base::MessageLoopProxy::CreateForCurrentThread(); | 430 io_message_loop_ = base::MessageLoopProxy::current(); |
431 | 431 |
432 kqueue_ = kqueue(); | 432 kqueue_ = kqueue(); |
433 if (kqueue_ == -1) { | 433 if (kqueue_ == -1) { |
434 PLOG(ERROR) << "kqueue"; | 434 PLOG(ERROR) << "kqueue"; |
435 return false; | 435 return false; |
436 } | 436 } |
437 | 437 |
438 int last_entry = EventsForPath(target_, &events_); | 438 int last_entry = EventsForPath(target_, &events_); |
439 CHECK_NE(last_entry, 0); | 439 CHECK_NE(last_entry, 0); |
440 | 440 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 484 } |
485 | 485 |
486 } // namespace | 486 } // namespace |
487 | 487 |
488 FilePathWatcher::FilePathWatcher() { | 488 FilePathWatcher::FilePathWatcher() { |
489 impl_ = new FilePathWatcherImpl(); | 489 impl_ = new FilePathWatcherImpl(); |
490 } | 490 } |
491 | 491 |
492 } // namespace files | 492 } // namespace files |
493 } // namespace base | 493 } // namespace base |
OLD | NEW |