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 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "base/message_loop_proxy.h" | 16 #include "base/message_loop_proxy.h" |
17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
18 | 18 |
| 19 // On some platforms these are not defined. |
| 20 #if !defined(EV_RECEIPT) |
| 21 #define EV_RECEIPT 0 |
| 22 #endif |
| 23 #if !defined(O_EVTONLY) |
| 24 #define O_EVTONLY O_RDONLY |
| 25 #endif |
| 26 |
19 namespace base { | 27 namespace base { |
20 namespace files { | 28 namespace files { |
21 | 29 |
22 namespace { | 30 namespace { |
23 | 31 |
24 // Mac-specific file watcher implementation based on kqueue. | 32 // Mac-specific file watcher implementation based on kqueue. |
25 // Originally it was based on FSEvents so that the semantics were equivalent | 33 // Originally it was based on FSEvents so that the semantics were equivalent |
26 // on Linux, OSX and Windows where it was able to detect: | 34 // on Linux, OSX and Windows where it was able to detect: |
27 // - file creation/deletion/modification in a watched directory | 35 // - file creation/deletion/modification in a watched directory |
28 // - file creation/deletion/modification for a watched file | 36 // - file creation/deletion/modification for a watched file |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } | 493 } |
486 | 494 |
487 } // namespace | 495 } // namespace |
488 | 496 |
489 FilePathWatcher::FilePathWatcher() { | 497 FilePathWatcher::FilePathWatcher() { |
490 impl_ = new FilePathWatcherImpl(); | 498 impl_ = new FilePathWatcherImpl(); |
491 } | 499 } |
492 | 500 |
493 } // namespace files | 501 } // namespace files |
494 } // namespace base | 502 } // namespace base |
OLD | NEW |