OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_BIN_FILE_SYSTEM_WATCHER_H_ | 5 #ifndef RUNTIME_BIN_FILE_SYSTEM_WATCHER_H_ |
6 #define RUNTIME_BIN_FILE_SYSTEM_WATCHER_H_ | 6 #define RUNTIME_BIN_FILE_SYSTEM_WATCHER_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
11 #include <sys/types.h> | 11 #include <sys/types.h> |
12 | 12 |
13 #include "bin/builtin.h" | 13 #include "bin/builtin.h" |
14 #include "bin/dartutils.h" | 14 #include "bin/dartutils.h" |
| 15 #include "bin/namespace.h" |
15 | 16 |
16 namespace dart { | 17 namespace dart { |
17 namespace bin { | 18 namespace bin { |
18 | 19 |
19 class FileSystemWatcher { | 20 class FileSystemWatcher { |
20 public: | 21 public: |
21 enum EventType { | 22 enum EventType { |
22 kCreate = 1 << 0, | 23 kCreate = 1 << 0, |
23 kModifyContent = 1 << 1, | 24 kModifyContent = 1 << 1, |
24 kDelete = 1 << 2, | 25 kDelete = 1 << 2, |
25 kMove = 1 << 3, | 26 kMove = 1 << 3, |
26 kModefyAttribute = 1 << 4, | 27 kModefyAttribute = 1 << 4, |
27 kDeleteSelf = 1 << 5, | 28 kDeleteSelf = 1 << 5, |
28 kIsDir = 1 << 6 | 29 kIsDir = 1 << 6 |
29 }; | 30 }; |
30 | 31 |
31 struct Event { | 32 struct Event { |
32 intptr_t path_id; | 33 intptr_t path_id; |
33 int event; | 34 int event; |
34 const char* filename; | 35 const char* filename; |
35 int link; | 36 int link; |
36 }; | 37 }; |
37 | 38 |
38 static bool IsSupported(); | 39 static bool IsSupported(); |
39 static intptr_t Init(); | 40 static intptr_t Init(); |
40 static void Close(intptr_t id); | 41 static void Close(intptr_t id); |
41 static intptr_t WatchPath(intptr_t id, | 42 static intptr_t WatchPath(intptr_t id, |
| 43 Namespace* namespc, |
42 const char* path, | 44 const char* path, |
43 int events, | 45 int events, |
44 bool recursive); | 46 bool recursive); |
45 static void UnwatchPath(intptr_t id, intptr_t path_id); | 47 static void UnwatchPath(intptr_t id, intptr_t path_id); |
46 static intptr_t GetSocketId(intptr_t id, intptr_t path_id); | 48 static intptr_t GetSocketId(intptr_t id, intptr_t path_id); |
47 static Dart_Handle ReadEvents(intptr_t id, intptr_t path_id); | 49 static Dart_Handle ReadEvents(intptr_t id, intptr_t path_id); |
48 | 50 |
49 private: | 51 private: |
50 DISALLOW_COPY_AND_ASSIGN(FileSystemWatcher); | 52 DISALLOW_COPY_AND_ASSIGN(FileSystemWatcher); |
51 }; | 53 }; |
52 | 54 |
53 } // namespace bin | 55 } // namespace bin |
54 } // namespace dart | 56 } // namespace dart |
55 | 57 |
56 #endif // RUNTIME_BIN_FILE_SYSTEM_WATCHER_H_ | 58 #endif // RUNTIME_BIN_FILE_SYSTEM_WATCHER_H_ |
OLD | NEW |