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

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

Issue 14696007: Warn on missing OVERRIDE/virtual everywhere, not just in header files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new regressions, attempt 3 Created 7 years, 7 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/tools/quic/quic_epoll_connection_helper.h" 5 #include "net/tools/quic/quic_epoll_connection_helper.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sys/socket.h> 8 #include <sys/socket.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "net/base/ip_endpoint.h" 12 #include "net/base/ip_endpoint.h"
13 #include "net/quic/crypto/quic_random.h" 13 #include "net/quic/crypto/quic_random.h"
14 #include "net/tools/flip_server/epoll_server.h" 14 #include "net/tools/flip_server/epoll_server.h"
15 #include "net/tools/quic/quic_socket_utils.h" 15 #include "net/tools/quic/quic_socket_utils.h"
16 16
17 namespace net { 17 namespace net {
18 namespace tools { 18 namespace tools {
19 19
20 // This alarm will be scheduled any time a data-bearing packet is sent out. 20 // This alarm will be scheduled any time a data-bearing packet is sent out.
21 // When the alarm goes off, the connection checks to see if the oldest packets 21 // When the alarm goes off, the connection checks to see if the oldest packets
22 // have been acked, and retransmit them if they have not. 22 // have been acked, and retransmit them if they have not.
23 class RetransmissionAlarm : public EpollAlarm { 23 class RetransmissionAlarm : public EpollAlarm {
24 public: 24 public:
25 explicit RetransmissionAlarm(QuicConnection* connection) 25 explicit RetransmissionAlarm(QuicConnection* connection)
26 : connection_(connection) { 26 : connection_(connection) {
27 } 27 }
28 28
29 virtual int64 OnAlarm() { 29 virtual int64 OnAlarm() OVERRIDE {
30 EpollAlarm::OnAlarm(); 30 EpollAlarm::OnAlarm();
31 // This is safe because this code is Google3 specific, and the 31 // This is safe because this code is Google3 specific, and the
32 // Google3 QuicTime's epoch is the unix epoch. 32 // Google3 QuicTime's epoch is the unix epoch.
33 return connection_->OnRetransmissionTimeout().Subtract( 33 return connection_->OnRetransmissionTimeout().Subtract(
34 QuicTime::Zero()).ToMicroseconds(); 34 QuicTime::Zero()).ToMicroseconds();
35 } 35 }
36 36
37 private: 37 private:
38 QuicConnection* connection_; 38 QuicConnection* connection_;
39 }; 39 };
40 40
41 // An alarm that is scheduled when the sent scheduler requires a 41 // An alarm that is scheduled when the sent scheduler requires a
42 // a delay before sending packets and fires when the packet may be sent. 42 // a delay before sending packets and fires when the packet may be sent.
43 class SendAlarm : public EpollAlarm { 43 class SendAlarm : public EpollAlarm {
44 public: 44 public:
45 explicit SendAlarm(QuicConnection* connection) 45 explicit SendAlarm(QuicConnection* connection)
46 : connection_(connection) { 46 : connection_(connection) {
47 } 47 }
48 48
49 virtual int64 OnAlarm() { 49 virtual int64 OnAlarm() OVERRIDE {
50 EpollAlarm::OnAlarm(); 50 EpollAlarm::OnAlarm();
51 connection_->OnCanWrite(); 51 connection_->OnCanWrite();
52 // Never reschedule the alarm, since OnCanWrite does that. 52 // Never reschedule the alarm, since OnCanWrite does that.
53 return 0; 53 return 0;
54 } 54 }
55 55
56 private: 56 private:
57 QuicConnection* connection_; 57 QuicConnection* connection_;
58 }; 58 };
59 59
60 // An alarm which fires when the connection may have timed out. 60 // An alarm which fires when the connection may have timed out.
61 class TimeoutAlarm : public EpollAlarm { 61 class TimeoutAlarm : public EpollAlarm {
62 public: 62 public:
63 explicit TimeoutAlarm(QuicConnection* connection) 63 explicit TimeoutAlarm(QuicConnection* connection)
64 : connection_(connection) { 64 : connection_(connection) {
65 } 65 }
66 66
67 virtual int64 OnAlarm() { 67 virtual int64 OnAlarm() OVERRIDE {
68 EpollAlarm::OnAlarm(); 68 EpollAlarm::OnAlarm();
69 connection_->CheckForTimeout(); 69 connection_->CheckForTimeout();
70 // Never reschedule the alarm, since CheckForTimeout does that. 70 // Never reschedule the alarm, since CheckForTimeout does that.
71 return 0; 71 return 0;
72 } 72 }
73 73
74 private: 74 private:
75 QuicConnection* connection_; 75 QuicConnection* connection_;
76 }; 76 };
77 77
78 // An alarm that is scheduled to send an ack if a timeout occurs. 78 // An alarm that is scheduled to send an ack if a timeout occurs.
79 class AckAlarm : public EpollAlarm { 79 class AckAlarm : public EpollAlarm {
80 public: 80 public:
81 explicit AckAlarm(QuicConnection* connection) 81 explicit AckAlarm(QuicConnection* connection)
82 : connection_(connection) { 82 : connection_(connection) {
83 } 83 }
84 84
85 virtual int64 OnAlarm() { 85 virtual int64 OnAlarm() OVERRIDE {
86 EpollAlarm::OnAlarm(); 86 EpollAlarm::OnAlarm();
87 connection_->SendAck(); 87 connection_->SendAck();
88 return 0; 88 return 0;
89 } 89 }
90 90
91 private: 91 private:
92 QuicConnection* connection_; 92 QuicConnection* connection_;
93 }; 93 };
94 94
95 QuicEpollConnectionHelper::QuicEpollConnectionHelper( 95 QuicEpollConnectionHelper::QuicEpollConnectionHelper(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 bool QuicEpollConnectionHelper::IsSendAlarmSet() { 199 bool QuicEpollConnectionHelper::IsSendAlarmSet() {
200 return send_alarm_->registered(); 200 return send_alarm_->registered();
201 } 201 }
202 202
203 void QuicEpollConnectionHelper::UnregisterSendAlarmIfRegistered() { 203 void QuicEpollConnectionHelper::UnregisterSendAlarmIfRegistered() {
204 send_alarm_->UnregisterIfRegistered(); 204 send_alarm_->UnregisterIfRegistered();
205 } 205 }
206 206
207 } // namespace tools 207 } // namespace tools
208 } // namespace net 208 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher_test.cc ('k') | net/tools/quic/quic_epoll_connection_helper_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698