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

Unified Diff: net/socket/tcp_client_socket_pool.cc

Issue 176024: Make GetLoadState virtual in ConnectJob(). (Closed)
Patch Set: Created 11 years, 4 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/tcp_client_socket_pool.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_client_socket_pool.cc
diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc
index 77a5fadc59f12ae623fff1e1bef1ff8f6771c3fa..b38d5b52f65e252b9ec30ea83db845ae2b86bc15 100644
--- a/net/socket/tcp_client_socket_pool.cc
+++ b/net/socket/tcp_client_socket_pool.cc
@@ -44,6 +44,20 @@ TCPConnectJob::~TCPConnectJob() {
// ~SingleRequestHostResolver and ~ClientSocket will take care of it.
}
+LoadState TCPConnectJob::GetLoadState() const {
+ switch (next_state_) {
+ case kStateResolveHost:
+ case kStateResolveHostComplete:
+ return LOAD_STATE_RESOLVING_HOST;
+ case kStateTCPConnect:
+ case kStateTCPConnectComplete:
+ return LOAD_STATE_CONNECTING;
+ default:
+ NOTREACHED();
+ return LOAD_STATE_IDLE;
+ }
+}
+
int TCPConnectJob::ConnectInternal() {
next_state_ = kStateResolveHost;
return DoLoop(OK);
@@ -88,13 +102,11 @@ int TCPConnectJob::DoLoop(int result) {
}
int TCPConnectJob::DoResolveHost() {
- set_load_state(LOAD_STATE_RESOLVING_HOST);
next_state_ = kStateResolveHostComplete;
return resolver_.Resolve(resolve_info_, &addresses_, &callback_, load_log());
}
int TCPConnectJob::DoResolveHostComplete(int result) {
- DCHECK_EQ(LOAD_STATE_RESOLVING_HOST, load_state());
if (result == OK)
next_state_ = kStateTCPConnect;
return result;
@@ -102,7 +114,6 @@ int TCPConnectJob::DoResolveHostComplete(int result) {
int TCPConnectJob::DoTCPConnect() {
next_state_ = kStateTCPConnectComplete;
- set_load_state(LOAD_STATE_CONNECTING);
set_socket(client_socket_factory_->CreateTCPClientSocket(addresses_));
connect_start_time_ = base::TimeTicks::Now();
// TODO(eroman): Socket::Connect() should take a LoadLog.
@@ -110,7 +121,6 @@ int TCPConnectJob::DoTCPConnect() {
}
int TCPConnectJob::DoTCPConnectComplete(int result) {
- DCHECK_EQ(load_state(), LOAD_STATE_CONNECTING);
if (result == OK) {
DCHECK(connect_start_time_ != base::TimeTicks());
base::TimeDelta connect_duration =
« no previous file with comments | « net/socket/tcp_client_socket_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698