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

Unified Diff: net/quic/core/packet_number_indexed_queue.h

Issue 2901773004: Landing Recent QUIC changes until May 20, 2017. (Closed)
Patch Set: Disable quic_restart_flag_quic_big_endian_connection_id_server until tests can be fixed. Created 3 years, 7 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/quic/core/congestion_control/bbr_sender.cc ('k') | net/quic/core/packet_number_indexed_queue_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/packet_number_indexed_queue.h
diff --git a/net/quic/core/packet_number_indexed_queue.h b/net/quic/core/packet_number_indexed_queue.h
index 677b97102aae582a4370a6b0c383bce57eefada9..84388c2cbbab58d569d15a39af658501aa15fd18 100644
--- a/net/quic/core/packet_number_indexed_queue.h
+++ b/net/quic/core/packet_number_indexed_queue.h
@@ -42,6 +42,7 @@ class PacketNumberIndexedQueue {
// Retrieve the entry associated with the packet number. Returns the pointer
// to the entry in case of success, or nullptr if the entry does not exist.
T* GetEntry(QuicPacketNumber packet_number);
+ const T* GetEntry(QuicPacketNumber packet_number) const;
// Inserts data associated |packet_number| into (or past) the end of the
// queue, filling up the missing intermediate entries as necessary. Returns
@@ -94,7 +95,11 @@ class PacketNumberIndexedQueue {
// Cleans up unused slots in the front after removing an element.
void Cleanup();
- EntryWrapper* GetEntryWrapper(QuicPacketNumber offset);
+ const EntryWrapper* GetEntryWrapper(QuicPacketNumber offset) const;
+ EntryWrapper* GetEntryWrapper(QuicPacketNumber offset) {
+ const auto* const_this = this;
+ return const_cast<EntryWrapper*>(const_this->GetEntryWrapper(offset));
+ }
std::deque<EntryWrapper> entries_;
size_t number_of_present_entries_;
@@ -111,6 +116,16 @@ T* PacketNumberIndexedQueue<T>::GetEntry(QuicPacketNumber packet_number) {
}
template <typename T>
+const T* PacketNumberIndexedQueue<T>::GetEntry(
+ QuicPacketNumber packet_number) const {
+ const EntryWrapper* entry = GetEntryWrapper(packet_number);
+ if (entry == nullptr) {
+ return nullptr;
+ }
+ return &entry->data;
+}
+
+template <typename T>
template <typename... Args>
bool PacketNumberIndexedQueue<T>::Emplace(QuicPacketNumber packet_number,
Args&&... args) {
@@ -168,8 +183,8 @@ void PacketNumberIndexedQueue<T>::Cleanup() {
}
template <typename T>
-auto PacketNumberIndexedQueue<T>::GetEntryWrapper(QuicPacketNumber offset)
- -> EntryWrapper* {
+auto PacketNumberIndexedQueue<T>::GetEntryWrapper(QuicPacketNumber offset) const
+ -> const EntryWrapper* {
if (offset < first_packet_) {
return nullptr;
}
@@ -179,7 +194,7 @@ auto PacketNumberIndexedQueue<T>::GetEntryWrapper(QuicPacketNumber offset)
return nullptr;
}
- EntryWrapper* entry = &entries_[offset];
+ const EntryWrapper* entry = &entries_[offset];
if (!entry->present) {
return nullptr;
}
« no previous file with comments | « net/quic/core/congestion_control/bbr_sender.cc ('k') | net/quic/core/packet_number_indexed_queue_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698