| Index: content/renderer/p2p/socket_client_impl.cc
|
| diff --git a/content/renderer/p2p/socket_client_impl.cc b/content/renderer/p2p/socket_client_impl.cc
|
| index 1425151089cf42930e66dfd190dff516af893b44..55e75293642ddd558036ec418f25bc7a482d179d 100644
|
| --- a/content/renderer/p2p/socket_client_impl.cc
|
| +++ b/content/renderer/p2p/socket_client_impl.cc
|
| @@ -69,25 +69,35 @@ void P2PSocketClientImpl::DoInit(P2PSocketType type,
|
| type, socket_id_, local_address, remote_address));
|
| }
|
|
|
| -void P2PSocketClientImpl::SendWithDscp(
|
| - const net::IPEndPoint& address,
|
| - const std::vector<char>& data,
|
| - const rtc::PacketOptions& options) {
|
| +uint64 P2PSocketClientImpl::SendWithDscp(const net::IPEndPoint& address,
|
| + const std::vector<char>& data,
|
| + const rtc::PacketOptions& options) {
|
| + uint64 unique_id = GetUniqueId(random_socket_id_, ++next_packet_id_);
|
| if (!ipc_message_loop_->BelongsToCurrentThread()) {
|
| ipc_message_loop_->PostTask(
|
| - FROM_HERE, base::Bind(
|
| - &P2PSocketClientImpl::SendWithDscp, this, address, data, options));
|
| - return;
|
| + FROM_HERE, base::Bind(&P2PSocketClientImpl::SendWithDscpAndPacketId,
|
| + this, address, data, options, unique_id));
|
| + return unique_id;
|
| }
|
|
|
| // Can send data only when the socket is open.
|
| DCHECK(state_ == STATE_OPEN || state_ == STATE_ERROR);
|
| if (state_ == STATE_OPEN) {
|
| - uint64 unique_id = GetUniqueId(random_socket_id_, ++next_packet_id_);
|
| - TRACE_EVENT_ASYNC_BEGIN0("p2p", "Send", unique_id);
|
| - dispatcher_->SendP2PMessage(new P2PHostMsg_Send(socket_id_, address, data,
|
| - options, unique_id));
|
| + SendWithDscpAndPacketId(address, data, options, unique_id);
|
| }
|
| +
|
| + return unique_id;
|
| +}
|
| +
|
| +void P2PSocketClientImpl::SendWithDscpAndPacketId(
|
| + const net::IPEndPoint& address,
|
| + const std::vector<char>& data,
|
| + const rtc::PacketOptions& options,
|
| + uint64 packet_id) {
|
| + DCHECK_EQ(state_, STATE_OPEN);
|
| + TRACE_EVENT_ASYNC_BEGIN0("p2p", "Send", packet_id);
|
| + dispatcher_->SendP2PMessage(
|
| + new P2PHostMsg_Send(socket_id_, address, data, options, packet_id));
|
| }
|
|
|
| void P2PSocketClientImpl::Send(const net::IPEndPoint& address,
|
| @@ -196,17 +206,20 @@ void P2PSocketClientImpl::DeliverOnIncomingTcpConnection(
|
| }
|
| }
|
|
|
| -void P2PSocketClientImpl::OnSendComplete() {
|
| +void P2PSocketClientImpl::OnSendComplete(
|
| + const P2PSendPacketMetrics& send_metrics) {
|
| DCHECK(ipc_message_loop_->BelongsToCurrentThread());
|
|
|
| delegate_message_loop_->PostTask(
|
| - FROM_HERE, base::Bind(&P2PSocketClientImpl::DeliverOnSendComplete, this));
|
| + FROM_HERE, base::Bind(&P2PSocketClientImpl::DeliverOnSendComplete, this,
|
| + send_metrics));
|
| }
|
|
|
| -void P2PSocketClientImpl::DeliverOnSendComplete() {
|
| +void P2PSocketClientImpl::DeliverOnSendComplete(
|
| + const P2PSendPacketMetrics& send_metrics) {
|
| DCHECK(delegate_message_loop_->BelongsToCurrentThread());
|
| if (delegate_)
|
| - delegate_->OnSendComplete();
|
| + delegate_->OnSendComplete(send_metrics);
|
| }
|
|
|
| void P2PSocketClientImpl::OnError() {
|
|
|