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

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

Issue 15937012: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small bug fixes Created 7 years, 6 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
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_helper.h" 5 #include "net/quic/quic_connection_helper.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/task_runner.h" 9 #include "base/task_runner.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 send_alarm_registered_ = true; 110 send_alarm_registered_ = true;
111 task_runner_->PostDelayedTask( 111 task_runner_->PostDelayedTask(
112 FROM_HERE, 112 FROM_HERE,
113 base::Bind(&QuicConnectionHelper::OnSendAlarm, 113 base::Bind(&QuicConnectionHelper::OnSendAlarm,
114 weak_factory_.GetWeakPtr()), 114 weak_factory_.GetWeakPtr()),
115 base::TimeDelta::FromMicroseconds( 115 base::TimeDelta::FromMicroseconds(
116 alarm_time.Subtract(QuicTime::Zero()).ToMicroseconds())); 116 alarm_time.Subtract(QuicTime::Zero()).ToMicroseconds()));
117 } 117 }
118 118
119 void QuicConnectionHelper::SetTimeoutAlarm(QuicTime::Delta delay) { 119 void QuicConnectionHelper::SetTimeoutAlarm(QuicTime::Delta delay) {
120 DCHECK(!timeout_alarm_registered_); 120 // CheckForTimeout will call SetTimeoutAlarm for the remaining time if alarm
121 // goes off before the delay.
122 if (timeout_alarm_registered_)
123 return;
121 timeout_alarm_registered_ = true; 124 timeout_alarm_registered_ = true;
122 task_runner_->PostDelayedTask( 125 task_runner_->PostDelayedTask(
123 FROM_HERE, 126 FROM_HERE,
124 base::Bind(&QuicConnectionHelper::OnTimeoutAlarm, 127 base::Bind(&QuicConnectionHelper::OnTimeoutAlarm,
125 weak_factory_.GetWeakPtr()), 128 weak_factory_.GetWeakPtr()),
126 base::TimeDelta::FromMicroseconds(delay.ToMicroseconds())); 129 base::TimeDelta::FromMicroseconds(delay.ToMicroseconds()));
127 } 130 }
128 131
129 bool QuicConnectionHelper::IsSendAlarmSet() { 132 bool QuicConnectionHelper::IsSendAlarmSet() {
130 return send_alarm_registered_; 133 return send_alarm_registered_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ack_alarm_time_ = QuicTime::Zero(); 172 ack_alarm_time_ = QuicTime::Zero();
170 connection_->SendAck(); 173 connection_->SendAck();
171 } 174 }
172 175
173 void QuicConnectionHelper::OnWriteComplete(int result) { 176 void QuicConnectionHelper::OnWriteComplete(int result) {
174 // TODO(rch): Inform the connection about the result. 177 // TODO(rch): Inform the connection about the result.
175 connection_->OnCanWrite(); 178 connection_->OnCanWrite();
176 } 179 }
177 180
178 } // namespace net 181 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698