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

Side by Side Diff: runtime/bin/eventhandler_win.cc

Issue 177803002: Remove non-fatal prints from windows eventhandler. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 LeaveCriticalSection(&cs_); 153 LeaveCriticalSection(&cs_);
154 } 154 }
155 155
156 156
157 bool Handle::CreateCompletionPort(HANDLE completion_port) { 157 bool Handle::CreateCompletionPort(HANDLE completion_port) {
158 completion_port_ = CreateIoCompletionPort(handle_, 158 completion_port_ = CreateIoCompletionPort(handle_,
159 completion_port, 159 completion_port,
160 reinterpret_cast<ULONG_PTR>(this), 160 reinterpret_cast<ULONG_PTR>(this),
161 0); 161 0);
162 if (completion_port_ == NULL) { 162 if (completion_port_ == NULL) {
163 Log::PrintErr("Error CreateIoCompletionPort: %d\n", GetLastError());
164 return false; 163 return false;
165 } 164 }
166 return true; 165 return true;
167 } 166 }
168 167
169 168
170 void Handle::Close() { 169 void Handle::Close() {
171 ScopedLock lock(this); 170 ScopedLock lock(this);
172 if (!IsClosing()) { 171 if (!IsClosing()) {
173 // Close the socket and set the closing state. This close method can be 172 // Close the socket and set the closing state. This close method can be
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (GetFileType(handle_) == FILE_TYPE_CHAR) { 239 if (GetFileType(handle_) == FILE_TYPE_CHAR) {
241 buffer_size = kStdOverlappedBufferSize; 240 buffer_size = kStdOverlappedBufferSize;
242 } 241 }
243 DWORD bytes_read = 0; 242 DWORD bytes_read = 0;
244 BOOL ok = ReadFile(handle_, 243 BOOL ok = ReadFile(handle_,
245 pending_read_->GetBufferStart(), 244 pending_read_->GetBufferStart(),
246 buffer_size, 245 buffer_size,
247 &bytes_read, 246 &bytes_read,
248 NULL); 247 NULL);
249 if (!ok) { 248 if (!ok) {
250 if (GetLastError() != ERROR_BROKEN_PIPE) {
251 Log::PrintErr("ReadFile failed %d\n", GetLastError());
252 }
253 bytes_read = 0; 249 bytes_read = 0;
254 } 250 }
255 OVERLAPPED* overlapped = pending_read_->GetCleanOverlapped(); 251 OVERLAPPED* overlapped = pending_read_->GetCleanOverlapped();
256 ok = PostQueuedCompletionStatus(event_handler_->completion_port(), 252 ok = PostQueuedCompletionStatus(event_handler_->completion_port(),
257 bytes_read, 253 bytes_read,
258 reinterpret_cast<ULONG_PTR>(this), 254 reinterpret_cast<ULONG_PTR>(this),
259 overlapped); 255 overlapped);
260 if (!ok) { 256 if (!ok) {
261 FATAL("PostQueuedCompletionStatus failed"); 257 FATAL("PostQueuedCompletionStatus failed");
262 } 258 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 int status = WSAIoctl(socket(), 412 int status = WSAIoctl(socket(),
417 SIO_GET_EXTENSION_FUNCTION_POINTER, 413 SIO_GET_EXTENSION_FUNCTION_POINTER,
418 &guid_accept_ex, 414 &guid_accept_ex,
419 sizeof(guid_accept_ex), 415 sizeof(guid_accept_ex),
420 &AcceptEx_, 416 &AcceptEx_,
421 sizeof(AcceptEx_), 417 sizeof(AcceptEx_),
422 &bytes, 418 &bytes,
423 NULL, 419 NULL,
424 NULL); 420 NULL);
425 if (status == SOCKET_ERROR) { 421 if (status == SOCKET_ERROR) {
426 Log::PrintErr("Error WSAIoctl failed: %d\n", WSAGetLastError());
427 return false; 422 return false;
428 } 423 }
429 return true; 424 return true;
430 } 425 }
431 426
432 427
433 bool ListenSocket::IssueAccept() { 428 bool ListenSocket::IssueAccept() {
434 ScopedLock lock(this); 429 ScopedLock lock(this);
435 // For AcceptEx there needs to be buffer storage for address 430 // For AcceptEx there needs to be buffer storage for address
436 // information for two addresses (local and remote address). The 431 // information for two addresses (local and remote address). The
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 client_socket->CreateCompletionPort(completion_port); 479 client_socket->CreateCompletionPort(completion_port);
485 if (accepted_head_ == NULL) { 480 if (accepted_head_ == NULL) {
486 accepted_head_ = client_socket; 481 accepted_head_ = client_socket;
487 accepted_tail_ = client_socket; 482 accepted_tail_ = client_socket;
488 } else { 483 } else {
489 ASSERT(accepted_tail_ != NULL); 484 ASSERT(accepted_tail_ != NULL);
490 accepted_tail_->set_next(client_socket); 485 accepted_tail_->set_next(client_socket);
491 accepted_tail_ = client_socket; 486 accepted_tail_ = client_socket;
492 } 487 }
493 } else { 488 } else {
494 Log::PrintErr("setsockopt failed: %d\n", WSAGetLastError());
495 closesocket(buffer->client()); 489 closesocket(buffer->client());
496 } 490 }
497 } else { 491 } else {
498 // Close the socket, as it's already accepted. 492 // Close the socket, as it's already accepted.
499 closesocket(buffer->client()); 493 closesocket(buffer->client());
500 } 494 }
501 495
502 pending_accept_count_--; 496 pending_accept_count_--;
503 OverlappedBuffer::DisposeBuffer(buffer); 497 OverlappedBuffer::DisposeBuffer(buffer);
504 } 498 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 void StdHandle::WriteSyncCompleteAsync() { 654 void StdHandle::WriteSyncCompleteAsync() {
661 ASSERT(pending_write_ != NULL); 655 ASSERT(pending_write_ != NULL);
662 656
663 DWORD bytes_written = -1; 657 DWORD bytes_written = -1;
664 BOOL ok = WriteFile(handle_, 658 BOOL ok = WriteFile(handle_,
665 pending_write_->GetBufferStart(), 659 pending_write_->GetBufferStart(),
666 pending_write_->GetBufferSize(), 660 pending_write_->GetBufferSize(),
667 &bytes_written, 661 &bytes_written,
668 NULL); 662 NULL);
669 if (!ok) { 663 if (!ok) {
670 if (GetLastError() != ERROR_BROKEN_PIPE) {
671 Log::PrintErr("WriteFile failed %d\n", GetLastError());
672 }
673 bytes_written = 0; 664 bytes_written = 0;
674 } 665 }
675 thread_wrote_ += bytes_written; 666 thread_wrote_ += bytes_written;
676 OVERLAPPED* overlapped = pending_write_->GetCleanOverlapped(); 667 OVERLAPPED* overlapped = pending_write_->GetCleanOverlapped();
677 ok = PostQueuedCompletionStatus(event_handler_->completion_port(), 668 ok = PostQueuedCompletionStatus(event_handler_->completion_port(),
678 bytes_written, 669 bytes_written,
679 reinterpret_cast<ULONG_PTR>(this), 670 reinterpret_cast<ULONG_PTR>(this),
680 overlapped); 671 overlapped);
681 if (!ok) { 672 if (!ok) {
682 FATAL("PostQueuedCompletionStatus failed"); 673 FATAL("PostQueuedCompletionStatus failed");
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 int status = WSAIoctl(socket(), 729 int status = WSAIoctl(socket(),
739 SIO_GET_EXTENSION_FUNCTION_POINTER, 730 SIO_GET_EXTENSION_FUNCTION_POINTER,
740 &guid_disconnect_ex, 731 &guid_disconnect_ex,
741 sizeof(guid_disconnect_ex), 732 sizeof(guid_disconnect_ex),
742 &DisconnectEx_, 733 &DisconnectEx_,
743 sizeof(DisconnectEx_), 734 sizeof(DisconnectEx_),
744 &bytes, 735 &bytes,
745 NULL, 736 NULL,
746 NULL); 737 NULL);
747 if (status == SOCKET_ERROR) { 738 if (status == SOCKET_ERROR) {
748 Log::PrintErr("Error WSAIoctl failed: %d\n", WSAGetLastError());
749 return false; 739 return false;
750 } 740 }
751 return true; 741 return true;
752 } 742 }
753 743
754 744
755 void ClientSocket::Shutdown(int how) { 745 void ClientSocket::Shutdown(int how) {
756 int rc = shutdown(socket(), how); 746 int rc = shutdown(socket(), how);
757 if (how == SD_RECEIVE) MarkClosedRead(); 747 if (how == SD_RECEIVE) MarkClosedRead();
758 if (how == SD_SEND) MarkClosedWrite(); 748 if (how == SD_SEND) MarkClosedWrite();
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 1289
1300 1290
1301 void EventHandlerImplementation::Shutdown() { 1291 void EventHandlerImplementation::Shutdown() {
1302 Notify(kShutdownId, 0, 0); 1292 Notify(kShutdownId, 0, 0);
1303 } 1293 }
1304 1294
1305 } // namespace bin 1295 } // namespace bin
1306 } // namespace dart 1296 } // namespace dart
1307 1297
1308 #endif // defined(TARGET_OS_WINDOWS) 1298 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698