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

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

Issue 503113004: Remove implicit conversions from scoped_refptr to T* in net/socket/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | net/socket/socket_test_util.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/socket_libevent.h" 5 #include "net/socket/socket_libevent.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 10
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 waiting_connect_ = false; 433 waiting_connect_ = false;
434 base::ResetAndReturn(&write_callback_).Run(rv); 434 base::ResetAndReturn(&write_callback_).Run(rv);
435 } 435 }
436 436
437 int SocketLibevent::DoRead(IOBuffer* buf, int buf_len) { 437 int SocketLibevent::DoRead(IOBuffer* buf, int buf_len) {
438 int rv = HANDLE_EINTR(read(socket_fd_, buf->data(), buf_len)); 438 int rv = HANDLE_EINTR(read(socket_fd_, buf->data(), buf_len));
439 return rv >= 0 ? rv : MapSystemError(errno); 439 return rv >= 0 ? rv : MapSystemError(errno);
440 } 440 }
441 441
442 void SocketLibevent::ReadCompleted() { 442 void SocketLibevent::ReadCompleted() {
443 int rv = DoRead(read_buf_, read_buf_len_); 443 int rv = DoRead(read_buf_.get(), read_buf_len_);
444 if (rv == ERR_IO_PENDING) 444 if (rv == ERR_IO_PENDING)
445 return; 445 return;
446 446
447 bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); 447 bool ok = read_socket_watcher_.StopWatchingFileDescriptor();
448 DCHECK(ok); 448 DCHECK(ok);
449 read_buf_ = NULL; 449 read_buf_ = NULL;
450 read_buf_len_ = 0; 450 read_buf_len_ = 0;
451 base::ResetAndReturn(&read_callback_).Run(rv); 451 base::ResetAndReturn(&read_callback_).Run(rv);
452 } 452 }
453 453
454 int SocketLibevent::DoWrite(IOBuffer* buf, int buf_len) { 454 int SocketLibevent::DoWrite(IOBuffer* buf, int buf_len) {
455 int rv = HANDLE_EINTR(write(socket_fd_, buf->data(), buf_len)); 455 int rv = HANDLE_EINTR(write(socket_fd_, buf->data(), buf_len));
456 return rv >= 0 ? rv : MapSystemError(errno); 456 return rv >= 0 ? rv : MapSystemError(errno);
457 } 457 }
458 458
459 void SocketLibevent::WriteCompleted() { 459 void SocketLibevent::WriteCompleted() {
460 int rv = DoWrite(write_buf_, write_buf_len_); 460 int rv = DoWrite(write_buf_.get(), write_buf_len_);
461 if (rv == ERR_IO_PENDING) 461 if (rv == ERR_IO_PENDING)
462 return; 462 return;
463 463
464 bool ok = write_socket_watcher_.StopWatchingFileDescriptor(); 464 bool ok = write_socket_watcher_.StopWatchingFileDescriptor();
465 DCHECK(ok); 465 DCHECK(ok);
466 write_buf_ = NULL; 466 write_buf_ = NULL;
467 write_buf_len_ = 0; 467 write_buf_len_ = 0;
468 base::ResetAndReturn(&write_callback_).Run(rv); 468 base::ResetAndReturn(&write_callback_).Run(rv);
469 } 469 }
470 470
471 } // namespace net 471 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698