Created and integrated QuicIntervalDeque class for index management. Improves code readability.
gfe-relnote: Integrated QuicIntervalDeque class into QuicStreamSendBuffer affecting the QUIC GFE path. Protected by --gfe2_reloadable_flag_quic_interval_deque
PiperOrigin-RevId: 286471930
Change-Id: Ida91b6c7d066d9710d06932c9f4726946bfbd430
diff --git a/quic/test_tools/quic_interval_deque_peer.h b/quic/test_tools/quic_interval_deque_peer.h
new file mode 100644
index 0000000..e9a99ba
--- /dev/null
+++ b/quic/test_tools/quic_interval_deque_peer.h
@@ -0,0 +1,35 @@
+// Copyright 2019 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_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_
+#define QUICHE_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_
+
+#include "net/third_party/quiche/src/quic/core/quic_interval_deque.h"
+
+namespace quic {
+
+namespace test {
+
+class QuicIntervalDequePeer {
+ public:
+ template <class T, class C>
+ static int32_t GetCachedIndex(QuicIntervalDeque<T, C>* interval_deque) {
+ if (!interval_deque->cached_index_.has_value()) {
+ return -1;
+ }
+ return interval_deque->cached_index_.value();
+ }
+
+ template <class T, class C>
+ static T* GetItem(QuicIntervalDeque<T, C>* interval_deque,
+ const std::size_t index) {
+ return &interval_deque->container_[index];
+ }
+};
+
+} // namespace test
+
+} // namespace quic
+
+#endif // QUICHE_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_