diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-12 20:32:44 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-12 20:32:44 +0000 |
commit | 1ce7b66b8e871fb39633e8dc7547a649f6d60b53 (patch) | |
tree | ef72863fccd02a85a6ae864372bf75ba57d71f9b /net | |
parent | 0834a4b75e40256a08e4a0b1bacab2e8b69da665 (diff) | |
download | chromium_src-1ce7b66b8e871fb39633e8dc7547a649f6d60b53.zip chromium_src-1ce7b66b8e871fb39633e8dc7547a649f6d60b53.tar.gz chromium_src-1ce7b66b8e871fb39633e8dc7547a649f6d60b53.tar.bz2 |
Render SpdySessionPools on the Data tab and on a new
net-internals tab, with links to the corresponding sources on
the events tab.
Includes a minor cleanup or two relating to unneeded/unused code/headers for the rendering of SocketPools.
BUG=58034
TEST=manual
Review URL: http://codereview.chromium.org/3565015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/net_log.cc | 11 | ||||
-rw-r--r-- | net/base/net_log.h | 4 | ||||
-rw-r--r-- | net/http/http_network_session.cc | 4 | ||||
-rw-r--r-- | net/http/http_network_session.h | 4 | ||||
-rw-r--r-- | net/socket/client_socket_pool_manager.cc | 1 | ||||
-rw-r--r-- | net/spdy/spdy_session.cc | 30 | ||||
-rw-r--r-- | net/spdy/spdy_session.h | 4 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.cc | 16 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.h | 4 |
9 files changed, 73 insertions, 5 deletions
diff --git a/net/base/net_log.cc b/net/base/net_log.cc index 2cc149f..f9f31c7 100644 --- a/net/base/net_log.cc +++ b/net/base/net_log.cc @@ -19,6 +19,12 @@ Value* NetLog::Source::ToValue() const { } // static +std::string NetLog::TickCountToString(const base::TimeTicks& time) { + int64 delta_time = (time - base::TimeTicks()).InMilliseconds(); + return base::Int64ToString(delta_time); +} + +// static const char* NetLog::EventTypeToString(EventType event) { switch (event) { #define EVENT_TYPE(label) case TYPE_ ## label: return #label; @@ -71,10 +77,7 @@ Value* NetLog::EntryToDictionaryValue(net::NetLog::EventType type, bool use_strings) { DictionaryValue* entry_dict = new DictionaryValue(); - // Set the entry time. (Note that we send it as a string since integers - // might overflow). - int64 delta_time = (time - base::TimeTicks()).InMilliseconds(); - entry_dict->SetString("time", base::Int64ToString(delta_time)); + entry_dict->SetString("time", TickCountToString(time)); // Set the entry source. DictionaryValue* source_dict = new DictionaryValue(); diff --git a/net/base/net_log.h b/net/base/net_log.h index c97eb1a..f240105 100644 --- a/net/base/net_log.h +++ b/net/base/net_log.h @@ -130,6 +130,10 @@ class NetLog { // and saving expensive log entries. virtual LogLevel GetLogLevel() const = 0; + // Converts a time to the string format that the NetLog uses to represent + // times. Strings are used since integers may overflow. + static std::string TickCountToString(const base::TimeTicks& time); + // Returns a C-String symbolic name for |event_type|. static const char* EventTypeToString(EventType event_type); diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index 4613629..056feaf 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -64,4 +64,8 @@ void HttpNetworkSession::RemoveResponseDrainer( response_drainers_.erase(drainer); } +Value* HttpNetworkSession::SpdySessionPoolInfoToValue() const { + return spdy_session_pool_->SpdySessionPoolInfoToValue(); +} + } // namespace net diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 0cfe08f..e23ecd6 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -126,6 +126,10 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>, return socket_pool_manager_.SocketPoolInfoToValue(); } + // Creates a Value summary of the state of the SPDY sessions. The caller is + // responsible for deleting the returned value. + Value* SpdySessionPoolInfoToValue() const; + void FlushSocketPools() { socket_pool_manager_.FlushSocketPools(); } diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket_pool_manager.cc index 264cdf8..0fca83d 100644 --- a/net/socket/client_socket_pool_manager.cc +++ b/net/socket/client_socket_pool_manager.cc @@ -41,7 +41,6 @@ static void AddSocketPoolsToList(ListValue* list, const MapType& socket_pools, const std::string& type, bool include_nested_pools) { - typename MapType::const_iterator socket_pool_it = socket_pools.begin(); for (typename MapType::const_iterator it = socket_pools.begin(); it != socket_pools.end(); it++) { list->Append(it->second->GetInfoAsValue(it->first.ToString(), diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index a360c52..d0ebff9 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -839,6 +839,36 @@ void SpdySession::CloseSessionOnError(net::Error err, bool remove_from_pool) { } } +Value* SpdySession::GetInfoAsValue() const { + DictionaryValue* dict = new DictionaryValue(); + + dict->SetInteger("source_id", net_log_.source().id); + + dict->SetString("host_port_pair", host_port_proxy_pair_.first.ToString()); + dict->SetString("proxy", host_port_proxy_pair_.second.ToURI()); + + dict->SetInteger("active_streams", active_streams_.size()); + + dict->SetInteger("unclaimed_pushed_streams", + unclaimed_pushed_streams_.size()); + + dict->SetBoolean("is_secure", is_secure_); + + dict->SetInteger("error", error_); + dict->SetInteger("max_concurrent_streams", max_concurrent_streams_); + + dict->SetInteger("streams_initiated_count", streams_initiated_count_); + dict->SetInteger("streams_pushed_count", streams_pushed_count_); + dict->SetInteger("streams_pushed_and_claimed_count", + streams_pushed_and_claimed_count_); + dict->SetInteger("streams_abandoned_count", streams_abandoned_count_); + dict->SetInteger("frames_received", frames_received_); + + dict->SetBoolean("sent_settings", sent_settings_); + dict->SetBoolean("received_settings", received_settings_); + return dict; +} + void SpdySession::ActivateStream(SpdyStream* stream) { const spdy::SpdyStreamId id = stream->stream_id(); DCHECK(!IsStreamActive(id)); diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index de5f0e2..f90907d 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -155,6 +155,10 @@ class SpdySession : public base::RefCounted<SpdySession>, // session pool. void CloseSessionOnError(net::Error err, bool remove_from_pool); + // Retrieves information on the current state of the SPDY session as a + // Value. Caller takes possession of the returned value. + Value* GetInfoAsValue() const; + // Indicates whether the session is being reused after having successfully // used to send/receive data in the past. bool IsReused() const { diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index 086fa9f..fe2a310 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -5,6 +5,7 @@ #include "net/spdy/spdy_session_pool.h" #include "base/logging.h" +#include "base/values.h" #include "net/http/http_network_session.h" #include "net/spdy/spdy_session.h" @@ -109,6 +110,21 @@ void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) { RemoveSessionList(session->host_port_proxy_pair()); } +Value* SpdySessionPool::SpdySessionPoolInfoToValue() { + ListValue* list = new ListValue(); + + SpdySessionsMap::const_iterator spdy_session_pool_it = sessions_.begin(); + for (SpdySessionsMap::const_iterator it = sessions_.begin(); + it != sessions_.end(); it++) { + SpdySessionList* sessions = it->second; + for (SpdySessionList::const_iterator session = sessions->begin(); + session != sessions->end(); session++) { + list->Append(session->get()->GetInfoAsValue()); + } + } + return list; +} + void SpdySessionPool::OnIPAddressChanged() { CloseCurrentSessions(); } diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index 49f9e45..6b346f6 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h @@ -88,6 +88,10 @@ class SpdySessionPool // by SpdySession, because otherwise session->state_ is not set to CLOSED. void Remove(const scoped_refptr<SpdySession>& session); + // Creates a Value summary of the state of the spdy session pool. The caller + // responsible for deleting the returned value. + Value* SpdySessionPoolInfoToValue(); + // NetworkChangeNotifier::Observer methods: // We flush all idle sessions and release references to the active ones so |