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

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

Issue 1660533002: Landing Recent QUIC changes until 01/26/2016 18:14 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « net/quic/quic_chromium_packet_writer.h ('k') | net/quic/quic_client_session_base.h » ('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 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/quic/quic_chromium_packet_writer.h" 5 #include "net/quic/quic_chromium_packet_writer.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
11 #include "net/base/io_buffer.h" 11 #include "net/base/io_buffer.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 QuicChromiumPacketWriter::QuicChromiumPacketWriter() : weak_factory_(this) {} 16 QuicChromiumPacketWriter::QuicChromiumPacketWriter() : weak_factory_(this) {}
17 17
18 QuicChromiumPacketWriter::QuicChromiumPacketWriter(Socket* socket) 18 QuicChromiumPacketWriter::QuicChromiumPacketWriter(Socket* socket)
19 : socket_(socket), write_blocked_(false), weak_factory_(this) {} 19 : socket_(socket), write_blocked_(false), weak_factory_(this) {}
20 20
21 QuicChromiumPacketWriter::~QuicChromiumPacketWriter() {} 21 QuicChromiumPacketWriter::~QuicChromiumPacketWriter() {}
22 22
23 WriteResult QuicChromiumPacketWriter::WritePacket( 23 WriteResult QuicChromiumPacketWriter::WritePacket(
24 const char* buffer, 24 const char* buffer,
25 size_t buf_len, 25 size_t buf_len,
26 const IPAddressNumber& self_address, 26 const IPAddressNumber& self_address,
27 const IPEndPoint& peer_address) { 27 const IPEndPoint& peer_address,
28 PerPacketOptions* /*options*/) {
28 scoped_refptr<StringIOBuffer> buf( 29 scoped_refptr<StringIOBuffer> buf(
29 new StringIOBuffer(std::string(buffer, buf_len))); 30 new StringIOBuffer(std::string(buffer, buf_len)));
30 DCHECK(!IsWriteBlocked()); 31 DCHECK(!IsWriteBlocked());
31 base::TimeTicks now = base::TimeTicks::Now(); 32 base::TimeTicks now = base::TimeTicks::Now();
32 int rv = socket_->Write(buf.get(), buf_len, 33 int rv = socket_->Write(buf.get(), buf_len,
33 base::Bind(&QuicChromiumPacketWriter::OnWriteComplete, 34 base::Bind(&QuicChromiumPacketWriter::OnWriteComplete,
34 weak_factory_.GetWeakPtr())); 35 weak_factory_.GetWeakPtr()));
35 WriteStatus status = WRITE_STATUS_OK; 36 WriteStatus status = WRITE_STATUS_OK;
36 if (rv < 0) { 37 if (rv < 0) {
37 if (rv != ERR_IO_PENDING) { 38 if (rv != ERR_IO_PENDING) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 76 }
76 connection_->OnCanWrite(); 77 connection_->OnCanWrite();
77 } 78 }
78 79
79 QuicByteCount QuicChromiumPacketWriter::GetMaxPacketSize( 80 QuicByteCount QuicChromiumPacketWriter::GetMaxPacketSize(
80 const IPEndPoint& peer_address) const { 81 const IPEndPoint& peer_address) const {
81 return kMaxPacketSize; 82 return kMaxPacketSize;
82 } 83 }
83 84
84 } // namespace net 85 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_packet_writer.h ('k') | net/quic/quic_client_session_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698