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

Unified Diff: runtime/bin/file_system_watcher_linux.cc

Issue 39613002: Close file watcher when target is deleted. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't always emit delete, and fix docs. 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 | « runtime/bin/file_system_watcher.h ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_system_watcher_linux.cc
diff --git a/runtime/bin/file_system_watcher_linux.cc b/runtime/bin/file_system_watcher_linux.cc
index c629718f855884f952246aa3a7f7acfa8f7baf0f..da5dee1ec77b56592c766ca363cac64fa9fa17d9 100644
--- a/runtime/bin/file_system_watcher_linux.cc
+++ b/runtime/bin/file_system_watcher_linux.cc
@@ -24,7 +24,7 @@ intptr_t FileSystemWatcher::WatchPath(const char* path,
bool recursive) {
int fd = TEMP_FAILURE_RETRY(inotify_init1(IN_NONBLOCK | IN_CLOEXEC));
if (fd < 0) return -1;
- int list_events = 0;
+ int list_events = IN_DELETE_SELF;
if (events & kCreate) list_events |= IN_CREATE;
if (events & kModifyContent) list_events |= IN_MODIFY | IN_ATTRIB;
if (events & kDelete) list_events |= IN_DELETE;
@@ -56,7 +56,7 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id) {
if (bytes < 0) {
return DartUtils::NewDartOSError();
}
- const intptr_t kMaxCount = kBufferSize / kEventSize + 1;
+ const intptr_t kMaxCount = bytes / kEventSize;
Dart_Handle events = Dart_NewList(kMaxCount);
intptr_t offset = 0;
intptr_t i = 0;
@@ -70,6 +70,7 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id) {
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) mask |= kDeleteSelf;
Dart_ListSetAt(event, 0, Dart_NewInteger(mask));
Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie));
if (e->len > 0) {
« no previous file with comments | « runtime/bin/file_system_watcher.h ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698