Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/eventhandler.h" | 8 #include "bin/eventhandler.h" |
| 9 | 9 |
| 10 #include <winsock2.h> // NOLINT | 10 #include <winsock2.h> // NOLINT |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 if (ok || GetLastError() == ERROR_IO_PENDING) { | 410 if (ok || GetLastError() == ERROR_IO_PENDING) { |
| 411 // Completing asynchronously. | 411 // Completing asynchronously. |
| 412 pending_read_ = buffer; | 412 pending_read_ = buffer; |
| 413 return true; | 413 return true; |
| 414 } | 414 } |
| 415 OverlappedBuffer::DisposeBuffer(buffer); | 415 OverlappedBuffer::DisposeBuffer(buffer); |
| 416 return false; | 416 return false; |
| 417 } | 417 } |
| 418 | 418 |
| 419 | 419 |
| 420 void DirectoryWatchHandle::Stop() { | |
| 421 ScopedLock lock(this); | |
| 422 // Stop the outstanding read, so we can close the handle. | |
| 423 | |
| 424 if (pending_read_ != NULL) { | |
| 425 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
| |
| 426 // Don't dispose of the buffer, as it will still complete (with length 0). | |
| 427 pending_read_ = NULL; | |
| 428 } | |
| 429 | |
| 430 CloseHandle(handle()); | |
| 431 handle_ = (INVALID_HANDLE_VALUE); | |
| 432 } | |
| 433 | |
| 434 | |
| 420 void SocketHandle::HandleIssueError() { | 435 void SocketHandle::HandleIssueError() { |
| 421 int error = WSAGetLastError(); | 436 int error = WSAGetLastError(); |
| 422 if (error == WSAECONNRESET) { | 437 if (error == WSAECONNRESET) { |
| 423 HandleClosed(this); | 438 HandleClosed(this); |
| 424 } else { | 439 } else { |
| 425 HandleError(this); | 440 HandleError(this); |
| 426 } | 441 } |
| 427 WSASetLastError(error); | 442 WSASetLastError(error); |
| 428 } | 443 } |
| 429 | 444 |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1348 | 1363 |
| 1349 | 1364 |
| 1350 void EventHandlerImplementation::Shutdown() { | 1365 void EventHandlerImplementation::Shutdown() { |
| 1351 SendData(kShutdownId, 0, 0); | 1366 SendData(kShutdownId, 0, 0); |
| 1352 } | 1367 } |
| 1353 | 1368 |
| 1354 } // namespace bin | 1369 } // namespace bin |
| 1355 } // namespace dart | 1370 } // namespace dart |
| 1356 | 1371 |
| 1357 #endif // defined(TARGET_OS_WINDOWS) | 1372 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |