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

Unified Diff: net/socket/socks5_client_socket.cc

Issue 344026: Add LoadLog to ClientSocket::Connect(). (Closed)
Patch Set: Minor build fixups and fixed mac bug. Created 11 years, 1 month 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/socks5_client_socket.h ('k') | net/socket/socks5_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socks5_client_socket.cc
diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc
index cc12a3c4948329e5ff472252c4559009a4f79436..ef3e9d0a8d91b00533ce8931eee7bf3147965dbb 100644
--- a/net/socket/socks5_client_socket.cc
+++ b/net/socket/socks5_client_socket.cc
@@ -14,6 +14,7 @@
#include "base/compiler_specific.h"
#include "base/trace_event.h"
#include "net/base/io_buffer.h"
+#include "net/base/load_log.h"
#include "net/base/net_util.h"
namespace net {
@@ -49,7 +50,8 @@ SOCKS5ClientSocket::~SOCKS5ClientSocket() {
Disconnect();
}
-int SOCKS5ClientSocket::Connect(CompletionCallback* callback) {
+int SOCKS5ClientSocket::Connect(CompletionCallback* callback,
+ LoadLog* load_log) {
DCHECK(transport_.get());
DCHECK(transport_->IsConnected());
DCHECK_EQ(STATE_NONE, next_state_);
@@ -60,10 +62,17 @@ int SOCKS5ClientSocket::Connect(CompletionCallback* callback) {
return OK;
next_state_ = STATE_RESOLVE_HOST;
+ load_log_ = load_log;
+
+ LoadLog::BeginEvent(load_log, LoadLog::TYPE_SOCKS5_CONNECT);
int rv = DoLoop(OK);
- if (rv == ERR_IO_PENDING)
+ if (rv == ERR_IO_PENDING) {
user_callback_ = callback;
+ } else {
+ LoadLog::EndEvent(load_log, LoadLog::TYPE_SOCKS5_CONNECT);
+ load_log_ = NULL;
+ }
return rv;
}
@@ -125,8 +134,11 @@ void SOCKS5ClientSocket::DoCallback(int result) {
void SOCKS5ClientSocket::OnIOComplete(int result) {
DCHECK_NE(STATE_NONE, next_state_);
int rv = DoLoop(result);
- if (rv != ERR_IO_PENDING)
+ if (rv != ERR_IO_PENDING) {
+ LoadLog::EndEvent(load_log_, LoadLog::TYPE_SOCKS5_CONNECT);
+ load_log_ = NULL;
DoCallback(rv);
+ }
}
int SOCKS5ClientSocket::DoLoop(int last_io_result) {
@@ -185,7 +197,7 @@ int SOCKS5ClientSocket::DoResolveHost() {
next_state_ = STATE_RESOLVE_HOST_COMPLETE;
return host_resolver_.Resolve(
- host_request_info_, &addresses_, &io_callback_, NULL);
+ host_request_info_, &addresses_, &io_callback_, load_log_);
}
int SOCKS5ClientSocket::DoResolveHostComplete(int result) {
« no previous file with comments | « net/socket/socks5_client_socket.h ('k') | net/socket/socks5_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698