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

Unified Diff: net/quic/core/congestion_control/simulation/queue.h

Issue 2322233004: Landing Recent QUIC changes until Sun Sep 4 03:41:00 (Closed)
Patch Set: Remove simulation files from the build. Created 4 years, 3 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
Index: net/quic/core/congestion_control/simulation/queue.h
diff --git a/net/quic/core/congestion_control/simulation/queue.h b/net/quic/core/congestion_control/simulation/queue.h
new file mode 100644
index 0000000000000000000000000000000000000000..2902d0ad2c77eb70467eca4d11042348f86e2d0e
--- /dev/null
+++ b/net/quic/core/congestion_control/simulation/queue.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_QUIC_CORE_CONGESTION_CONTROL_SIMULATION_QUEUE_H_
+#define NET_QUIC_CORE_CONGESTION_CONTROL_SIMULATION_QUEUE_H_
+
+#include "net/quic/core/congestion_control/simulation/link.h"
+
+namespace net {
+namespace simulation {
+
+// A finitely sized queue which egresses packets onto a constrained link. The
+// capacity of the queue is measured in bytes as opposed to packets.
+class Queue : public Actor, public UnconstrainedPortInterface {
+ public:
+ class ListenerInterface {
+ public:
+ virtual ~ListenerInterface();
+
+ // Called whenever a packet is removed from the queue.
+ virtual void OnPacketDequeued() = 0;
+ };
+
+ Queue(Simulator* simulator, std::string name, QuicByteCount capacity);
+ ~Queue() override;
+
+ void set_tx_port(ConstrainedPortInterface* port);
+
+ void AcceptPacket(std::unique_ptr<Packet> packet) override;
+
+ void Act() override;
+
+ inline QuicByteCount capacity() const { return capacity_; }
+ inline QuicByteCount bytes_queued() const { return bytes_queued_; }
+ inline QuicPacketCount packets_queued() const { return queue_.size(); }
+
+ inline void set_listener_interface(ListenerInterface* listener) {
+ listener_ = listener;
+ }
+
+ private:
+ void ScheduleNextPacketDequeue();
+
+ const QuicByteCount capacity_;
+ QuicByteCount bytes_queued_;
+
+ ConstrainedPortInterface* tx_port_;
+ std::queue<std::unique_ptr<Packet>> queue_;
+
+ ListenerInterface* listener_;
+
+ DISALLOW_COPY_AND_ASSIGN(Queue);
+};
+
+} // namespace simulation
+} // namespace net
+
+#endif // NET_QUIC_CORE_CONGESTION_CONTROL_SIMULATION_QUEUE_H_
« no previous file with comments | « net/quic/core/congestion_control/simulation/port.cc ('k') | net/quic/core/congestion_control/simulation/queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698