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

Unified Diff: net/socket/tcp_client_socket.h

Issue 2593063003: Add Socket::ReadIfReady() (Closed)
Patch Set: Rebased Created 3 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/socket/ssl_client_socket_unittest.cc ('k') | net/socket/tcp_client_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8981fb066f55c18dcae07fd2bcfef28668ef77b7 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,13 @@ 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();
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/socket/tcp_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698