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

Side by Side Diff: net/tools/quic/test_tools/packet_dropping_test_writer.cc

Issue 1779883005: Remove unused return value from QuicAlarm::Delegate::OnAlarm. No behavior change, not protected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116388439
Patch Set: Created 4 years, 9 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/tools/quic/test_tools/packet_dropping_test_writer.h ('k') | no next file » | 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/tools/quic/test_tools/packet_dropping_test_writer.h" 5 #include "net/tools/quic/test_tools/packet_dropping_test_writer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "net/tools/quic/quic_epoll_connection_helper.h" 10 #include "net/tools/quic/quic_epoll_connection_helper.h"
11 #include "net/tools/quic/quic_socket_utils.h" 11 #include "net/tools/quic/quic_socket_utils.h"
12 12
13 namespace net { 13 namespace net {
14 namespace test { 14 namespace test {
15 15
16 // An alarm that is scheduled if a blocked socket is simulated to indicate 16 // An alarm that is scheduled if a blocked socket is simulated to indicate
17 // it's writable again. 17 // it's writable again.
18 class WriteUnblockedAlarm : public QuicAlarm::Delegate { 18 class WriteUnblockedAlarm : public QuicAlarm::Delegate {
19 public: 19 public:
20 explicit WriteUnblockedAlarm(PacketDroppingTestWriter* writer) 20 explicit WriteUnblockedAlarm(PacketDroppingTestWriter* writer)
21 : writer_(writer) {} 21 : writer_(writer) {}
22 22
23 QuicTime OnAlarm() override { 23 void OnAlarm() override {
24 DVLOG(1) << "Unblocking socket."; 24 DVLOG(1) << "Unblocking socket.";
25 writer_->OnCanWrite(); 25 writer_->OnCanWrite();
26 return QuicTime::Zero();
27 } 26 }
28 27
29 private: 28 private:
30 PacketDroppingTestWriter* writer_; 29 PacketDroppingTestWriter* writer_;
31 }; 30 };
32 31
33 // An alarm that is scheduled every time a new packet is to be written at a 32 // An alarm that is scheduled every time a new packet is to be written at a
34 // later point. 33 // later point.
35 class DelayAlarm : public QuicAlarm::Delegate { 34 class DelayAlarm : public QuicAlarm::Delegate {
36 public: 35 public:
37 explicit DelayAlarm(PacketDroppingTestWriter* writer) : writer_(writer) {} 36 explicit DelayAlarm(PacketDroppingTestWriter* writer) : writer_(writer) {}
38 37
39 QuicTime OnAlarm() override { return writer_->ReleaseOldPackets(); } 38 void OnAlarm() override {
39 QuicTime new_deadline = writer_->ReleaseOldPackets();
40 if (new_deadline.IsInitialized()) {
41 writer_->SetDelayAlarm(new_deadline);
42 }
43 }
40 44
41 private: 45 private:
42 PacketDroppingTestWriter* writer_; 46 PacketDroppingTestWriter* writer_;
43 }; 47 };
44 48
45 PacketDroppingTestWriter::PacketDroppingTestWriter() 49 PacketDroppingTestWriter::PacketDroppingTestWriter()
46 : clock_(nullptr), 50 : clock_(nullptr),
47 cur_buffer_size_(0), 51 cur_buffer_size_(0),
48 num_calls_to_write_(0), 52 num_calls_to_write_(0),
49 config_mutex_(), 53 config_mutex_(),
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 while (!delayed_packets_.empty()) { 200 while (!delayed_packets_.empty()) {
197 QuicTime next_send_time = delayed_packets_.front().send_time; 201 QuicTime next_send_time = delayed_packets_.front().send_time;
198 if (next_send_time > clock_->Now()) { 202 if (next_send_time > clock_->Now()) {
199 return next_send_time; 203 return next_send_time;
200 } 204 }
201 ReleaseNextPacket(); 205 ReleaseNextPacket();
202 } 206 }
203 return QuicTime::Zero(); 207 return QuicTime::Zero();
204 } 208 }
205 209
210 void PacketDroppingTestWriter::SetDelayAlarm(QuicTime new_deadline) {
211 delay_alarm_->Set(new_deadline);
212 }
213
206 void PacketDroppingTestWriter::OnCanWrite() { 214 void PacketDroppingTestWriter::OnCanWrite() {
207 on_can_write_->OnCanWrite(); 215 on_can_write_->OnCanWrite();
208 } 216 }
209 217
210 PacketDroppingTestWriter::DelayedWrite::DelayedWrite( 218 PacketDroppingTestWriter::DelayedWrite::DelayedWrite(
211 const char* buffer, 219 const char* buffer,
212 size_t buf_len, 220 size_t buf_len,
213 const IPAddress& self_address, 221 const IPAddress& self_address,
214 const IPEndPoint& peer_address, 222 const IPEndPoint& peer_address,
215 std::unique_ptr<PerPacketOptions> options, 223 std::unique_ptr<PerPacketOptions> options,
(...skipping 12 matching lines...) Expand all
228 // IPAddress has no move assignment operator. 236 // IPAddress has no move assignment operator.
229 // 237 //
230 // PacketDroppingTestWriter::DelayedWrite& 238 // PacketDroppingTestWriter::DelayedWrite&
231 // PacketDroppingTestWriter::DelayedWrite::operator=( 239 // PacketDroppingTestWriter::DelayedWrite::operator=(
232 // PacketDroppingTestWriter::DelayedWrite&& other) = default; 240 // PacketDroppingTestWriter::DelayedWrite&& other) = default;
233 241
234 PacketDroppingTestWriter::DelayedWrite::~DelayedWrite() {} 242 PacketDroppingTestWriter::DelayedWrite::~DelayedWrite() {}
235 243
236 } // namespace test 244 } // namespace test
237 } // namespace net 245 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/test_tools/packet_dropping_test_writer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698