OLD | NEW |
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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 } | 693 } |
694 | 694 |
695 void UDPSocketWin::LogRead(int result, | 695 void UDPSocketWin::LogRead(int result, |
696 const char* bytes, | 696 const char* bytes, |
697 const IPEndPoint* address) const { | 697 const IPEndPoint* address) const { |
698 if (result < 0) { | 698 if (result < 0) { |
699 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_UDP_RECEIVE_ERROR, result); | 699 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_UDP_RECEIVE_ERROR, result); |
700 return; | 700 return; |
701 } | 701 } |
702 | 702 |
703 if (net_log_.IsLogging()) { | 703 if (net_log_.GetCaptureMode().enabled()) { |
704 net_log_.AddEvent( | 704 net_log_.AddEvent( |
705 NetLog::TYPE_UDP_BYTES_RECEIVED, | 705 NetLog::TYPE_UDP_BYTES_RECEIVED, |
706 CreateNetLogUDPDataTranferCallback(result, bytes, address)); | 706 CreateNetLogUDPDataTranferCallback(result, bytes, address)); |
707 } | 707 } |
708 | 708 |
709 NetworkActivityMonitor::GetInstance()->IncrementBytesReceived(result); | 709 NetworkActivityMonitor::GetInstance()->IncrementBytesReceived(result); |
710 } | 710 } |
711 | 711 |
712 void UDPSocketWin::LogWrite(int result, | 712 void UDPSocketWin::LogWrite(int result, |
713 const char* bytes, | 713 const char* bytes, |
714 const IPEndPoint* address) const { | 714 const IPEndPoint* address) const { |
715 if (result < 0) { | 715 if (result < 0) { |
716 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_UDP_SEND_ERROR, result); | 716 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_UDP_SEND_ERROR, result); |
717 return; | 717 return; |
718 } | 718 } |
719 | 719 |
720 if (net_log_.IsLogging()) { | 720 if (net_log_.GetCaptureMode().enabled()) { |
721 net_log_.AddEvent( | 721 net_log_.AddEvent( |
722 NetLog::TYPE_UDP_BYTES_SENT, | 722 NetLog::TYPE_UDP_BYTES_SENT, |
723 CreateNetLogUDPDataTranferCallback(result, bytes, address)); | 723 CreateNetLogUDPDataTranferCallback(result, bytes, address)); |
724 } | 724 } |
725 | 725 |
726 NetworkActivityMonitor::GetInstance()->IncrementBytesSent(result); | 726 NetworkActivityMonitor::GetInstance()->IncrementBytesSent(result); |
727 } | 727 } |
728 | 728 |
729 int UDPSocketWin::InternalRecvFromOverlapped(IOBuffer* buf, | 729 int UDPSocketWin::InternalRecvFromOverlapped(IOBuffer* buf, |
730 int buf_len, | 730 int buf_len, |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 void UDPSocketWin::DetachFromThread() { | 1181 void UDPSocketWin::DetachFromThread() { |
1182 base::NonThreadSafe::DetachFromThread(); | 1182 base::NonThreadSafe::DetachFromThread(); |
1183 } | 1183 } |
1184 | 1184 |
1185 void UDPSocketWin::UseNonBlockingIO() { | 1185 void UDPSocketWin::UseNonBlockingIO() { |
1186 DCHECK(!core_); | 1186 DCHECK(!core_); |
1187 use_non_blocking_io_ = true; | 1187 use_non_blocking_io_ = true; |
1188 } | 1188 } |
1189 | 1189 |
1190 } // namespace net | 1190 } // namespace net |
OLD | NEW |