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

Unified Diff: runtime/bin/eventhandler_win.cc

Issue 312743002: Use 'Directory.watch' on Windows in pkg/watcher, instead of pooling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes Created 6 years, 7 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
Index: runtime/bin/eventhandler_win.cc
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 3b12d940847b641f4714086de811f645bd2da436..3fb27c7ff5b94bdc87510d145818eeff0d7415d9 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -417,6 +417,21 @@ bool DirectoryWatchHandle::IssueRead() {
}
+void DirectoryWatchHandle::Stop() {
+ ScopedLock lock(this);
+ // Stop the outstanding read, so we can close the handle.
+
+ if (pending_read_ != NULL) {
+ CancelIoEx(handle(), pending_read_->GetCleanOverlapped());
Søren Gjesse 2014/06/04 10:04:52 Check that this returns ERROR_OPERATION_ABORTED? N
Anders Johnsen 2014/06/04 10:15:53 The thing is, even if it doesn't, we can't do anyt
+ // Don't dispose of the buffer, as it will still complete (with length 0).
+ pending_read_ = NULL;
+ }
+
+ CloseHandle(handle());
+ handle_ = (INVALID_HANDLE_VALUE);
+}
+
+
void SocketHandle::HandleIssueError() {
int error = WSAGetLastError();
if (error == WSAECONNRESET) {

Powered by Google App Engine
This is Rietveld 408576698