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

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

Issue 9309124: Fix Windows build (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "bin/eventhandler.h" 5 #include "bin/eventhandler.h"
6 6
7 #include <process.h> 7 #include <process.h>
8 #include <winsock2.h> 8 #include <winsock2.h>
9 #include <ws2tcpip.h> 9 #include <ws2tcpip.h>
10 #include <mswsock.h> 10 #include <mswsock.h>
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 !handle->IsClosedRead()) { 649 !handle->IsClosedRead()) {
650 handle->IssueRead(); 650 handle->IssueRead();
651 } 651 }
652 } 652 }
653 653
654 // If can send callback had been requested and there is no pending 654 // If can send callback had been requested and there is no pending
655 // send post it immediately. 655 // send post it immediately.
656 if ((msg->data & (1 << kOutEvent)) != 0) { 656 if ((msg->data & (1 << kOutEvent)) != 0) {
657 if (!handle->HasPendingWrite()) { 657 if (!handle->HasPendingWrite()) {
658 int event_mask = (1 << kOutEvent); 658 int event_mask = (1 << kOutEvent);
659 DartUtils::PostInteger(port, event_mask); 659 DartUtils::PostInt32(port, event_mask);
660 } 660 }
661 } 661 }
662 662
663 if (handle->is_client_socket()) { 663 if (handle->is_client_socket()) {
664 ClientSocket* client_socket = reinterpret_cast<ClientSocket*>(handle); 664 ClientSocket* client_socket = reinterpret_cast<ClientSocket*>(handle);
665 if ((msg->data & (1 << kShutdownReadCommand)) != 0) { 665 if ((msg->data & (1 << kShutdownReadCommand)) != 0) {
666 client_socket->Shutdown(SD_RECEIVE); 666 client_socket->Shutdown(SD_RECEIVE);
667 } 667 }
668 668
669 if ((msg->data & (1 << kShutdownWriteCommand)) != 0) { 669 if ((msg->data & (1 << kShutdownWriteCommand)) != 0) {
(...skipping 15 matching lines...) Expand all
685 } 685 }
686 686
687 687
688 void EventHandlerImplementation::HandleAccept(ListenSocket* listen_socket, 688 void EventHandlerImplementation::HandleAccept(ListenSocket* listen_socket,
689 IOBuffer* buffer) { 689 IOBuffer* buffer) {
690 listen_socket->AcceptComplete(buffer, completion_port_); 690 listen_socket->AcceptComplete(buffer, completion_port_);
691 691
692 if (!listen_socket->IsClosing()) { 692 if (!listen_socket->IsClosing()) {
693 int event_mask = 1 << kInEvent; 693 int event_mask = 1 << kInEvent;
694 if ((listen_socket->mask() & event_mask) != 0) { 694 if ((listen_socket->mask() & event_mask) != 0) {
695 DartUtils::PostInteger(port, event_mask); 695 DartUtils::PostInt32(port, event_mask);
696 } 696 }
697 } 697 }
698 698
699 if (listen_socket->IsClosed()) { 699 if (listen_socket->IsClosed()) {
700 delete listen_socket; 700 delete listen_socket;
701 } 701 }
702 } 702 }
703 703
704 704
705 void EventHandlerImplementation::HandleClosed(Handle* handle) { 705 void EventHandlerImplementation::HandleClosed(Handle* handle) {
706 if (!handle->IsClosing()) { 706 if (!handle->IsClosing()) {
707 int event_mask = 1 << kCloseEvent; 707 int event_mask = 1 << kCloseEvent;
708 DartUtils::PostInteger(port, event_mask); 708 DartUtils::PostInt32(port, event_mask);
709 } 709 }
710 } 710 }
711 711
712 712
713 void EventHandlerImplementation::HandleRead(Handle* handle, 713 void EventHandlerImplementation::HandleRead(Handle* handle,
714 int bytes, 714 int bytes,
715 IOBuffer* buffer) { 715 IOBuffer* buffer) {
716 buffer->set_data_length(bytes); 716 buffer->set_data_length(bytes);
717 handle->ReadComplete(buffer); 717 handle->ReadComplete(buffer);
718 if (bytes > 0) { 718 if (bytes > 0) {
719 if (!handle->IsClosing()) { 719 if (!handle->IsClosing()) {
720 int event_mask = 1 << kInEvent; 720 int event_mask = 1 << kInEvent;
721 if ((handle->mask() & event_mask) != 0) { 721 if ((handle->mask() & event_mask) != 0) {
722 DartUtils::PostInteger(port, event_mask); 722 DartUtils::PostInt32(port, event_mask);
723 } 723 }
724 } 724 }
725 } else { 725 } else {
726 ASSERT(bytes == 0); 726 ASSERT(bytes == 0);
727 handle->MarkClosedRead(); 727 handle->MarkClosedRead();
728 HandleClosed(handle); 728 HandleClosed(handle);
729 } 729 }
730 730
731 if (handle->IsClosed()) { 731 if (handle->IsClosed()) {
732 delete handle; 732 delete handle;
733 } 733 }
734 } 734 }
735 735
736 736
737 void EventHandlerImplementation::HandleWrite(Handle* handle, 737 void EventHandlerImplementation::HandleWrite(Handle* handle,
738 int bytes, 738 int bytes,
739 IOBuffer* buffer) { 739 IOBuffer* buffer) {
740 handle->WriteComplete(buffer); 740 handle->WriteComplete(buffer);
741 741
742 if (bytes > 0) { 742 if (bytes > 0) {
743 if (!handle->IsClosing()) { 743 if (!handle->IsClosing()) {
744 int event_mask = 1 << kOutEvent; 744 int event_mask = 1 << kOutEvent;
745 if ((handle->mask() & event_mask) != 0) { 745 if ((handle->mask() & event_mask) != 0) {
746 DartUtils::PostInteger(port, event_mask); 746 DartUtils::PostInt32(port, event_mask);
747 } 747 }
748 } 748 }
749 } else { 749 } else {
750 ASSERT(bytes == 0); 750 ASSERT(bytes == 0);
751 HandleClosed(handle); 751 HandleClosed(handle);
752 } 752 }
753 753
754 if (handle->IsClosed()) { 754 if (handle->IsClosed()) {
755 delete handle; 755 delete handle;
756 } 756 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 reinterpret_cast<uword>(this)); 886 reinterpret_cast<uword>(this));
887 if (result != 0) { 887 if (result != 0) {
888 FATAL1("Failed to start event handler thread %d", result); 888 FATAL1("Failed to start event handler thread %d", result);
889 } 889 }
890 890
891 // Initialize Winsock32 891 // Initialize Winsock32
892 if (!Socket::Initialize()) { 892 if (!Socket::Initialize()) {
893 FATAL("Failed to initialized Windows sockets"); 893 FATAL("Failed to initialized Windows sockets");
894 } 894 }
895 } 895 }
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