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

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

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_connection.h ('k') | net/quic/quic_connection_helper.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 (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 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return delta <= kMaxPacketGap; 62 return delta <= kMaxPacketGap;
63 } 63 }
64 64
65 // An alarm that is scheduled to send an ack if a timeout occurs. 65 // An alarm that is scheduled to send an ack if a timeout occurs.
66 class AckAlarm : public QuicAlarm::Delegate { 66 class AckAlarm : public QuicAlarm::Delegate {
67 public: 67 public:
68 explicit AckAlarm(QuicConnection* connection) 68 explicit AckAlarm(QuicConnection* connection)
69 : connection_(connection) { 69 : connection_(connection) {
70 } 70 }
71 71
72 virtual QuicTime OnAlarm() override { 72 QuicTime OnAlarm() override {
73 connection_->SendAck(); 73 connection_->SendAck();
74 return QuicTime::Zero(); 74 return QuicTime::Zero();
75 } 75 }
76 76
77 private: 77 private:
78 QuicConnection* connection_; 78 QuicConnection* connection_;
79 79
80 DISALLOW_COPY_AND_ASSIGN(AckAlarm); 80 DISALLOW_COPY_AND_ASSIGN(AckAlarm);
81 }; 81 };
82 82
83 // This alarm will be scheduled any time a data-bearing packet is sent out. 83 // This alarm will be scheduled any time a data-bearing packet is sent out.
84 // When the alarm goes off, the connection checks to see if the oldest packets 84 // When the alarm goes off, the connection checks to see if the oldest packets
85 // have been acked, and retransmit them if they have not. 85 // have been acked, and retransmit them if they have not.
86 class RetransmissionAlarm : public QuicAlarm::Delegate { 86 class RetransmissionAlarm : public QuicAlarm::Delegate {
87 public: 87 public:
88 explicit RetransmissionAlarm(QuicConnection* connection) 88 explicit RetransmissionAlarm(QuicConnection* connection)
89 : connection_(connection) { 89 : connection_(connection) {
90 } 90 }
91 91
92 virtual QuicTime OnAlarm() override { 92 QuicTime OnAlarm() override {
93 connection_->OnRetransmissionTimeout(); 93 connection_->OnRetransmissionTimeout();
94 return QuicTime::Zero(); 94 return QuicTime::Zero();
95 } 95 }
96 96
97 private: 97 private:
98 QuicConnection* connection_; 98 QuicConnection* connection_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(RetransmissionAlarm); 100 DISALLOW_COPY_AND_ASSIGN(RetransmissionAlarm);
101 }; 101 };
102 102
103 // An alarm that is scheduled when the sent scheduler requires a 103 // An alarm that is scheduled when the sent scheduler requires a
104 // a delay before sending packets and fires when the packet may be sent. 104 // a delay before sending packets and fires when the packet may be sent.
105 class SendAlarm : public QuicAlarm::Delegate { 105 class SendAlarm : public QuicAlarm::Delegate {
106 public: 106 public:
107 explicit SendAlarm(QuicConnection* connection) 107 explicit SendAlarm(QuicConnection* connection)
108 : connection_(connection) { 108 : connection_(connection) {
109 } 109 }
110 110
111 virtual QuicTime OnAlarm() override { 111 QuicTime OnAlarm() override {
112 connection_->WriteIfNotBlocked(); 112 connection_->WriteIfNotBlocked();
113 // Never reschedule the alarm, since CanWrite does that. 113 // Never reschedule the alarm, since CanWrite does that.
114 return QuicTime::Zero(); 114 return QuicTime::Zero();
115 } 115 }
116 116
117 private: 117 private:
118 QuicConnection* connection_; 118 QuicConnection* connection_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(SendAlarm); 120 DISALLOW_COPY_AND_ASSIGN(SendAlarm);
121 }; 121 };
122 122
123 class TimeoutAlarm : public QuicAlarm::Delegate { 123 class TimeoutAlarm : public QuicAlarm::Delegate {
124 public: 124 public:
125 explicit TimeoutAlarm(QuicConnection* connection) 125 explicit TimeoutAlarm(QuicConnection* connection)
126 : connection_(connection) { 126 : connection_(connection) {
127 } 127 }
128 128
129 virtual QuicTime OnAlarm() override { 129 QuicTime OnAlarm() override {
130 connection_->CheckForTimeout(); 130 connection_->CheckForTimeout();
131 // Never reschedule the alarm, since CheckForTimeout does that. 131 // Never reschedule the alarm, since CheckForTimeout does that.
132 return QuicTime::Zero(); 132 return QuicTime::Zero();
133 } 133 }
134 134
135 private: 135 private:
136 QuicConnection* connection_; 136 QuicConnection* connection_;
137 137
138 DISALLOW_COPY_AND_ASSIGN(TimeoutAlarm); 138 DISALLOW_COPY_AND_ASSIGN(TimeoutAlarm);
139 }; 139 };
140 140
141 class PingAlarm : public QuicAlarm::Delegate { 141 class PingAlarm : public QuicAlarm::Delegate {
142 public: 142 public:
143 explicit PingAlarm(QuicConnection* connection) 143 explicit PingAlarm(QuicConnection* connection)
144 : connection_(connection) { 144 : connection_(connection) {
145 } 145 }
146 146
147 virtual QuicTime OnAlarm() override { 147 QuicTime OnAlarm() override {
148 connection_->SendPing(); 148 connection_->SendPing();
149 return QuicTime::Zero(); 149 return QuicTime::Zero();
150 } 150 }
151 151
152 private: 152 private:
153 QuicConnection* connection_; 153 QuicConnection* connection_;
154 154
155 DISALLOW_COPY_AND_ASSIGN(PingAlarm); 155 DISALLOW_COPY_AND_ASSIGN(PingAlarm);
156 }; 156 };
157 157
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 } 2040 }
2041 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { 2041 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) {
2042 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { 2042 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) {
2043 return true; 2043 return true;
2044 } 2044 }
2045 } 2045 }
2046 return false; 2046 return false;
2047 } 2047 }
2048 2048
2049 } // namespace net 2049 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698