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

Unified Diff: net/tools/quic/quic_simple_client.h

Issue 1009803003: Factor out the QUIC socket reading code into a stand alone QuicPacketReader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more export Created 5 years, 9 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/quic_packet_reader.cc ('k') | net/tools/quic/quic_simple_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_simple_client.h
diff --git a/net/tools/quic/quic_simple_client.h b/net/tools/quic/quic_simple_client.h
index 0bab4e452c1940accd8b7c23e5bdaed7ec5bc886..b44e693cba360d1b759c171035a50e3e0e895f13 100644
--- a/net/tools/quic/quic_simple_client.h
+++ b/net/tools/quic/quic_simple_client.h
@@ -22,6 +22,7 @@
#include "net/quic/quic_config.h"
#include "net/quic/quic_framer.h"
#include "net/quic/quic_packet_creator.h"
+#include "net/quic/quic_packet_reader.h"
#include "net/tools/quic/quic_simple_client_session.h"
#include "net/tools/quic/quic_simple_client_stream.h"
@@ -39,7 +40,8 @@ namespace test {
class QuicClientPeer;
} // namespace test
-class QuicSimpleClient : public QuicDataStream::Visitor {
+class QuicSimpleClient : public QuicDataStream::Visitor,
+ public QuicPacketReader::Visitor {
public:
class ResponseListener {
public:
@@ -113,12 +115,11 @@ class QuicSimpleClient : public QuicDataStream::Visitor {
// Returns true if there are any outstanding requests.
bool WaitForEvents();
- // Start the read loop on the socket.
- void StartReading();
-
- // Called on reads that complete asynchronously. Dispatches the packet and
- // calls StartReading() again.
- void OnReadComplete(int result);
+ // QuicPacketReader::Visitor
+ void OnReadError(int result) override;
+ bool OnPacket(const QuicEncryptedPacket& packet,
+ IPEndPoint local_address,
+ IPEndPoint peer_address) override;
// QuicDataStream::Visitor
void OnClose(QuicDataStream* stream) override;
@@ -278,18 +279,11 @@ class QuicSimpleClient : public QuicDataStream::Visitor {
// Body of most recent response.
std::string latest_response_body_;
- bool read_pending_;
-
- // The number of iterations of the read loop that have completed synchronously
- // and without posting a new task to the message loop.
- int synchronous_read_count_;
-
- // The target buffer of the current read.
- scoped_refptr<IOBufferWithSize> read_buffer_;
-
// The log used for the sockets.
NetLog net_log_;
+ scoped_ptr<QuicPacketReader> packet_reader_;
+
base::WeakPtrFactory<QuicSimpleClient> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(QuicSimpleClient);
« no previous file with comments | « net/quic/quic_packet_reader.cc ('k') | net/tools/quic/quic_simple_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698