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

Side by Side Diff: net/tools/quic/quic_default_packet_writer.cc

Issue 2502593003: Make a QuicDefaultPacketWriter method virtual, and check member variable directly. No behavior chan… (Closed)
Patch Set: Created 4 years, 1 month 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 | « net/tools/quic/quic_default_packet_writer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/tools/quic/quic_default_packet_writer.h" 5 #include "net/tools/quic/quic_default_packet_writer.h"
6 6
7 #include "net/tools/quic/quic_socket_utils.h" 7 #include "net/tools/quic/quic_socket_utils.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 QuicDefaultPacketWriter::QuicDefaultPacketWriter(int fd) 11 QuicDefaultPacketWriter::QuicDefaultPacketWriter(int fd)
12 : fd_(fd), write_blocked_(false) {} 12 : fd_(fd), write_blocked_(false) {}
13 13
14 QuicDefaultPacketWriter::~QuicDefaultPacketWriter() {} 14 QuicDefaultPacketWriter::~QuicDefaultPacketWriter() {}
15 15
16 WriteResult QuicDefaultPacketWriter::WritePacket(const char* buffer, 16 WriteResult QuicDefaultPacketWriter::WritePacket(const char* buffer,
17 size_t buf_len, 17 size_t buf_len,
18 const IPAddress& self_address, 18 const IPAddress& self_address,
19 const IPEndPoint& peer_address, 19 const IPEndPoint& peer_address,
20 PerPacketOptions* options) { 20 PerPacketOptions* options) {
21 DCHECK(!IsWriteBlocked()); 21 DCHECK(!write_blocked_);
22 DCHECK(nullptr == options) 22 DCHECK(nullptr == options)
23 << "QuicDefaultPacketWriter does not accept any options."; 23 << "QuicDefaultPacketWriter does not accept any options.";
24 WriteResult result = QuicSocketUtils::WritePacket(fd_, buffer, buf_len, 24 WriteResult result = QuicSocketUtils::WritePacket(fd_, buffer, buf_len,
25 self_address, peer_address); 25 self_address, peer_address);
26 if (result.status == WRITE_STATUS_BLOCKED) { 26 if (result.status == WRITE_STATUS_BLOCKED) {
27 write_blocked_ = true; 27 write_blocked_ = true;
28 } 28 }
29 return result; 29 return result;
30 } 30 }
31 31
32 bool QuicDefaultPacketWriter::IsWriteBlockedDataBuffered() const { 32 bool QuicDefaultPacketWriter::IsWriteBlockedDataBuffered() const {
33 return false; 33 return false;
34 } 34 }
35 35
36 bool QuicDefaultPacketWriter::IsWriteBlocked() const { 36 bool QuicDefaultPacketWriter::IsWriteBlocked() const {
37 return write_blocked_; 37 return write_blocked_;
38 } 38 }
39 39
40 void QuicDefaultPacketWriter::SetWritable() { 40 void QuicDefaultPacketWriter::SetWritable() {
41 write_blocked_ = false; 41 write_blocked_ = false;
42 } 42 }
43 43
44 QuicByteCount QuicDefaultPacketWriter::GetMaxPacketSize( 44 QuicByteCount QuicDefaultPacketWriter::GetMaxPacketSize(
45 const IPEndPoint& peer_address) const { 45 const IPEndPoint& peer_address) const {
46 return kMaxPacketSize; 46 return kMaxPacketSize;
47 } 47 }
48 48
49 void QuicDefaultPacketWriter::set_write_blocked(bool is_blocked) {
50 write_blocked_ = is_blocked;
51 }
52
49 } // namespace net 53 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_default_packet_writer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698