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

Unified Diff: net/socket/tcp_client_socket_pool.h

Issue 151118: Refactor ConnectJob and TCPConnectJob. (Closed)
Patch Set: Add comments. Created 11 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/socket/client_socket_pool_base_unittest.cc ('k') | net/socket/tcp_client_socket_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_client_socket_pool.h
diff --git a/net/socket/tcp_client_socket_pool.h b/net/socket/tcp_client_socket_pool.h
index 4bbb9ba5bbab153ab458b360abdebbc03a4e98d5..33c38bbdfba173543e8d9ab502402159829bf1ca 100644
--- a/net/socket/tcp_client_socket_pool.h
+++ b/net/socket/tcp_client_socket_pool.h
@@ -37,26 +37,30 @@ class TCPConnectJob : public ConnectJob {
virtual int Connect();
private:
- // Handles asynchronous completion of IO. |result| represents the result of
- // the IO operation.
+ enum State {
+ kStateResolveHost,
+ kStateResolveHostComplete,
+ kStateTCPConnect,
+ kStateTCPConnectComplete,
+ kStateNone,
+ };
+
void OnIOComplete(int result);
- // Handles both asynchronous and synchronous completion of IO. |result|
- // represents the result of the IO operation. |synchronous| indicates
- // whether or not the previous IO operation completed synchronously or
- // asynchronously. OnIOCompleteInternal returns the result of the next IO
- // operation that executes, or just the value of |result|.
- int OnIOCompleteInternal(int result, bool synchronous);
+ // Runs the state transition loop.
+ int DoLoop(int result);
+
+ int DoResolveHost();
+ int DoResolveHostComplete(int result);
+ int DoTCPConnect();
+ int DoTCPConnectComplete(int result);
- const std::string group_name_;
const HostResolver::RequestInfo resolve_info_;
- const ClientSocketHandle* const handle_;
ClientSocketFactory* const client_socket_factory_;
CompletionCallbackImpl<TCPConnectJob> callback_;
- scoped_ptr<ClientSocket> socket_;
- Delegate* const delegate_;
SingleRequestHostResolver resolver_;
AddressList addresses_;
+ State next_state_;
// The time the Connect() method was called (if it got called).
base::TimeTicks connect_start_time_;
« no previous file with comments | « net/socket/client_socket_pool_base_unittest.cc ('k') | net/socket/tcp_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698