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

Unified Diff: net/socket/tcp_client_socket.h

Issue 2593063003: Add Socket::ReadIfReady() (Closed)
Patch Set: Fix tests for real Created 3 years, 11 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
Index: net/socket/tcp_client_socket.h
diff --git a/net/socket/tcp_client_socket.h b/net/socket/tcp_client_socket.h
index 65a51837103e87c272639820f5a23aca0bac1e7a..cc4ce6a975221a35cc89788effb8712312d44d62 100644
--- a/net/socket/tcp_client_socket.h
+++ b/net/socket/tcp_client_socket.h
@@ -68,6 +68,9 @@ class NET_EXPORT TCPClientSocket : public StreamSocket {
int Read(IOBuffer* buf,
int buf_len,
const CompletionCallback& callback) override;
+ int ReadIfReady(IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback) override;
int Write(IOBuffer* buf,
int buf_len,
const CompletionCallback& callback) override;
@@ -90,6 +93,14 @@ class NET_EXPORT TCPClientSocket : public StreamSocket {
CONNECT_STATE_NONE,
};
+ // A helper method shared by Read() and ReadIfReady().
+ // If |read_if_ready| is set to true, ReadIfReady() will be used instead of
+ // Read().
+ int ReadCommon(IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback,
+ bool read_if_ready);
+
// State machine used by Connect().
int DoConnectLoop(int result);
int DoConnect();

Powered by Google App Engine
This is Rietveld 408576698