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

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

Issue 2222002: Unsigned warning fix - take 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | « net/base/network_change_notifier_win.cc ('k') | net/tools/dump_cache/cache_dumper.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory_debug.h" 9 #include "base/memory_debug.h"
10 #include "base/stats_counters.h" 10 #include "base/stats_counters.h"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 DCHECK(!waiting_read_); 501 DCHECK(!waiting_read_);
502 DCHECK(!read_callback_); 502 DCHECK(!read_callback_);
503 DCHECK(!core_->read_iobuffer_); 503 DCHECK(!core_->read_iobuffer_);
504 504
505 buf_len = core_->ThrottleReadSize(buf_len); 505 buf_len = core_->ThrottleReadSize(buf_len);
506 506
507 core_->read_buffer_.len = buf_len; 507 core_->read_buffer_.len = buf_len;
508 core_->read_buffer_.buf = buf->data(); 508 core_->read_buffer_.buf = buf->data();
509 509
510 // TODO(wtc): Remove the CHECK after enough testing. 510 // TODO(wtc): Remove the CHECK after enough testing.
511 CHECK_EQ(WAIT_TIMEOUT, 511 CHECK_EQ(static_cast<DWORD>(WAIT_TIMEOUT),
512 WaitForSingleObject(core_->read_overlapped_.hEvent, 0)); 512 WaitForSingleObject(core_->read_overlapped_.hEvent, 0));
513 DWORD num, flags = 0; 513 DWORD num, flags = 0;
514 int rv = WSARecv(socket_, &core_->read_buffer_, 1, &num, &flags, 514 int rv = WSARecv(socket_, &core_->read_buffer_, 1, &num, &flags,
515 &core_->read_overlapped_, NULL); 515 &core_->read_overlapped_, NULL);
516 if (rv == 0) { 516 if (rv == 0) {
517 if (ResetEventIfSignaled(core_->read_overlapped_.hEvent)) { 517 if (ResetEventIfSignaled(core_->read_overlapped_.hEvent)) {
518 // Because of how WSARecv fills memory when used asynchronously, Purify 518 // Because of how WSARecv fills memory when used asynchronously, Purify
519 // isn't able to detect that it's been initialized, so it scans for 0xcd 519 // isn't able to detect that it's been initialized, so it scans for 0xcd
520 // in the buffer and reports UMRs (uninitialized memory reads) for those 520 // in the buffer and reports UMRs (uninitialized memory reads) for those
521 // individual bytes. We override that in PURIFY builds to avoid the 521 // individual bytes. We override that in PURIFY builds to avoid the
(...skipping 29 matching lines...) Expand all
551 DCHECK(!core_->write_iobuffer_); 551 DCHECK(!core_->write_iobuffer_);
552 552
553 static StatsCounter reads("tcp.writes"); 553 static StatsCounter reads("tcp.writes");
554 reads.Increment(); 554 reads.Increment();
555 555
556 core_->write_buffer_.len = buf_len; 556 core_->write_buffer_.len = buf_len;
557 core_->write_buffer_.buf = buf->data(); 557 core_->write_buffer_.buf = buf->data();
558 core_->write_buffer_length_ = buf_len; 558 core_->write_buffer_length_ = buf_len;
559 559
560 // TODO(wtc): Remove the CHECK after enough testing. 560 // TODO(wtc): Remove the CHECK after enough testing.
561 CHECK_EQ(WAIT_TIMEOUT, 561 CHECK_EQ(static_cast<DWORD>(WAIT_TIMEOUT),
562 WaitForSingleObject(core_->write_overlapped_.hEvent, 0)); 562 WaitForSingleObject(core_->write_overlapped_.hEvent, 0));
563 DWORD num; 563 DWORD num;
564 int rv = WSASend(socket_, &core_->write_buffer_, 1, &num, 0, 564 int rv = WSASend(socket_, &core_->write_buffer_, 1, &num, 0,
565 &core_->write_overlapped_, NULL); 565 &core_->write_overlapped_, NULL);
566 if (rv == 0) { 566 if (rv == 0) {
567 if (ResetEventIfSignaled(core_->write_overlapped_.hEvent)) { 567 if (ResetEventIfSignaled(core_->write_overlapped_.hEvent)) {
568 rv = static_cast<int>(num); 568 rv = static_cast<int>(num);
569 if (rv > buf_len || rv < 0) { 569 if (rv > buf_len || rv < 0) {
570 // It seems that some winsock interceptors report that more was written 570 // It seems that some winsock interceptors report that more was written
571 // than was available. Treat this as an error. http://crbug.com/27870 571 // than was available. Treat this as an error. http://crbug.com/27870
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } else { 767 } else {
768 net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_SENT, 768 net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_SENT,
769 new NetLogIntegerParameter("num_bytes", rv)); 769 new NetLogIntegerParameter("num_bytes", rv));
770 } 770 }
771 } 771 }
772 core_->write_iobuffer_ = NULL; 772 core_->write_iobuffer_ = NULL;
773 DoWriteCallback(rv); 773 DoWriteCallback(rv);
774 } 774 }
775 775
776 } // namespace net 776 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_win.cc ('k') | net/tools/dump_cache/cache_dumper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698