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

Unified Diff: net/tools/quic/test_tools/packet_dropping_test_writer.h

Issue 131503016: Properly trigger OnCanWrite processing from PacketDroppingTestWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/test_tools/packet_dropping_test_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/test_tools/packet_dropping_test_writer.h
diff --git a/net/tools/quic/test_tools/packet_dropping_test_writer.h b/net/tools/quic/test_tools/packet_dropping_test_writer.h
index cde5c13649b7f1f8dd846560ce2733f17f1f8733..d451feca5e23d0ba8cb66d09ebd0cf8a7369ba37 100644
--- a/net/tools/quic/test_tools/packet_dropping_test_writer.h
+++ b/net/tools/quic/test_tools/packet_dropping_test_writer.h
@@ -27,11 +27,21 @@ namespace test {
// the options to delay packets and reorder packets if delay is enabled.
class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+ virtual void OnCanWrite() = 0;
+ };
+
PacketDroppingTestWriter();
virtual ~PacketDroppingTestWriter();
- void SetConnectionHelper(QuicEpollConnectionHelper* helper);
+ // Must be called before blocking, reordering or delaying (loss is OK). May be
+ // called after connecting if the helper is not available before.
+ // |on_can_write| will be triggered when fake-unblocking; ownership will be
+ // assumed.
+ void Initialize(QuicEpollConnectionHelper* helper, Delegate* on_can_write);
// QuicPacketWriter methods:
virtual WriteResult WritePacket(
@@ -50,7 +60,7 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
// for the next delayed packet to be written.
QuicTime ReleaseOldPackets();
- QuicBlockedWriterInterface* blocked_writer() { return blocked_writer_; }
+ void OnCanWrite();
// The percent of time a packet is simulated as being lost.
void set_fake_packet_loss_percentage(int32 fake_packet_loss_percentage) {
@@ -125,7 +135,7 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
const QuicClock* clock_;
scoped_ptr<QuicAlarm> write_unblocked_alarm_;
scoped_ptr<QuicAlarm> delay_alarm_;
- QuicBlockedWriterInterface* blocked_writer_;
+ scoped_ptr<Delegate> on_can_write_;
SimpleRandom simple_random_;
// Stored packets delayed by fake packet delay or bandwidth restrictions.
DelayedPacketList delayed_packets_;
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/test_tools/packet_dropping_test_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698