Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1425)

Unified Diff: runtime/bin/file_system_watcher_android.cc

Issue 48493003: Make FileSystemWatcher work on MIPS and make watching on android the same as linux. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/file_system_watcher_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_system_watcher_android.cc
diff --git a/runtime/bin/file_system_watcher_android.cc b/runtime/bin/file_system_watcher_android.cc
index 333bc86c8e9c08e136f9487220db589e1156aa47..5971ed0ad8cd63cd537fc0d0262c34843d9c1c97 100644
--- a/runtime/bin/file_system_watcher_android.cc
+++ b/runtime/bin/file_system_watcher_android.cc
@@ -25,10 +25,14 @@ intptr_t FileSystemWatcher::WatchPath(const char* path,
int events,
bool recursive) {
int fd = TEMP_FAILURE_RETRY(inotify_init());
Søren Gjesse 2013/10/30 14:05:51 Please add a comment on why this fd is blocking.
Anders Johnsen 2013/10/30 14:17:22 Done.
- if (fd < 0 || !FDUtils::SetNonBlocking(fd) || !FDUtils::SetCloseOnExec(fd)) {
+ if (fd < 0 || !FDUtils::SetCloseOnExec(fd)) {
return -1;
}
- int list_events = 0;
+ // Some systems dosn't support setting this as non-blocking. Since watching
+ // internals are kept away from the user, we know it's possible to continue,
+ // even if setting non-blocking fails.
+ FDUtils::SetNonBlocking(fd);
+ int list_events = IN_DELETE_SELF | IN_MOVE_SELF;
if (events & kCreate) list_events |= IN_CREATE;
if (events & kModifyContent) list_events |= IN_MODIFY | IN_ATTRIB;
if (events & kDelete) list_events |= IN_DELETE;
@@ -69,11 +73,13 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id) {
reinterpret_cast<struct inotify_event*>(buffer + offset);
Dart_Handle event = Dart_NewList(4);
int mask = 0;
- if (e->mask & IN_MODIFY) mask |= kModifyContent;
+ if (e->mask & IN_CLOSE_WRITE) mask |= kModifyContent;
if (e->mask & IN_ATTRIB) mask |= kModefyAttribute;
if (e->mask & IN_CREATE) mask |= kCreate;
if (e->mask & IN_MOVE) mask |= kMove;
if (e->mask & IN_DELETE) mask |= kDelete;
+ if (e->mask & (IN_DELETE_SELF | IN_MOVE_SELF)) mask |= kDeleteSelf;
+ if (e->mask & IN_ISDIR) mask |= kIsDir;
Dart_ListSetAt(event, 0, Dart_NewInteger(mask));
Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie));
if (e->len > 0) {
« no previous file with comments | « no previous file | runtime/bin/file_system_watcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698