| 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/browser/renderer_host/p2p/socket_host_tcp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
| 6 | 6 |
| 7 #include "base/sys_byteorder.h" | 7 #include "base/sys_byteorder.h" |
| 8 #include "content/common/p2p_messages.h" | 8 #include "content/common/p2p_messages.h" |
| 9 #include "ipc/ipc_sender.h" | 9 #include "ipc/ipc_sender.h" |
| 10 #include "jingle/glue/fake_ssl_client_socket.h" | 10 #include "jingle/glue/fake_ssl_client_socket.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 write_pending_ = false; | 394 write_pending_ = false; |
| 395 HandleWriteResult(result); | 395 HandleWriteResult(result); |
| 396 DoWrite(); | 396 DoWrite(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void P2PSocketHostTcpBase::HandleWriteResult(int result) { | 399 void P2PSocketHostTcpBase::HandleWriteResult(int result) { |
| 400 DCHECK(write_buffer_.get()); | 400 DCHECK(write_buffer_.get()); |
| 401 if (result >= 0) { | 401 if (result >= 0) { |
| 402 write_buffer_->DidConsume(result); | 402 write_buffer_->DidConsume(result); |
| 403 if (write_buffer_->BytesRemaining() == 0) { | 403 if (write_buffer_->BytesRemaining() == 0) { |
| 404 message_sender_->Send(new P2PMsg_OnSendComplete(id_)); | 404 message_sender_->Send( |
| 405 new P2PMsg_OnSendComplete(id_, P2PSendPacketMetrics())); |
| 405 if (write_queue_.empty()) { | 406 if (write_queue_.empty()) { |
| 406 write_buffer_ = NULL; | 407 write_buffer_ = NULL; |
| 407 } else { | 408 } else { |
| 408 write_buffer_ = write_queue_.front(); | 409 write_buffer_ = write_queue_.front(); |
| 409 write_queue_.pop(); | 410 write_queue_.pop(); |
| 410 // Update how many bytes are still waiting to be sent. | 411 // Update how many bytes are still waiting to be sent. |
| 411 DecrementDelayedBytes(write_buffer_->size()); | 412 DecrementDelayedBytes(write_buffer_->size()); |
| 412 } | 413 } |
| 413 } | 414 } |
| 414 } else if (result == net::ERR_IO_PENDING) { | 415 } else if (result == net::ERR_IO_PENDING) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 } else { | 611 } else { |
| 611 packet_size += kTurnChannelDataHeaderSize; | 612 packet_size += kTurnChannelDataHeaderSize; |
| 612 // Calculate any padding if present. | 613 // Calculate any padding if present. |
| 613 if (packet_size % 4) | 614 if (packet_size % 4) |
| 614 *pad_bytes = 4 - packet_size % 4; | 615 *pad_bytes = 4 - packet_size % 4; |
| 615 } | 616 } |
| 616 return packet_size; | 617 return packet_size; |
| 617 } | 618 } |
| 618 | 619 |
| 619 } // namespace content | 620 } // namespace content |
| OLD | NEW |