| 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 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include "bin/file_system_watcher.h" | 8 #include "bin/file_system_watcher.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 bool has_run_loop() const { return run_loop_ != NULL; } | 258 bool has_run_loop() const { return run_loop_ != NULL; } |
| 259 | 259 |
| 260 static void TimerCallback(CFRunLoopTimerRef timer, void* context) { | 260 static void TimerCallback(CFRunLoopTimerRef timer, void* context) { |
| 261 // Dummy callback to keep RunLoop alive. | 261 // Dummy callback to keep RunLoop alive. |
| 262 } | 262 } |
| 263 | 263 |
| 264 Node* AddPath(const char* path, int events, bool recursive) { | 264 Node* AddPath(const char* path, int events, bool recursive) { |
| 265 int fds[2]; | 265 int fds[2]; |
| 266 VOID_NO_RETRY_EXPECTED(pipe(fds)); | 266 VOID_NO_RETRY_EXPECTED(pipe(fds)); |
| 267 Socket::SetNonBlocking(fds[0]); | 267 FDUtils::SetNonBlocking(fds[0]); |
| 268 Socket::SetBlocking(fds[1]); | 268 FDUtils::SetBlocking(fds[1]); |
| 269 | 269 |
| 270 char base_path[PATH_MAX]; | 270 char base_path[PATH_MAX]; |
| 271 realpath(path, base_path); | 271 realpath(path, base_path); |
| 272 | 272 |
| 273 return new Node(this, base_path, fds[0], fds[1], recursive); | 273 return new Node(this, base_path, fds[0], fds[1], recursive); |
| 274 } | 274 } |
| 275 | 275 |
| 276 private: | 276 private: |
| 277 static void Callback(ConstFSEventStreamRef ref, | 277 static void Callback(ConstFSEventStreamRef ref, |
| 278 void* client, | 278 void* client, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 Dart_ListSetAt(event, 4, Dart_NewInteger(path_id)); | 386 Dart_ListSetAt(event, 4, Dart_NewInteger(path_id)); |
| 387 Dart_ListSetAt(events, i, event); | 387 Dart_ListSetAt(events, i, event); |
| 388 } | 388 } |
| 389 return events; | 389 return events; |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace bin | 392 } // namespace bin |
| 393 } // namespace dart | 393 } // namespace dart |
| 394 | 394 |
| 395 #endif // defined(TARGET_OS_MACOS) | 395 #endif // defined(TARGET_OS_MACOS) |
| 396 | |
| 397 | |
| OLD | NEW |