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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp.cc

Issue 2249473002: Remove use of stl_util's STLDeleteContainerPairSecondPointers from content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win2 Created 4 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
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 "content/browser/renderer_host/p2p/socket_host_tcp.h" 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 url_context_(url_context) { 60 url_context_(url_context) {
61 } 61 }
62 62
63 P2PSocketHostTcpBase::~P2PSocketHostTcpBase() { 63 P2PSocketHostTcpBase::~P2PSocketHostTcpBase() {
64 if (state_ == STATE_OPEN) { 64 if (state_ == STATE_OPEN) {
65 DCHECK(socket_.get()); 65 DCHECK(socket_.get());
66 socket_.reset(); 66 socket_.reset();
67 } 67 }
68 } 68 }
69 69
70 bool P2PSocketHostTcpBase::InitAccepted(const net::IPEndPoint& remote_address, 70 bool P2PSocketHostTcpBase::InitAccepted(
71 net::StreamSocket* socket) { 71 const net::IPEndPoint& remote_address,
72 DCHECK(socket); 72 std::unique_ptr<net::StreamSocket> socket) {
73 DCHECK(socket.get());
Sergey Ulanov 2016/08/15 16:54:59 nit: don't need .get() here
Avi (use Gerrit) 2016/08/15 18:10:29 Done.
73 DCHECK_EQ(state_, STATE_UNINITIALIZED); 74 DCHECK_EQ(state_, STATE_UNINITIALIZED);
74 75
75 remote_address_.ip_address = remote_address; 76 remote_address_.ip_address = remote_address;
76 // TODO(ronghuawu): Add FakeSSLServerSocket. 77 // TODO(ronghuawu): Add FakeSSLServerSocket.
77 socket_.reset(socket); 78 socket_ = std::move(socket);
78 state_ = STATE_OPEN; 79 state_ = STATE_OPEN;
79 DoRead(); 80 DoRead();
80 return state_ != STATE_ERROR; 81 return state_ != STATE_ERROR;
81 } 82 }
82 83
83 bool P2PSocketHostTcpBase::Init(const net::IPEndPoint& local_address, 84 bool P2PSocketHostTcpBase::Init(const net::IPEndPoint& local_address,
84 uint16_t min_port, 85 uint16_t min_port,
85 uint16_t max_port, 86 uint16_t max_port,
86 const P2PHostAndIPEndPoint& remote_address) { 87 const P2PHostAndIPEndPoint& remote_address) {
87 DCHECK_EQ(state_, STATE_UNINITIALIZED); 88 DCHECK_EQ(state_, STATE_UNINITIALIZED);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } else if (result == net::ERR_IO_PENDING) { 438 } else if (result == net::ERR_IO_PENDING) {
438 write_pending_ = true; 439 write_pending_ = true;
439 } else { 440 } else {
440 ReportSocketError(result, "WebRTC.ICE.TcpSocketWriteErrorCode"); 441 ReportSocketError(result, "WebRTC.ICE.TcpSocketWriteErrorCode");
441 442
442 LOG(ERROR) << "Error when sending data in TCP socket: " << result; 443 LOG(ERROR) << "Error when sending data in TCP socket: " << result;
443 OnError(); 444 OnError();
444 } 445 }
445 } 446 }
446 447
447 P2PSocketHost* P2PSocketHostTcpBase::AcceptIncomingTcpConnection( 448 std::unique_ptr<P2PSocketHost>
448 const net::IPEndPoint& remote_address, int id) { 449 P2PSocketHostTcpBase::AcceptIncomingTcpConnection(
450 const net::IPEndPoint& remote_address,
451 int id) {
449 NOTREACHED(); 452 NOTREACHED();
450 OnError(); 453 OnError();
451 return NULL; 454 return NULL;
452 } 455 }
453 456
454 void P2PSocketHostTcpBase::DidCompleteRead(int result) { 457 void P2PSocketHostTcpBase::DidCompleteRead(int result) {
455 DCHECK_EQ(state_, STATE_OPEN); 458 DCHECK_EQ(state_, STATE_OPEN);
456 459
457 if (result == net::ERR_IO_PENDING) { 460 if (result == net::ERR_IO_PENDING) {
458 return; 461 return;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } else { 645 } else {
643 packet_size += kTurnChannelDataHeaderSize; 646 packet_size += kTurnChannelDataHeaderSize;
644 // Calculate any padding if present. 647 // Calculate any padding if present.
645 if (packet_size % 4) 648 if (packet_size % 4)
646 *pad_bytes = 4 - packet_size % 4; 649 *pad_bytes = 4 - packet_size % 4;
647 } 650 }
648 return packet_size; 651 return packet_size;
649 } 652 }
650 653
651 } // namespace content 654 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698