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

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

Issue 2132623002: Landing Recent QUIC changes until 2016-07-02 02:45 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing comment about RPCs Created 4 years, 5 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_client_session.cc ('k') | net/quic/quic_client_promised_info.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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_reader.h" 5 #include "net/quic/quic_chromium_packet_reader.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 21 matching lines...) Expand all
32 net_log_(net_log), 32 net_log_(net_log),
33 weak_factory_(this) {} 33 weak_factory_(this) {}
34 34
35 QuicChromiumPacketReader::~QuicChromiumPacketReader() {} 35 QuicChromiumPacketReader::~QuicChromiumPacketReader() {}
36 36
37 void QuicChromiumPacketReader::StartReading() { 37 void QuicChromiumPacketReader::StartReading() {
38 if (read_pending_) 38 if (read_pending_)
39 return; 39 return;
40 40
41 if (num_packets_read_ == 0) 41 if (num_packets_read_ == 0)
42 yield_after_ = clock_->Now().Add(yield_after_duration_); 42 yield_after_ = clock_->Now() + yield_after_duration_;
43 43
44 DCHECK(socket_); 44 DCHECK(socket_);
45 read_pending_ = true; 45 read_pending_ = true;
46 int rv = socket_->Read(read_buffer_.get(), read_buffer_->size(), 46 int rv = socket_->Read(read_buffer_.get(), read_buffer_->size(),
47 base::Bind(&QuicChromiumPacketReader::OnReadComplete, 47 base::Bind(&QuicChromiumPacketReader::OnReadComplete,
48 weak_factory_.GetWeakPtr())); 48 weak_factory_.GetWeakPtr()));
49 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.AsyncRead", rv == ERR_IO_PENDING); 49 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.AsyncRead", rv == ERR_IO_PENDING);
50 if (rv == ERR_IO_PENDING) { 50 if (rv == ERR_IO_PENDING) {
51 num_packets_read_ = 0; 51 num_packets_read_ = 0;
52 return; 52 return;
(...skipping 28 matching lines...) Expand all
81 IPEndPoint peer_address; 81 IPEndPoint peer_address;
82 socket_->GetLocalAddress(&local_address); 82 socket_->GetLocalAddress(&local_address);
83 socket_->GetPeerAddress(&peer_address); 83 socket_->GetPeerAddress(&peer_address);
84 if (!visitor_->OnPacket(packet, local_address, peer_address)) 84 if (!visitor_->OnPacket(packet, local_address, peer_address))
85 return; 85 return;
86 86
87 StartReading(); 87 StartReading();
88 } 88 }
89 89
90 } // namespace net 90 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_session.cc ('k') | net/quic/quic_client_promised_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698