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

Unified Diff: net/http/http_network_transaction.cc

Issue 10534129: NetLogEventParameter to Callback refactoring 5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add back original URLs Created 8 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/http/http_cache_transaction.cc ('k') | net/http/http_pipelined_connection_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction.cc
===================================================================
--- net/http/http_network_transaction.cc (revision 141814)
+++ net/http/http_network_transaction.cc (working copy)
@@ -93,37 +93,19 @@
}
}
-class SSLVersionFallbackParams : public NetLog::EventParameters {
- public:
- SSLVersionFallbackParams(const std::string& host_and_port,
- int net_error,
- uint16 version_before,
- uint16 version_after)
- : host_and_port_(host_and_port),
- net_error_(net_error),
- version_before_(version_before),
- version_after_(version_after) {
- }
+Value* NetLogSSLVersionFallbackCallback(const GURL* url,
+ int net_error,
+ uint16 version_before,
+ uint16 version_after,
+ NetLog::LogLevel /* log_level */) {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString("host_and_port", GetHostAndPort(*url));
+ dict->SetInteger("net_error", net_error);
+ dict->SetInteger("version_before", version_before);
+ dict->SetInteger("version_after", version_after);
+ return dict;
+}
- virtual Value* ToValue() const {
- DictionaryValue* dict = new DictionaryValue();
- dict->SetString("host_and_port", host_and_port_);
- dict->SetInteger("net_error", net_error_);
- dict->SetInteger("version_before", version_before_);
- dict->SetInteger("version_after", version_after_);
- return dict;
- }
-
- protected:
- virtual ~SSLVersionFallbackParams() {}
-
- private:
- const std::string host_and_port_;
- const int net_error_; // Network error code that caused the fallback.
- const uint16 version_before_; // SSL version before the fallback.
- const uint16 version_after_; // SSL version after the fallback.
-};
-
} // namespace
//-----------------------------------------------------------------------------
@@ -554,7 +536,7 @@
break;
case STATE_BUILD_REQUEST:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, NULL);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST);
rv = DoBuildRequest();
break;
case STATE_BUILD_REQUEST_COMPLETE:
@@ -571,7 +553,7 @@
break;
case STATE_READ_HEADERS:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, NULL);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS);
rv = DoReadHeaders();
break;
case STATE_READ_HEADERS_COMPLETE:
@@ -581,7 +563,7 @@
break;
case STATE_READ_BODY:
DCHECK_EQ(OK, rv);
- net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, NULL);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_READ_BODY);
rv = DoReadBody();
break;
case STATE_READ_BODY_COMPLETE:
@@ -592,7 +574,7 @@
case STATE_DRAIN_BODY_FOR_AUTH_RESTART:
DCHECK_EQ(OK, rv);
net_log_.BeginEvent(
- NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART, NULL);
+ NetLog::TYPE_HTTP_TRANSACTION_DRAIN_BODY_FOR_AUTH_RESTART);
rv = DoDrainBodyForAuthRestart();
break;
case STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE:
@@ -1207,9 +1189,9 @@
server_ssl_config_.version_max--;
net_log_.AddEvent(
NetLog::TYPE_SSL_VERSION_FALLBACK,
- make_scoped_refptr(new SSLVersionFallbackParams(
- GetHostAndPort(request_->url), error,
- version_before, server_ssl_config_.version_max)));
+ base::Bind(&NetLogSSLVersionFallbackCallback,
+ &request_->url, error, version_before,
+ server_ssl_config_.version_max));
server_ssl_config_.version_fallback = true;
ResetConnectionAndRequestForResend();
error = OK;
@@ -1226,9 +1208,9 @@
server_ssl_config_.version_max = SSL_PROTOCOL_VERSION_SSL3;
net_log_.AddEvent(
NetLog::TYPE_SSL_VERSION_FALLBACK,
- make_scoped_refptr(new SSLVersionFallbackParams(
- GetHostAndPort(request_->url), error,
- version_before, server_ssl_config_.version_max)));
+ base::Bind(&NetLogSSLVersionFallbackCallback,
+ &request_->url, error, version_before,
+ server_ssl_config_.version_max));
server_ssl_config_.version_fallback = true;
ResetConnectionAndRequestForResend();
error = OK;
@@ -1268,27 +1250,24 @@
// See http://crbug.com/105824 for more details.
case ERR_SOCKET_NOT_CONNECTED:
if (ShouldResendRequest(error)) {
- net_log_.AddEvent(
- NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR,
- make_scoped_refptr(new NetLogIntegerParameter("net_error", error)));
+ net_log_.AddEventWithNetErrorCode(
+ NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR, error);
ResetConnectionAndRequestForResend();
error = OK;
}
break;
case ERR_PIPELINE_EVICTION:
if (!session_->force_http_pipelining()) {
- net_log_.AddEvent(
- NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR,
- make_scoped_refptr(new NetLogIntegerParameter("net_error", error)));
+ net_log_.AddEventWithNetErrorCode(
+ NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR, error);
ResetConnectionAndRequestForResend();
error = OK;
}
break;
case ERR_SPDY_PING_FAILED:
case ERR_SPDY_SERVER_REFUSED_STREAM:
- net_log_.AddEvent(
- NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR,
- make_scoped_refptr(new NetLogIntegerParameter("net_error", error)));
+ net_log_.AddEventWithNetErrorCode(
+ NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR, error);
ResetConnectionAndRequestForResend();
error = OK;
break;
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | net/http/http_pipelined_connection_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698