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

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

Issue 759923003: Detect situation when there is no missing send completion signal in P2PSocket implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_host_udp.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 "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
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
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_host_udp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698