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

Side by Side Diff: net/udp/udp_socket_win.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to mojo::edk namespace in preparation for runtim flag Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/udp/udp_socket_win.h" 5 #include "net/udp/udp_socket_win.h"
6 6
7 #include <mstcpip.h> 7 #include <mstcpip.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 WSACloseEvent(read_overlapped_.hEvent); 126 WSACloseEvent(read_overlapped_.hEvent);
127 memset(&read_overlapped_, 0xaf, sizeof(read_overlapped_)); 127 memset(&read_overlapped_, 0xaf, sizeof(read_overlapped_));
128 WSACloseEvent(write_overlapped_.hEvent); 128 WSACloseEvent(write_overlapped_.hEvent);
129 memset(&write_overlapped_, 0xaf, sizeof(write_overlapped_)); 129 memset(&write_overlapped_, 0xaf, sizeof(write_overlapped_));
130 } 130 }
131 131
132 void UDPSocketWin::Core::WatchForRead() { 132 void UDPSocketWin::Core::WatchForRead() {
133 // We grab an extra reference because there is an IO operation in progress. 133 // We grab an extra reference because there is an IO operation in progress.
134 // Balanced in ReadDelegate::OnObjectSignaled(). 134 // Balanced in ReadDelegate::OnObjectSignaled().
135 AddRef(); 135 AddRef();
136 read_watcher_.StartWatching(read_overlapped_.hEvent, &reader_); 136 read_watcher_.StartWatching(read_overlapped_.hEvent, &reader_, false);
137 } 137 }
138 138
139 void UDPSocketWin::Core::WatchForWrite() { 139 void UDPSocketWin::Core::WatchForWrite() {
140 // We grab an extra reference because there is an IO operation in progress. 140 // We grab an extra reference because there is an IO operation in progress.
141 // Balanced in WriteDelegate::OnObjectSignaled(). 141 // Balanced in WriteDelegate::OnObjectSignaled().
142 AddRef(); 142 AddRef();
143 write_watcher_.StartWatching(write_overlapped_.hEvent, &writer_); 143 write_watcher_.StartWatching(write_overlapped_.hEvent, &writer_, false);
144 } 144 }
145 145
146 void UDPSocketWin::Core::ReadDelegate::OnObjectSignaled(HANDLE object) { 146 void UDPSocketWin::Core::ReadDelegate::OnObjectSignaled(HANDLE object) {
147 DCHECK_EQ(object, core_->read_overlapped_.hEvent); 147 DCHECK_EQ(object, core_->read_overlapped_.hEvent);
148 if (core_->socket_) 148 if (core_->socket_)
149 core_->socket_->DidCompleteRead(); 149 core_->socket_->DidCompleteRead();
150 150
151 core_->Release(); 151 core_->Release();
152 } 152 }
153 153
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 write_iobuffer_ = NULL; 662 write_iobuffer_ = NULL;
663 write_iobuffer_len_ = 0; 663 write_iobuffer_len_ = 0;
664 send_to_address_.reset(); 664 send_to_address_.reset();
665 DoWriteCallback(rv); 665 DoWriteCallback(rv);
666 } 666 }
667 667
668 void UDPSocketWin::WatchForReadWrite() { 668 void UDPSocketWin::WatchForReadWrite() {
669 if (read_write_watcher_.IsWatching()) 669 if (read_write_watcher_.IsWatching())
670 return; 670 return;
671 bool watched = 671 bool watched =
672 read_write_watcher_.StartWatching(read_write_event_.Get(), this); 672 read_write_watcher_.StartWatching(read_write_event_.Get(), this, false);
673 DCHECK(watched); 673 DCHECK(watched);
674 } 674 }
675 675
676 void UDPSocketWin::LogRead(int result, 676 void UDPSocketWin::LogRead(int result,
677 const char* bytes, 677 const char* bytes,
678 const IPEndPoint* address) const { 678 const IPEndPoint* address) const {
679 if (result < 0) { 679 if (result < 0) {
680 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_UDP_RECEIVE_ERROR, result); 680 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_UDP_RECEIVE_ERROR, result);
681 return; 681 return;
682 } 682 }
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 void UDPSocketWin::DetachFromThread() { 1162 void UDPSocketWin::DetachFromThread() {
1163 base::NonThreadSafe::DetachFromThread(); 1163 base::NonThreadSafe::DetachFromThread();
1164 } 1164 }
1165 1165
1166 void UDPSocketWin::UseNonBlockingIO() { 1166 void UDPSocketWin::UseNonBlockingIO() {
1167 DCHECK(!core_); 1167 DCHECK(!core_);
1168 use_non_blocking_io_ = true; 1168 use_non_blocking_io_ = true;
1169 } 1169 }
1170 1170
1171 } // namespace net 1171 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698