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

Unified Diff: runtime/bin/eventhandler_win.cc

Issue 19263003: Add FileSystemWatcher class to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix android socket. Created 7 years, 3 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.h ('k') | runtime/bin/file_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_win.cc
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 872a815ebebe81a74210140a4df8ab3f5d84ede8..170c493b90d1f95e12b99c2a2837e577c1f4a0da 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -343,6 +343,49 @@ void FileHandle::DoClose() {
}
+void DirectoryWatchHandle::EnsureInitialized(
+ EventHandlerImplementation* event_handler) {
+ ScopedLock lock(this);
+ event_handler_ = event_handler;
+ if (completion_port_ == INVALID_HANDLE_VALUE) {
+ CreateCompletionPort(event_handler_->completion_port());
+ }
+}
+
+
+bool DirectoryWatchHandle::IsClosed() {
+ return IsClosing() && pending_read_ == NULL;
+}
+
+
+void DirectoryWatchHandle::DoClose() {
+ Handle::DoClose();
+}
+
+bool DirectoryWatchHandle::IssueRead() {
+ ScopedLock lock(this);
+ OverlappedBuffer* buffer = OverlappedBuffer::AllocateReadBuffer(kBufferSize);
+
+ ASSERT(completion_port_ != INVALID_HANDLE_VALUE);
+
+ BOOL ok = ReadDirectoryChangesW(handle_,
+ buffer->GetBufferStart(),
+ buffer->GetBufferSize(),
+ recursive_,
+ events_,
+ NULL,
+ buffer->GetCleanOverlapped(),
+ NULL);
+ if (ok || GetLastError() == ERROR_IO_PENDING) {
+ // Completing asynchronously.
+ pending_read_ = buffer;
+ return true;
+ }
+ OverlappedBuffer::DisposeBuffer(buffer);
+ return false;
+}
+
+
void SocketHandle::HandleIssueError() {
int error = WSAGetLastError();
if (error == WSAECONNRESET) {
« no previous file with comments | « runtime/bin/eventhandler_win.h ('k') | runtime/bin/file_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698