diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-03 00:49:17 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-03 00:49:17 +0000 |
commit | 06650c582f9cfcf3869c490f3dc1ca224d6c9963 (patch) | |
tree | b6585569ec02f0bec32aa65b6e36b3cbf8a8533f /net/socket/client_socket_pool_base.h | |
parent | cb364d78210e5d64f3c899bbfa87dadebac7d6f7 (diff) | |
download | chromium_src-06650c582f9cfcf3869c490f3dc1ca224d6c9963.zip chromium_src-06650c582f9cfcf3869c490f3dc1ca224d6c9963.tar.gz chromium_src-06650c582f9cfcf3869c490f3dc1ca224d6c9963.tar.bz2 |
Rework the logging for sockets/connectjobs.
In particular, make it work better when using backup jobs / late binding (the display was very confused before because of how these asynchronous events would nest).
Also changed the paradigm for how PassiveLogCollector preserves these async associations -- this fixes how it replays the events to net-internals. (Before we would collapse the event streams into the SOURCE_URL_REQUEST which lost some hiearchy.. now I keep the separate streams).
Some of the particular changes to the event streams:
* ConnectJobs now create their own source stream internally.
* Sockets are now bounded by +SOCKET_ALIVE / -SOCKET_ALIVE events (removed the one-off SOCKET_DONE event).
* The socket log streams contains +SOCKET_IN_USE / -SOCKET_IN_USE event blocks to show which URLRequest was controlling it at various points in time (this makes it much easier to understand which read/writes belonged to a particular network transaction when a socket gets re-used).
* ConnectJobs are bounded by +SOCKET_POOL_CONNECT_JOB / - SOCKET_POOL_CONNECT_JOB events.
* ConnectJobs log the net error they failed with.
* Removed the SOCKET_BACKUP_TIMER_EXTENDED event.
Review URL: http://codereview.chromium.org/2363003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48797 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/client_socket_pool_base.h')
-rw-r--r-- | net/socket/client_socket_pool_base.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index db408a2..470c120 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -91,7 +91,7 @@ class ConnectJob { virtual LoadState GetLoadState() const = 0; protected: - void set_socket(ClientSocket* socket) { socket_.reset(socket); } + void set_socket(ClientSocket* socket); ClientSocket* socket() { return socket_.get(); } void NotifyDelegateOfCompletion(int rv); void ResetTimer(base::TimeDelta remainingTime); @@ -99,6 +99,9 @@ class ConnectJob { private: virtual int ConnectInternal() = 0; + void LogConnectStart(); + void LogConnectCompletion(int net_error); + // Alerts the delegate that the ConnectJob has timed out. void OnTimeout(); @@ -158,8 +161,7 @@ class ClientSocketPoolBaseHelper virtual ConnectJob* NewConnectJob( const std::string& group_name, const Request& request, - ConnectJob::Delegate* delegate, - const BoundNetLog& net_log) const = 0; + ConnectJob::Delegate* delegate) const = 0; virtual base::TimeDelta ConnectionTimeout() const = 0; @@ -231,7 +233,7 @@ class ClientSocketPoolBaseHelper return connect_job_factory_->ConnectionTimeout(); } - void enable_backup_jobs() { backup_jobs_enabled_ = true; }; + void enable_backup_jobs() { backup_jobs_enabled_ = true; } private: friend class base::RefCounted<ClientSocketPoolBaseHelper>; @@ -387,6 +389,9 @@ class ClientSocketPoolBaseHelper int RequestSocketInternal(const std::string& group_name, const Request* request); + static void LogBoundConnectJobToRequest( + const NetLog::Source& connect_job_source, const Request* request); + // Set a timer to create a backup socket if it takes too long to create one. void StartBackupSocketTimer(const std::string& group_name); @@ -486,8 +491,7 @@ class ClientSocketPoolBase { virtual ConnectJob* NewConnectJob( const std::string& group_name, const Request& request, - ConnectJob::Delegate* delegate, - const BoundNetLog& net_log) const = 0; + ConnectJob::Delegate* delegate) const = 0; virtual base::TimeDelta ConnectionTimeout() const = 0; @@ -580,7 +584,7 @@ class ClientSocketPoolBase { return histograms_; } - void enable_backup_jobs() { helper_->enable_backup_jobs(); }; + void enable_backup_jobs() { helper_->enable_backup_jobs(); } private: // This adaptor class exists to bridge the @@ -602,11 +606,10 @@ class ClientSocketPoolBase { virtual ConnectJob* NewConnectJob( const std::string& group_name, const internal::ClientSocketPoolBaseHelper::Request& request, - ConnectJob::Delegate* delegate, - const BoundNetLog& net_log) const { + ConnectJob::Delegate* delegate) const { const Request* casted_request = static_cast<const Request*>(&request); return connect_job_factory_->NewConnectJob( - group_name, *casted_request, delegate, net_log); + group_name, *casted_request, delegate); } virtual base::TimeDelta ConnectionTimeout() const { |