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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
683 | 683 |
684 if (net_log_.IsLogging()) { | 684 if (net_log_.GetCaptureMode().enabled()) { |
685 net_log_.AddEvent( | 685 net_log_.AddEvent( |
686 NetLog::TYPE_UDP_BYTES_RECEIVED, | 686 NetLog::TYPE_UDP_BYTES_RECEIVED, |
687 CreateNetLogUDPDataTranferCallback(result, bytes, address)); | 687 CreateNetLogUDPDataTranferCallback(result, bytes, address)); |
688 } | 688 } |
689 | 689 |
690 NetworkActivityMonitor::GetInstance()->IncrementBytesReceived(result); | 690 NetworkActivityMonitor::GetInstance()->IncrementBytesReceived(result); |
691 } | 691 } |
692 | 692 |
693 void UDPSocketWin::LogWrite(int result, | 693 void UDPSocketWin::LogWrite(int result, |
694 const char* bytes, | 694 const char* bytes, |
695 const IPEndPoint* address) const { | 695 const IPEndPoint* address) const { |
696 if (result < 0) { | 696 if (result < 0) { |
697 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_UDP_SEND_ERROR, result); | 697 net_log_.AddEventWithNetErrorCode(NetLog::TYPE_UDP_SEND_ERROR, result); |
698 return; | 698 return; |
699 } | 699 } |
700 | 700 |
701 if (net_log_.IsLogging()) { | 701 if (net_log_.GetCaptureMode().enabled()) { |
702 net_log_.AddEvent( | 702 net_log_.AddEvent( |
703 NetLog::TYPE_UDP_BYTES_SENT, | 703 NetLog::TYPE_UDP_BYTES_SENT, |
704 CreateNetLogUDPDataTranferCallback(result, bytes, address)); | 704 CreateNetLogUDPDataTranferCallback(result, bytes, address)); |
705 } | 705 } |
706 | 706 |
707 NetworkActivityMonitor::GetInstance()->IncrementBytesSent(result); | 707 NetworkActivityMonitor::GetInstance()->IncrementBytesSent(result); |
708 } | 708 } |
709 | 709 |
710 int UDPSocketWin::InternalRecvFromOverlapped(IOBuffer* buf, | 710 int UDPSocketWin::InternalRecvFromOverlapped(IOBuffer* buf, |
711 int buf_len, | 711 int buf_len, |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |