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

Unified Diff: runtime/bin/file_patch.dart

Issue 169383003: Make event-handlers edge-triggered and move socket-state to Dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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/eventhandler_win.cc ('k') | 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_patch.dart
diff --git a/runtime/bin/file_patch.dart b/runtime/bin/file_patch.dart
index 4ded71913a1aacb1b26835a59008a024841445ad..30dda6e9f64e6b6c3dc91ff3086112587d040c8c 100644
--- a/runtime/bin/file_patch.dart
+++ b/runtime/bin/file_patch.dart
@@ -150,7 +150,8 @@ patch class _FileSystemWatcher {
}
static Stream _listenOnSocket(int socketId, int id, int pathId) {
- var socket = new _RawSocket(new _NativeSocket.watch(socketId));
+ var native = new _NativeSocket.watch(socketId);
+ var socket = new _RawSocket(native);
return socket.expand((event) {
var stops = [];
var events = [];
@@ -182,9 +183,12 @@ patch class _FileSystemWatcher {
add(event[4], new FileSystemDeleteEvent._(getPath(event), isDir));
}
}
- while (socket.available() > 0) {
+ int eventCount;
+ do {
+ eventCount = 0;
for (var event in _readEvents(id, pathId)) {
if (event == null) continue;
+ eventCount++;
int pathId = event[4];
bool isDir = getIsDir(event);
var path = getPath(event);
@@ -222,7 +226,10 @@ patch class _FileSystemWatcher {
stops.add([event[4], null]);
}
}
- }
+ } while (eventCount > 0);
+ // Be sure to clear this manually, as the sockets are not read through
+ // the _NativeSocket interface.
+ native.available = 0;
for (var map in pair.values) {
for (var event in map.values) {
rewriteMove(event, getIsDir(event));
« no previous file with comments | « runtime/bin/eventhandler_win.cc ('k') | runtime/bin/file_system_watcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698