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

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

Issue 603783002: Replaced DCHECK with CHECK to detect invalid socket usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « net/socket/socket_libevent.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_socket.h" 5 #include "net/socket/tcp_socket.h"
6 #include "net/socket/tcp_socket_win.h" 6 #include "net/socket/tcp_socket_win.h"
7 7
8 #include <mstcpip.h> 8 #include <mstcpip.h>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 return true; 486 return true;
487 } 487 }
488 488
489 int TCPSocketWin::Read(IOBuffer* buf, 489 int TCPSocketWin::Read(IOBuffer* buf,
490 int buf_len, 490 int buf_len,
491 const CompletionCallback& callback) { 491 const CompletionCallback& callback) {
492 DCHECK(CalledOnValidThread()); 492 DCHECK(CalledOnValidThread());
493 DCHECK_NE(socket_, INVALID_SOCKET); 493 DCHECK_NE(socket_, INVALID_SOCKET);
494 DCHECK(!waiting_read_); 494 DCHECK(!waiting_read_);
495 DCHECK(read_callback_.is_null()); 495 CHECK(read_callback_.is_null());
496 DCHECK(!core_->read_iobuffer_); 496 DCHECK(!core_->read_iobuffer_);
497 497
498 return DoRead(buf, buf_len, callback); 498 return DoRead(buf, buf_len, callback);
499 } 499 }
500 500
501 int TCPSocketWin::Write(IOBuffer* buf, 501 int TCPSocketWin::Write(IOBuffer* buf,
502 int buf_len, 502 int buf_len,
503 const CompletionCallback& callback) { 503 const CompletionCallback& callback) {
504 DCHECK(CalledOnValidThread()); 504 DCHECK(CalledOnValidThread());
505 DCHECK_NE(socket_, INVALID_SOCKET); 505 DCHECK_NE(socket_, INVALID_SOCKET);
506 DCHECK(!waiting_write_); 506 DCHECK(!waiting_write_);
507 DCHECK(write_callback_.is_null()); 507 CHECK(write_callback_.is_null());
508 DCHECK_GT(buf_len, 0); 508 DCHECK_GT(buf_len, 0);
509 DCHECK(!core_->write_iobuffer_); 509 DCHECK(!core_->write_iobuffer_);
510 510
511 base::StatsCounter writes("tcp.writes"); 511 base::StatsCounter writes("tcp.writes");
512 writes.Increment(); 512 writes.Increment();
513 513
514 WSABUF write_buffer; 514 WSABUF write_buffer;
515 write_buffer.len = buf_len; 515 write_buffer.len = buf_len;
516 write_buffer.buf = buf->data(); 516 write_buffer.buf = buf->data();
517 517
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 1016
1017 waiting_read_ = false; 1017 waiting_read_ = false;
1018 core_->read_iobuffer_ = NULL; 1018 core_->read_iobuffer_ = NULL;
1019 core_->read_buffer_length_ = 0; 1019 core_->read_buffer_length_ = 0;
1020 1020
1021 DCHECK_NE(rv, ERR_IO_PENDING); 1021 DCHECK_NE(rv, ERR_IO_PENDING);
1022 base::ResetAndReturn(&read_callback_).Run(rv); 1022 base::ResetAndReturn(&read_callback_).Run(rv);
1023 } 1023 }
1024 1024
1025 } // namespace net 1025 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_libevent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698