// Copyright (c) 2015 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 QUICHE_HTTP2_CORE_PRIORITY_WRITE_SCHEDULER_H_ #define QUICHE_HTTP2_CORE_PRIORITY_WRITE_SCHEDULER_H_ #include <algorithm> #include <cstddef> #include <cstdint> #include <memory> #include <optional> #include <string> #include <tuple> #include <utility> #include <vector> #include "absl/container/flat_hash_map.h" #include "absl/strings/str_cat.h" #include "absl/time/time.h" #include "quiche/http2/core/spdy_protocol.h" #include "quiche/common/platform/api/quiche_bug_tracker.h" #include "quiche/common/platform/api/quiche_export.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/quiche_circular_deque.h" namespace http2 { namespace test { template <typename StreamIdType> class PriorityWriteSchedulerPeer; } // SpdyPriority is an integer type, so this functor can be used both as // PriorityTypeToInt and as IntToPriorityType. struct QUICHE_EXPORT SpdyPriorityToSpdyPriority { … }; // PriorityWriteScheduler manages the order in which HTTP/2 or HTTP/3 streams // are written. Each stream has a priority of type PriorityType. This includes // an integer between 0 and 7, and optionally other information that is stored // but otherwise ignored by this class. Higher priority (lower integer value) // streams are always given precedence over lower priority (higher value) // streams, as long as the higher priority stream is not blocked. // // Each stream can be in one of two states: ready or not ready (for writing). // Ready state is changed by calling the MarkStreamReady() and // MarkStreamNotReady() methods. Only streams in the ready state can be returned // by PopNextReadyStream(). When returned by that method, the stream's state // changes to not ready. // template <typename StreamIdType, typename PriorityType = spdy::SpdyPriority, typename PriorityTypeToInt = SpdyPriorityToSpdyPriority, typename IntToPriorityType = SpdyPriorityToSpdyPriority> class QUICHE_EXPORT PriorityWriteScheduler { … }; } // namespace http2 #endif // QUICHE_HTTP2_CORE_PRIORITY_WRITE_SCHEDULER_H_