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

Unified Diff: net/socket/socket_test_util.h

Issue 1494813002: Fix HttpStreamParser::CanReuseConnection(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add override Created 5 years 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/http/http_stream_parser.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_test_util.h
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index 430b5225331c4eaaefdf1cbe413c411d0b44268c..5a0b7e67f2f44aff88ec1b8bd06fad5d9c1c9e46 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -204,6 +204,10 @@ class SocketDataProvider {
virtual bool AllReadDataConsumed() const = 0;
virtual bool AllWriteDataConsumed() const = 0;
+ // Returns true if the request should be considered idle, for the purposes of
+ // IsConnectedAndIdle.
+ virtual bool IsIdle() const;
+
// Accessor for the socket which is using the SocketDataProvider.
AsyncSocket* socket() { return socket_; }
void set_socket(AsyncSocket* socket) { socket_ = socket; }
@@ -364,10 +368,18 @@ class SequencedSocketData : public SocketDataProvider {
void Reset() override;
bool AllReadDataConsumed() const override;
bool AllWriteDataConsumed() const override;
+ bool IsIdle() const override;
bool IsReadPaused();
void CompleteRead();
+ // When true, IsConnectedAndIdle() will return false if the next even in the
+ // sequence is a synchronous. Otherwise, the socket claims to be idle as
+ // long as it's connected. Defaults to false.
+ void set_busy_before_sync_reads(bool busy_before_sync_reads) {
asanka 2015/12/03 17:41:57 Perhaps not for this CL, but shouldn't this always
mmenke 2015/12/03 18:24:23 I was worried about breaking all existing synchron
+ busy_before_sync_reads_ = busy_before_sync_reads;
+ }
+
private:
// Defines the state for the read or write path.
enum IoState {
@@ -389,6 +401,8 @@ class SequencedSocketData : public SocketDataProvider {
IoState read_state_;
IoState write_state_;
+ bool busy_before_sync_reads_;
+
base::WeakPtrFactory<SequencedSocketData> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SequencedSocketData);
@@ -898,6 +912,7 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket {
int Connect(const CompletionCallback& callback) override;
void Disconnect() override;
bool IsConnected() const override;
+ bool IsConnectedAndIdle() const override;
bool WasEverUsed() const override;
bool UsingTCPFastOpen() const override;
int GetPeerAddress(IPEndPoint* address) const override;
« no previous file with comments | « net/http/http_stream_parser.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698