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

Side by Side Diff: net/udp/udp_socket_libevent.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 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 | « net/tools/fetch/http_listen_socket.cc ('k') | net/udp/udp_socket_unittest.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) 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_libevent.h" 5 #include "net/udp/udp_socket_libevent.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <netdb.h> 9 #include <netdb.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 DCHECK_NE(rv, ERR_IO_PENDING); 320 DCHECK_NE(rv, ERR_IO_PENDING);
321 DCHECK(!write_callback_.is_null()); 321 DCHECK(!write_callback_.is_null());
322 322
323 // since Run may result in Write being called, clear write_callback_ up front. 323 // since Run may result in Write being called, clear write_callback_ up front.
324 CompletionCallback c = write_callback_; 324 CompletionCallback c = write_callback_;
325 write_callback_.Reset(); 325 write_callback_.Reset();
326 c.Run(rv); 326 c.Run(rv);
327 } 327 }
328 328
329 void UDPSocketLibevent::DidCompleteRead() { 329 void UDPSocketLibevent::DidCompleteRead() {
330 int result = InternalRecvFrom(read_buf_, read_buf_len_, recv_from_address_); 330 int result =
331 InternalRecvFrom(read_buf_.get(), read_buf_len_, recv_from_address_);
331 if (result != ERR_IO_PENDING) { 332 if (result != ERR_IO_PENDING) {
332 read_buf_ = NULL; 333 read_buf_ = NULL;
333 read_buf_len_ = 0; 334 read_buf_len_ = 0;
334 recv_from_address_ = NULL; 335 recv_from_address_ = NULL;
335 bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); 336 bool ok = read_socket_watcher_.StopWatchingFileDescriptor();
336 DCHECK(ok); 337 DCHECK(ok);
337 DoReadCallback(result); 338 DoReadCallback(result);
338 } 339 }
339 } 340 }
340 341
(...skipping 30 matching lines...) Expand all
371 return MapSystemError(errno); 372 return MapSystemError(errno);
372 if (SetNonBlocking(socket_)) { 373 if (SetNonBlocking(socket_)) {
373 const int err = MapSystemError(errno); 374 const int err = MapSystemError(errno);
374 Close(); 375 Close();
375 return err; 376 return err;
376 } 377 }
377 return OK; 378 return OK;
378 } 379 }
379 380
380 void UDPSocketLibevent::DidCompleteWrite() { 381 void UDPSocketLibevent::DidCompleteWrite() {
381 int result = InternalSendTo(write_buf_, write_buf_len_, 382 int result =
382 send_to_address_.get()); 383 InternalSendTo(write_buf_.get(), write_buf_len_, send_to_address_.get());
383 384
384 if (result != ERR_IO_PENDING) { 385 if (result != ERR_IO_PENDING) {
385 write_buf_ = NULL; 386 write_buf_ = NULL;
386 write_buf_len_ = 0; 387 write_buf_len_ = 0;
387 send_to_address_.reset(); 388 send_to_address_.reset();
388 write_socket_watcher_.StopWatchingFileDescriptor(); 389 write_socket_watcher_.StopWatchingFileDescriptor();
389 DoWriteCallback(result); 390 DoWriteCallback(result);
390 } 391 }
391 } 392 }
392 393
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 if (is_connected()) 631 if (is_connected())
631 return ERR_SOCKET_IS_CONNECTED; 632 return ERR_SOCKET_IS_CONNECTED;
632 633
633 if (loopback) 634 if (loopback)
634 socket_options_ |= SOCKET_OPTION_MULTICAST_LOOP; 635 socket_options_ |= SOCKET_OPTION_MULTICAST_LOOP;
635 else 636 else
636 socket_options_ &= ~SOCKET_OPTION_MULTICAST_LOOP; 637 socket_options_ &= ~SOCKET_OPTION_MULTICAST_LOOP;
637 return OK; 638 return OK;
638 } 639 }
639 } // namespace net 640 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/fetch/http_listen_socket.cc ('k') | net/udp/udp_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698