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

Side by Side Diff: net/quic/quic_connection.cc

Issue 135363006: Cleanup: remove BlockedWriterInterface from QuicPacketWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_client_session_test.cc ('k') | net/quic/quic_connection_test.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 "net/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 pending_version_negotiation_packet_ = true; 771 pending_version_negotiation_packet_ = true;
772 if (writer_->IsWriteBlocked()) { 772 if (writer_->IsWriteBlocked()) {
773 visitor_->OnWriteBlocked(); 773 visitor_->OnWriteBlocked();
774 return; 774 return;
775 } 775 }
776 scoped_ptr<QuicEncryptedPacket> version_packet( 776 scoped_ptr<QuicEncryptedPacket> version_packet(
777 packet_creator_.SerializeVersionNegotiationPacket( 777 packet_creator_.SerializeVersionNegotiationPacket(
778 framer_.supported_versions())); 778 framer_.supported_versions()));
779 WriteResult result = writer_->WritePacket( 779 WriteResult result = writer_->WritePacket(
780 version_packet->data(), version_packet->length(), 780 version_packet->data(), version_packet->length(),
781 self_address().address(), peer_address(), this); 781 self_address().address(), peer_address());
782 782
783 if (result.status == WRITE_STATUS_ERROR) { 783 if (result.status == WRITE_STATUS_ERROR) {
784 // We can't send an error as the socket is presumably borked. 784 // We can't send an error as the socket is presumably borked.
785 CloseConnection(QUIC_PACKET_WRITE_ERROR, false); 785 CloseConnection(QUIC_PACKET_WRITE_ERROR, false);
786 return; 786 return;
787 } 787 }
788 if (result.status == WRITE_STATUS_BLOCKED) { 788 if (result.status == WRITE_STATUS_BLOCKED) {
789 visitor_->OnWriteBlocked(); 789 visitor_->OnWriteBlocked();
790 if (writer_->IsWriteBlockedDataBuffered()) { 790 if (writer_->IsWriteBlockedDataBuffered()) {
791 pending_version_negotiation_packet_ = false; 791 pending_version_negotiation_packet_ = false;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 << " forced: " << (forced == FORCE ? "yes" : "no"); 1149 << " forced: " << (forced == FORCE ? "yes" : "no");
1150 1150
1151 DCHECK(pending_write_.get() == NULL); 1151 DCHECK(pending_write_.get() == NULL);
1152 pending_write_.reset(new PendingWrite(sequence_number, transmission_type, 1152 pending_write_.reset(new PendingWrite(sequence_number, transmission_type,
1153 retransmittable, level, 1153 retransmittable, level,
1154 packet.is_fec_packet(), 1154 packet.is_fec_packet(),
1155 packet.length())); 1155 packet.length()));
1156 1156
1157 WriteResult result = 1157 WriteResult result =
1158 writer_->WritePacket(encrypted->data(), encrypted->length(), 1158 writer_->WritePacket(encrypted->data(), encrypted->length(),
1159 self_address().address(), peer_address(), this); 1159 self_address().address(), peer_address());
1160 if (result.error_code == ERR_IO_PENDING) { 1160 if (result.error_code == ERR_IO_PENDING) {
1161 DCHECK_EQ(WRITE_STATUS_BLOCKED, result.status); 1161 DCHECK_EQ(WRITE_STATUS_BLOCKED, result.status);
1162 } 1162 }
1163 if (debug_visitor_) { 1163 if (debug_visitor_) {
1164 // Pass the write result to the visitor. 1164 // Pass the write result to the visitor.
1165 debug_visitor_->OnPacketSent(sequence_number, level, *encrypted, result); 1165 debug_visitor_->OnPacketSent(sequence_number, level, *encrypted, result);
1166 } 1166 }
1167 if (result.status == WRITE_STATUS_BLOCKED) { 1167 if (result.status == WRITE_STATUS_BLOCKED) {
1168 visitor_->OnWriteBlocked(); 1168 visitor_->OnWriteBlocked();
1169 // If the socket buffers the the data, then the packet should not 1169 // If the socket buffers the the data, then the packet should not
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 // If we changed the generator's batch state, restore original batch state. 1664 // If we changed the generator's batch state, restore original batch state.
1665 if (!already_in_batch_mode_) { 1665 if (!already_in_batch_mode_) {
1666 DVLOG(1) << "Leaving Batch Mode."; 1666 DVLOG(1) << "Leaving Batch Mode.";
1667 connection_->packet_generator_.FinishBatchOperations(); 1667 connection_->packet_generator_.FinishBatchOperations();
1668 } 1668 }
1669 DCHECK_EQ(already_in_batch_mode_, 1669 DCHECK_EQ(already_in_batch_mode_,
1670 connection_->packet_generator_.InBatchMode()); 1670 connection_->packet_generator_.InBatchMode());
1671 } 1671 }
1672 1672
1673 } // namespace net 1673 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session_test.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698