| OLD | NEW |
| 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/renderer/p2p/ipc_socket_factory.h" | 5 #include "content/renderer/p2p/ipc_socket_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/logging.h" | |
| 14 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
| 20 #include "base/threading/thread_checker.h" | |
| 21 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
| 22 #include "content/renderer/media/webrtc_logging.h" | 21 #include "content/renderer/media/webrtc_logging.h" |
| 23 #include "content/renderer/p2p/host_address_request.h" | 22 #include "content/renderer/p2p/host_address_request.h" |
| 24 #include "content/renderer/p2p/socket_client_delegate.h" | 23 #include "content/renderer/p2p/socket_client_delegate.h" |
| 25 #include "content/renderer/p2p/socket_client_impl.h" | 24 #include "content/renderer/p2p/socket_client_impl.h" |
| 26 #include "content/renderer/p2p/socket_dispatcher.h" | 25 #include "content/renderer/p2p/socket_dispatcher.h" |
| 27 #include "jingle/glue/utils.h" | 26 #include "jingle/glue/utils.h" |
| 28 #include "net/base/ip_address.h" | 27 #include "net/base/ip_address.h" |
| 29 #include "third_party/webrtc/base/asyncpacketsocket.h" | 28 #include "third_party/webrtc/base/asyncpacketsocket.h" |
| 30 | 29 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 const rtc::SocketAddress& remote_address); | 148 const rtc::SocketAddress& remote_address); |
| 150 | 149 |
| 151 int DoSetOption(P2PSocketOption option, int value); | 150 int DoSetOption(P2PSocketOption option, int value); |
| 152 | 151 |
| 153 // Allow a finch experiment to control the initial value of | 152 // Allow a finch experiment to control the initial value of |
| 154 // send_bytes_available_; | 153 // send_bytes_available_; |
| 155 void AdjustUdpSendBufferSize(); | 154 void AdjustUdpSendBufferSize(); |
| 156 | 155 |
| 157 P2PSocketType type_; | 156 P2PSocketType type_; |
| 158 | 157 |
| 159 // Used to verify that a method runs on the thread that created this socket. | 158 // Message loop on which this socket was created and being used. |
| 160 base::ThreadChecker thread_checker_; | 159 base::MessageLoop* message_loop_; |
| 161 | 160 |
| 162 // Corresponding P2P socket client. | 161 // Corresponding P2P socket client. |
| 163 scoped_refptr<P2PSocketClient> client_; | 162 scoped_refptr<P2PSocketClient> client_; |
| 164 | 163 |
| 165 // Local address is allocated by the browser process, and the | 164 // Local address is allocated by the browser process, and the |
| 166 // renderer side doesn't know the address until it receives OnOpen() | 165 // renderer side doesn't know the address until it receives OnOpen() |
| 167 // event from the browser. | 166 // event from the browser. |
| 168 rtc::SocketAddress local_address_; | 167 rtc::SocketAddress local_address_; |
| 169 | 168 |
| 170 // Remote address for client TCP connections. | 169 // Remote address for client TCP connections. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 private: | 225 private: |
| 227 virtual void OnAddressResolved(const net::IPAddressList& addresses); | 226 virtual void OnAddressResolved(const net::IPAddressList& addresses); |
| 228 | 227 |
| 229 scoped_refptr<P2PAsyncAddressResolver> resolver_; | 228 scoped_refptr<P2PAsyncAddressResolver> resolver_; |
| 230 int port_; // Port number in |addr| from Start() method. | 229 int port_; // Port number in |addr| from Start() method. |
| 231 std::vector<rtc::IPAddress> addresses_; // Resolved addresses. | 230 std::vector<rtc::IPAddress> addresses_; // Resolved addresses. |
| 232 }; | 231 }; |
| 233 | 232 |
| 234 IpcPacketSocket::IpcPacketSocket() | 233 IpcPacketSocket::IpcPacketSocket() |
| 235 : type_(P2P_SOCKET_UDP), | 234 : type_(P2P_SOCKET_UDP), |
| 235 message_loop_(base::MessageLoop::current()), |
| 236 state_(IS_UNINITIALIZED), | 236 state_(IS_UNINITIALIZED), |
| 237 send_bytes_available_(kMaximumInFlightBytes), | 237 send_bytes_available_(kMaximumInFlightBytes), |
| 238 writable_signal_expected_(false), | 238 writable_signal_expected_(false), |
| 239 error_(0), | 239 error_(0), |
| 240 max_discard_bytes_sequence_(0), | 240 max_discard_bytes_sequence_(0), |
| 241 current_discard_bytes_sequence_(0), | 241 current_discard_bytes_sequence_(0), |
| 242 packets_discarded_(0), | 242 packets_discarded_(0), |
| 243 total_packets_(0) { | 243 total_packets_(0) { |
| 244 static_assert(kMaximumInFlightBytes > 0, "would send at zero rate"); | 244 static_assert(kMaximumInFlightBytes > 0, "would send at zero rate"); |
| 245 std::fill_n(options_, static_cast<int> (P2P_SOCKET_OPT_MAX), | 245 std::fill_n(options_, static_cast<int> (P2P_SOCKET_OPT_MAX), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 if (send_buffer_size > 0) { | 287 if (send_buffer_size > 0) { |
| 288 send_bytes_available_ = send_buffer_size; | 288 send_bytes_available_ = send_buffer_size; |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 bool IpcPacketSocket::Init(P2PSocketType type, | 292 bool IpcPacketSocket::Init(P2PSocketType type, |
| 293 P2PSocketClientImpl* client, | 293 P2PSocketClientImpl* client, |
| 294 const rtc::SocketAddress& local_address, | 294 const rtc::SocketAddress& local_address, |
| 295 const rtc::SocketAddress& remote_address) { | 295 const rtc::SocketAddress& remote_address) { |
| 296 DCHECK(thread_checker_.CalledOnValidThread()); | 296 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 297 DCHECK_EQ(state_, IS_UNINITIALIZED); | 297 DCHECK_EQ(state_, IS_UNINITIALIZED); |
| 298 | 298 |
| 299 type_ = type; | 299 type_ = type; |
| 300 client_ = client; | 300 client_ = client; |
| 301 local_address_ = local_address; | 301 local_address_ = local_address; |
| 302 remote_address_ = remote_address; | 302 remote_address_ = remote_address; |
| 303 state_ = IS_OPENING; | 303 state_ = IS_OPENING; |
| 304 | 304 |
| 305 net::IPEndPoint local_endpoint; | 305 net::IPEndPoint local_endpoint; |
| 306 if (!jingle_glue::SocketAddressToIPEndPoint( | 306 if (!jingle_glue::SocketAddressToIPEndPoint( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 334 | 334 |
| 335 client->Init(type, local_endpoint, remote_info, this); | 335 client->Init(type, local_endpoint, remote_info, this); |
| 336 | 336 |
| 337 return true; | 337 return true; |
| 338 } | 338 } |
| 339 | 339 |
| 340 void IpcPacketSocket::InitAcceptedTcp( | 340 void IpcPacketSocket::InitAcceptedTcp( |
| 341 P2PSocketClient* client, | 341 P2PSocketClient* client, |
| 342 const rtc::SocketAddress& local_address, | 342 const rtc::SocketAddress& local_address, |
| 343 const rtc::SocketAddress& remote_address) { | 343 const rtc::SocketAddress& remote_address) { |
| 344 DCHECK(thread_checker_.CalledOnValidThread()); | 344 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 345 DCHECK_EQ(state_, IS_UNINITIALIZED); | 345 DCHECK_EQ(state_, IS_UNINITIALIZED); |
| 346 | 346 |
| 347 client_ = client; | 347 client_ = client; |
| 348 local_address_ = local_address; | 348 local_address_ = local_address; |
| 349 remote_address_ = remote_address; | 349 remote_address_ = remote_address; |
| 350 state_ = IS_OPEN; | 350 state_ = IS_OPEN; |
| 351 TraceSendThrottlingState(); | 351 TraceSendThrottlingState(); |
| 352 client_->SetDelegate(this); | 352 client_->SetDelegate(this); |
| 353 } | 353 } |
| 354 | 354 |
| 355 // rtc::AsyncPacketSocket interface. | 355 // rtc::AsyncPacketSocket interface. |
| 356 rtc::SocketAddress IpcPacketSocket::GetLocalAddress() const { | 356 rtc::SocketAddress IpcPacketSocket::GetLocalAddress() const { |
| 357 DCHECK(thread_checker_.CalledOnValidThread()); | 357 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 358 return local_address_; | 358 return local_address_; |
| 359 } | 359 } |
| 360 | 360 |
| 361 rtc::SocketAddress IpcPacketSocket::GetRemoteAddress() const { | 361 rtc::SocketAddress IpcPacketSocket::GetRemoteAddress() const { |
| 362 DCHECK(thread_checker_.CalledOnValidThread()); | 362 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 363 return remote_address_; | 363 return remote_address_; |
| 364 } | 364 } |
| 365 | 365 |
| 366 int IpcPacketSocket::Send(const void *data, size_t data_size, | 366 int IpcPacketSocket::Send(const void *data, size_t data_size, |
| 367 const rtc::PacketOptions& options) { | 367 const rtc::PacketOptions& options) { |
| 368 DCHECK(thread_checker_.CalledOnValidThread()); | 368 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 369 return SendTo(data, data_size, remote_address_, options); | 369 return SendTo(data, data_size, remote_address_, options); |
| 370 } | 370 } |
| 371 | 371 |
| 372 int IpcPacketSocket::SendTo(const void *data, size_t data_size, | 372 int IpcPacketSocket::SendTo(const void *data, size_t data_size, |
| 373 const rtc::SocketAddress& address, | 373 const rtc::SocketAddress& address, |
| 374 const rtc::PacketOptions& options) { | 374 const rtc::PacketOptions& options) { |
| 375 DCHECK(thread_checker_.CalledOnValidThread()); | 375 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 376 | 376 |
| 377 switch (state_) { | 377 switch (state_) { |
| 378 case IS_UNINITIALIZED: | 378 case IS_UNINITIALIZED: |
| 379 NOTREACHED(); | 379 NOTREACHED(); |
| 380 error_ = EWOULDBLOCK; | 380 error_ = EWOULDBLOCK; |
| 381 return -1; | 381 return -1; |
| 382 case IS_OPENING: | 382 case IS_OPENING: |
| 383 error_ = EWOULDBLOCK; | 383 error_ = EWOULDBLOCK; |
| 384 return -1; | 384 return -1; |
| 385 case IS_CLOSED: | 385 case IS_CLOSED: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 446 |
| 447 in_flight_packet_records_.push_back( | 447 in_flight_packet_records_.push_back( |
| 448 InFlightPacketRecord(packet_id, data_size)); | 448 InFlightPacketRecord(packet_id, data_size)); |
| 449 TraceSendThrottlingState(); | 449 TraceSendThrottlingState(); |
| 450 | 450 |
| 451 // Fake successful send. The caller ignores result anyway. | 451 // Fake successful send. The caller ignores result anyway. |
| 452 return data_size; | 452 return data_size; |
| 453 } | 453 } |
| 454 | 454 |
| 455 int IpcPacketSocket::Close() { | 455 int IpcPacketSocket::Close() { |
| 456 DCHECK(thread_checker_.CalledOnValidThread()); | 456 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 457 | 457 |
| 458 client_->Close(); | 458 client_->Close(); |
| 459 state_ = IS_CLOSED; | 459 state_ = IS_CLOSED; |
| 460 | 460 |
| 461 return 0; | 461 return 0; |
| 462 } | 462 } |
| 463 | 463 |
| 464 rtc::AsyncPacketSocket::State IpcPacketSocket::GetState() const { | 464 rtc::AsyncPacketSocket::State IpcPacketSocket::GetState() const { |
| 465 DCHECK(thread_checker_.CalledOnValidThread()); | 465 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 466 | 466 |
| 467 switch (state_) { | 467 switch (state_) { |
| 468 case IS_UNINITIALIZED: | 468 case IS_UNINITIALIZED: |
| 469 NOTREACHED(); | 469 NOTREACHED(); |
| 470 return STATE_CLOSED; | 470 return STATE_CLOSED; |
| 471 | 471 |
| 472 case IS_OPENING: | 472 case IS_OPENING: |
| 473 return STATE_BINDING; | 473 return STATE_BINDING; |
| 474 | 474 |
| 475 case IS_OPEN: | 475 case IS_OPEN: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 493 if (!JingleSocketOptionToP2PSocketOption(option, &p2p_socket_option)) { | 493 if (!JingleSocketOptionToP2PSocketOption(option, &p2p_socket_option)) { |
| 494 // unsupported option. | 494 // unsupported option. |
| 495 return -1; | 495 return -1; |
| 496 } | 496 } |
| 497 | 497 |
| 498 *value = options_[p2p_socket_option]; | 498 *value = options_[p2p_socket_option]; |
| 499 return 0; | 499 return 0; |
| 500 } | 500 } |
| 501 | 501 |
| 502 int IpcPacketSocket::SetOption(rtc::Socket::Option option, int value) { | 502 int IpcPacketSocket::SetOption(rtc::Socket::Option option, int value) { |
| 503 DCHECK(thread_checker_.CalledOnValidThread()); | 503 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 504 | 504 |
| 505 P2PSocketOption p2p_socket_option = P2P_SOCKET_OPT_MAX; | 505 P2PSocketOption p2p_socket_option = P2P_SOCKET_OPT_MAX; |
| 506 if (!JingleSocketOptionToP2PSocketOption(option, &p2p_socket_option)) { | 506 if (!JingleSocketOptionToP2PSocketOption(option, &p2p_socket_option)) { |
| 507 // Option is not supported. | 507 // Option is not supported. |
| 508 return -1; | 508 return -1; |
| 509 } | 509 } |
| 510 | 510 |
| 511 options_[p2p_socket_option] = value; | 511 options_[p2p_socket_option] = value; |
| 512 | 512 |
| 513 if (state_ == IS_OPEN) { | 513 if (state_ == IS_OPEN) { |
| 514 // Options will be applied when state becomes IS_OPEN in OnOpen. | 514 // Options will be applied when state becomes IS_OPEN in OnOpen. |
| 515 return DoSetOption(p2p_socket_option, value); | 515 return DoSetOption(p2p_socket_option, value); |
| 516 } | 516 } |
| 517 return 0; | 517 return 0; |
| 518 } | 518 } |
| 519 | 519 |
| 520 int IpcPacketSocket::DoSetOption(P2PSocketOption option, int value) { | 520 int IpcPacketSocket::DoSetOption(P2PSocketOption option, int value) { |
| 521 DCHECK(thread_checker_.CalledOnValidThread()); | 521 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 522 DCHECK_EQ(state_, IS_OPEN); | 522 DCHECK_EQ(state_, IS_OPEN); |
| 523 | 523 |
| 524 client_->SetOption(option, value); | 524 client_->SetOption(option, value); |
| 525 return 0; | 525 return 0; |
| 526 } | 526 } |
| 527 | 527 |
| 528 int IpcPacketSocket::GetError() const { | 528 int IpcPacketSocket::GetError() const { |
| 529 DCHECK(thread_checker_.CalledOnValidThread()); | 529 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 530 return error_; | 530 return error_; |
| 531 } | 531 } |
| 532 | 532 |
| 533 void IpcPacketSocket::SetError(int error) { | 533 void IpcPacketSocket::SetError(int error) { |
| 534 DCHECK(thread_checker_.CalledOnValidThread()); | 534 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 535 error_ = error; | 535 error_ = error; |
| 536 } | 536 } |
| 537 | 537 |
| 538 void IpcPacketSocket::OnOpen(const net::IPEndPoint& local_address, | 538 void IpcPacketSocket::OnOpen(const net::IPEndPoint& local_address, |
| 539 const net::IPEndPoint& remote_address) { | 539 const net::IPEndPoint& remote_address) { |
| 540 DCHECK(thread_checker_.CalledOnValidThread()); | 540 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 541 | 541 |
| 542 if (!jingle_glue::IPEndPointToSocketAddress(local_address, &local_address_)) { | 542 if (!jingle_glue::IPEndPointToSocketAddress(local_address, &local_address_)) { |
| 543 // Always expect correct IPv4 address to be allocated. | 543 // Always expect correct IPv4 address to be allocated. |
| 544 NOTREACHED(); | 544 NOTREACHED(); |
| 545 OnError(); | 545 OnError(); |
| 546 return; | 546 return; |
| 547 } | 547 } |
| 548 | 548 |
| 549 state_ = IS_OPEN; | 549 state_ = IS_OPEN; |
| 550 TraceSendThrottlingState(); | 550 TraceSendThrottlingState(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 574 | 574 |
| 575 // SignalConnect after updating the |remote_address_| so that the listener | 575 // SignalConnect after updating the |remote_address_| so that the listener |
| 576 // can get the resolved remote address. | 576 // can get the resolved remote address. |
| 577 SignalConnect(this); | 577 SignalConnect(this); |
| 578 } | 578 } |
| 579 } | 579 } |
| 580 | 580 |
| 581 void IpcPacketSocket::OnIncomingTcpConnection( | 581 void IpcPacketSocket::OnIncomingTcpConnection( |
| 582 const net::IPEndPoint& address, | 582 const net::IPEndPoint& address, |
| 583 P2PSocketClient* client) { | 583 P2PSocketClient* client) { |
| 584 DCHECK(thread_checker_.CalledOnValidThread()); | 584 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 585 | 585 |
| 586 std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); | 586 std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); |
| 587 | 587 |
| 588 rtc::SocketAddress remote_address; | 588 rtc::SocketAddress remote_address; |
| 589 if (!jingle_glue::IPEndPointToSocketAddress(address, &remote_address)) { | 589 if (!jingle_glue::IPEndPointToSocketAddress(address, &remote_address)) { |
| 590 // Always expect correct IPv4 address to be allocated. | 590 // Always expect correct IPv4 address to be allocated. |
| 591 NOTREACHED(); | 591 NOTREACHED(); |
| 592 } | 592 } |
| 593 socket->InitAcceptedTcp(client, local_address_, remote_address); | 593 socket->InitAcceptedTcp(client, local_address_, remote_address); |
| 594 SignalNewConnection(this, socket.release()); | 594 SignalNewConnection(this, socket.release()); |
| 595 } | 595 } |
| 596 | 596 |
| 597 void IpcPacketSocket::OnSendComplete(const P2PSendPacketMetrics& send_metrics) { | 597 void IpcPacketSocket::OnSendComplete(const P2PSendPacketMetrics& send_metrics) { |
| 598 DCHECK(thread_checker_.CalledOnValidThread()); | 598 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 599 | 599 |
| 600 CHECK(!in_flight_packet_records_.empty()); | 600 CHECK(!in_flight_packet_records_.empty()); |
| 601 | 601 |
| 602 const InFlightPacketRecord& record = in_flight_packet_records_.front(); | 602 const InFlightPacketRecord& record = in_flight_packet_records_.front(); |
| 603 | 603 |
| 604 // Tracking is not turned on for TCP so it's always 0. For UDP, this will | 604 // Tracking is not turned on for TCP so it's always 0. For UDP, this will |
| 605 // cause a crash when the packet ids don't match. | 605 // cause a crash when the packet ids don't match. |
| 606 CHECK(send_metrics.packet_id == 0 || | 606 CHECK(send_metrics.packet_id == 0 || |
| 607 record.packet_id == send_metrics.packet_id); | 607 record.packet_id == send_metrics.packet_id); |
| 608 | 608 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 625 WebRtcLogMessage(base::StringPrintf( | 625 WebRtcLogMessage(base::StringPrintf( |
| 626 "IpcPacketSocket: sending is unblocked. %d packets in flight.", | 626 "IpcPacketSocket: sending is unblocked. %d packets in flight.", |
| 627 static_cast<int>(in_flight_packet_records_.size()))); | 627 static_cast<int>(in_flight_packet_records_.size()))); |
| 628 | 628 |
| 629 SignalReadyToSend(this); | 629 SignalReadyToSend(this); |
| 630 writable_signal_expected_ = false; | 630 writable_signal_expected_ = false; |
| 631 } | 631 } |
| 632 } | 632 } |
| 633 | 633 |
| 634 void IpcPacketSocket::OnError() { | 634 void IpcPacketSocket::OnError() { |
| 635 DCHECK(thread_checker_.CalledOnValidThread()); | 635 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 636 bool was_closed = (state_ == IS_ERROR || state_ == IS_CLOSED); | 636 bool was_closed = (state_ == IS_ERROR || state_ == IS_CLOSED); |
| 637 state_ = IS_ERROR; | 637 state_ = IS_ERROR; |
| 638 error_ = ECONNABORTED; | 638 error_ = ECONNABORTED; |
| 639 if (!was_closed) { | 639 if (!was_closed) { |
| 640 SignalClose(this, 0); | 640 SignalClose(this, 0); |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 | 643 |
| 644 void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address, | 644 void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address, |
| 645 const std::vector<char>& data, | 645 const std::vector<char>& data, |
| 646 const base::TimeTicks& timestamp) { | 646 const base::TimeTicks& timestamp) { |
| 647 DCHECK(thread_checker_.CalledOnValidThread()); | 647 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 648 | 648 |
| 649 rtc::SocketAddress address_lj; | 649 rtc::SocketAddress address_lj; |
| 650 | 650 |
| 651 if (address.address().empty()) { | 651 if (address.address().empty()) { |
| 652 DCHECK(IsTcpClientSocket(type_)); | 652 DCHECK(IsTcpClientSocket(type_)); |
| 653 // |address| could be empty for TCP connections behind a proxy. | 653 // |address| could be empty for TCP connections behind a proxy. |
| 654 address_lj = remote_address_; | 654 address_lj = remote_address_; |
| 655 } else { | 655 } else { |
| 656 if (!jingle_glue::IPEndPointToSocketAddress(address, &address_lj)) { | 656 if (!jingle_glue::IPEndPointToSocketAddress(address, &address_lj)) { |
| 657 // We should always be able to convert address here because we | 657 // We should always be able to convert address here because we |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 } | 802 } |
| 803 | 803 |
| 804 rtc::AsyncResolverInterface* | 804 rtc::AsyncResolverInterface* |
| 805 IpcPacketSocketFactory::CreateAsyncResolver() { | 805 IpcPacketSocketFactory::CreateAsyncResolver() { |
| 806 std::unique_ptr<AsyncAddressResolverImpl> resolver( | 806 std::unique_ptr<AsyncAddressResolverImpl> resolver( |
| 807 new AsyncAddressResolverImpl(socket_dispatcher_)); | 807 new AsyncAddressResolverImpl(socket_dispatcher_)); |
| 808 return resolver.release(); | 808 return resolver.release(); |
| 809 } | 809 } |
| 810 | 810 |
| 811 } // namespace content | 811 } // namespace content |
| OLD | NEW |