Chromium Code Reviews| Index: runtime/bin/eventhandler_win.cc |
| diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc |
| index 3fb27c7ff5b94bdc87510d145818eeff0d7415d9..2829820a457c47b4922ad75cf57e12fbc5c8ba13 100644 |
| --- a/runtime/bin/eventhandler_win.cc |
| +++ b/runtime/bin/eventhandler_win.cc |
| @@ -176,17 +176,19 @@ void Handle::Close() { |
| if (!IsClosing()) { |
| // Close the socket and set the closing state. This close method can be |
| // called again if this socket has pending IO operations in flight. |
| - ASSERT(handle_ != INVALID_HANDLE_VALUE); |
| MarkClosing(); |
| // Perform handle type specific closing. |
| DoClose(); |
| + ASSERT(IsHandleClosed()); |
|
kasperl
2014/06/04 11:52:01
Move the assert out of the !IsClosing check?
Anders Johnsen
2014/06/04 11:53:17
Done.
|
| } |
| } |
| void Handle::DoClose() { |
| - CloseHandle(handle_); |
| - handle_ = INVALID_HANDLE_VALUE; |
| + if (!IsHandleClosed()) { |
| + CloseHandle(handle_); |
| + handle_ = INVALID_HANDLE_VALUE; |
| + } |
| } |
| @@ -424,11 +426,9 @@ void DirectoryWatchHandle::Stop() { |
| if (pending_read_ != NULL) { |
| CancelIoEx(handle(), pending_read_->GetCleanOverlapped()); |
| // Don't dispose of the buffer, as it will still complete (with length 0). |
| - pending_read_ = NULL; |
| } |
| - CloseHandle(handle()); |
| - handle_ = (INVALID_HANDLE_VALUE); |
| + DoClose(); |
| } |