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

Unified Diff: net/quic/test_tools/simple_data_producer.h

Issue 2963763003: In QUIC, send data is copied to streams rather than frames. Protected by FLAGS_quic_reloadable_flag… (Closed)
Patch Set: Rebase Created 3 years, 6 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/test_tools/quic_test_utils.cc ('k') | net/quic/test_tools/simple_data_producer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/simple_data_producer.h
diff --git a/net/quic/test_tools/simple_data_producer.h b/net/quic/test_tools/simple_data_producer.h
new file mode 100644
index 0000000000000000000000000000000000000000..c830cc10fd8727b6cf815cf149a717d465f29aef
--- /dev/null
+++ b/net/quic/test_tools/simple_data_producer.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2017 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_TEST_TOOLS_SIMPLE_DATA_PRODUCER_H_
+#define NET_QUIC_TEST_TOOLS_SIMPLE_DATA_PRODUCER_H_
+
+#include <unordered_map>
+
+#include "net/quic/core/quic_simple_buffer_allocator.h"
+#include "net/quic/core/quic_stream_frame_data_producer.h"
+#include "net/quic/core/quic_stream_send_buffer.h"
+
+namespace net {
+
+namespace test {
+
+// A simple data producer which copies stream data into a map from stream
+// id to send buffer.
+class SimpleDataProducer : public QuicStreamFrameDataProducer {
+ public:
+ SimpleDataProducer();
+ ~SimpleDataProducer() override;
+
+ // QuicStreamFrameDataProducer methods:
+ void SaveStreamData(QuicStreamId id,
+ QuicIOVector iov,
+ size_t iov_offset,
+ QuicStreamOffset offset,
+ QuicByteCount data_length) override;
+ bool WriteStreamData(QuicStreamId id,
+ QuicStreamOffset offset,
+ QuicByteCount data_length,
+ QuicDataWriter* writer) override;
+
+ private:
+ using SendBufferMap =
+ std::unordered_map<QuicStreamId, std::unique_ptr<QuicStreamSendBuffer>>;
+
+ SendBufferMap send_buffer_map_;
+
+ SimpleBufferAllocator allocator_;
+};
+
+} // namespace test
+
+} // namespace net
+
+#endif // NET_QUIC_TEST_TOOLS_SIMPLE_DATA_PRODUCER_H_
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/quic/test_tools/simple_data_producer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698