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

Side by Side Diff: net/socket/tcp_client_socket_win.cc

Issue 7150018: Use GetVersion for Windows run-time version checks in preference to OperatingSystemVersionNumbers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 | « chrome_frame/test/dll_redirector_test.cc ('k') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/socket/tcp_client_socket_win.h" 5 #include "net/socket/tcp_client_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/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/memory_debug.h" 11 #include "base/memory/memory_debug.h"
12 #include "base/metrics/stats_counters.h" 12 #include "base/metrics/stats_counters.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/sys_info.h"
15 #include "base/win/object_watcher.h" 14 #include "base/win/object_watcher.h"
15 #include "base/win/windows_version.h"
16 #include "net/base/address_list_net_log_param.h" 16 #include "net/base/address_list_net_log_param.h"
17 #include "net/base/connection_type_histograms.h" 17 #include "net/base/connection_type_histograms.h"
18 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
19 #include "net/base/ip_endpoint.h" 19 #include "net/base/ip_endpoint.h"
20 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
21 #include "net/base/net_log.h" 21 #include "net/base/net_log.h"
22 #include "net/base/net_util.h" 22 #include "net/base/net_util.h"
23 #include "net/base/network_change_notifier.h" 23 #include "net/base/network_change_notifier.h"
24 #include "net/base/sys_addrinfo.h" 24 #include "net/base/sys_addrinfo.h"
25 #include "net/base/winsock_init.h" 25 #include "net/base/winsock_init.h"
(...skipping 23 matching lines...) Expand all
49 // Increase the socket buffer sizes from the default sizes for WinXP. In 49 // Increase the socket buffer sizes from the default sizes for WinXP. In
50 // performance testing, there is substantial benefit by increasing from 8KB 50 // performance testing, there is substantial benefit by increasing from 8KB
51 // to 64KB. 51 // to 64KB.
52 // See also: 52 // See also:
53 // http://support.microsoft.com/kb/823764/EN-US 53 // http://support.microsoft.com/kb/823764/EN-US
54 // On Vista, if we manually set these sizes, Vista turns off its receive 54 // On Vista, if we manually set these sizes, Vista turns off its receive
55 // window auto-tuning feature. 55 // window auto-tuning feature.
56 // http://blogs.msdn.com/wndp/archive/2006/05/05/Winhec-blog-tcpip-2.aspx 56 // http://blogs.msdn.com/wndp/archive/2006/05/05/Winhec-blog-tcpip-2.aspx
57 // Since Vista's auto-tune is better than any static value we can could set, 57 // Since Vista's auto-tune is better than any static value we can could set,
58 // only change these on pre-vista machines. 58 // only change these on pre-vista machines.
59 int32 major_version, minor_version, fix_version; 59 if (base::win::GetVersion() < base::win::VERSION_VISTA) {
60 base::SysInfo::OperatingSystemVersionNumbers(&major_version, &minor_version,
61 &fix_version);
62 if (major_version < 6) {
63 const int32 kSocketBufferSize = 64 * 1024; 60 const int32 kSocketBufferSize = 64 * 1024;
64 SetSocketReceiveBufferSize(socket, kSocketBufferSize); 61 SetSocketReceiveBufferSize(socket, kSocketBufferSize);
65 SetSocketSendBufferSize(socket, kSocketBufferSize); 62 SetSocketSendBufferSize(socket, kSocketBufferSize);
66 } 63 }
67 64
68 // Disable Nagle. 65 // Disable Nagle.
69 // The Nagle implementation on windows is governed by RFC 896. The idea 66 // The Nagle implementation on windows is governed by RFC 896. The idea
70 // behind Nagle is to reduce small packets on the network. When Nagle is 67 // behind Nagle is to reduce small packets on the network. When Nagle is
71 // enabled, if a partial packet has been sent, the TCP stack will disallow 68 // enabled, if a partial packet has been sent, the TCP stack will disallow
72 // further *partial* packets until an ACK has been received from the other 69 // further *partial* packets until an ACK has been received from the other
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 use_history_.set_was_used_to_convey_data(); 893 use_history_.set_was_used_to_convey_data();
897 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, 894 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes,
898 core_->write_buffer_.buf); 895 core_->write_buffer_.buf);
899 } 896 }
900 } 897 }
901 core_->write_iobuffer_ = NULL; 898 core_->write_iobuffer_ = NULL;
902 DoWriteCallback(rv); 899 DoWriteCallback(rv);
903 } 900 }
904 901
905 } // namespace net 902 } // namespace net
OLDNEW
« no previous file with comments | « chrome_frame/test/dll_redirector_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698