Index: net/quic/quic_client_session.cc |
diff --git a/net/quic/quic_client_session.cc b/net/quic/quic_client_session.cc |
index 90b44e531db8ee9df5d05711575e8c44cdc9b4c4..d26ee8d67168cc025d8e8e8798f67229853db8bd 100644 |
--- a/net/quic/quic_client_session.cc |
+++ b/net/quic/quic_client_session.cc |
@@ -16,20 +16,46 @@ |
namespace net { |
+namespace { |
+ |
+Value* NetLogQuicSessionCallback(const std::string& host, |
eroman
2013/02/05 23:17:30
Unless you expect to grow this in the future, you
Ryan Hamilton
2013/02/05 23:35:29
Done. It'll probably grow in the future, but this
|
+ NetLog::LogLevel /* log_level */) { |
+ DictionaryValue* dict = new DictionaryValue(); |
+ dict->SetString("host", host); |
+ return dict; |
+} |
+ |
+Value* NetLogQuicSessionCloseOnErrorCallback(int error, |
eroman
2013/02/05 23:17:30
Unless you expect to grow this in the future, you
Ryan Hamilton
2013/02/05 23:35:29
Done.
|
+ NetLog::LogLevel /* log_level */) { |
+ DictionaryValue* dict = new DictionaryValue(); |
+ dict->SetInteger("error", error); |
+ return dict; |
+} |
+ |
+} // namespace |
+ |
QuicClientSession::QuicClientSession(QuicConnection* connection, |
QuicConnectionHelper* helper, |
QuicStreamFactory* stream_factory, |
- const string& server_hostname) |
+ const string& server_hostname, |
+ NetLog* net_log) |
: QuicSession(connection, false), |
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
ALLOW_THIS_IN_INITIALIZER_LIST(crypto_stream_(this, server_hostname)), |
helper_(helper), |
stream_factory_(stream_factory), |
read_buffer_(new IOBufferWithSize(kMaxPacketSize)), |
- read_pending_(false) { |
+ read_pending_(false), |
+ num_total_streams_(0), |
+ net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)) { |
+ // TODO(rch): pass in full host port proxy pair |
+ net_log_.BeginEvent( |
+ NetLog::TYPE_QUIC_SESSION, |
+ base::Bind(&NetLogQuicSessionCallback, server_hostname)); |
} |
QuicClientSession::~QuicClientSession() { |
+ net_log_.EndEvent(NetLog::TYPE_QUIC_SESSION); |
} |
QuicReliableClientStream* QuicClientSession::CreateOutgoingReliableStream() { |
@@ -43,8 +69,9 @@ QuicReliableClientStream* QuicClientSession::CreateOutgoingReliableStream() { |
return NULL; |
} |
QuicReliableClientStream* stream = |
- new QuicReliableClientStream(GetNextStreamId(), this); |
+ new QuicReliableClientStream(GetNextStreamId(), this, net_log_); |
ActivateStream(stream); |
+ ++num_total_streams_; |
return stream; |
} |
@@ -116,12 +143,16 @@ void QuicClientSession::CloseSessionOnError(int error) { |
CloseStream(id); |
} |
stream_factory_->OnSessionClose(this); |
+ net_log_.BeginEvent( |
+ NetLog::TYPE_QUIC_SESSION, |
+ base::Bind(&NetLogQuicSessionCloseOnErrorCallback, error)); |
} |
Value* QuicClientSession::GetInfoAsValue(const HostPortPair& pair) const { |
DictionaryValue* dict = new DictionaryValue(); |
dict->SetString("host_port_pair", pair.ToString()); |
dict->SetInteger("open_streams", GetNumOpenStreams()); |
+ dict->SetInteger("total_streams", num_total_streams_); |
dict->SetString("peer_address", peer_address().ToString()); |
dict->SetString("guid", base::Uint64ToString(guid())); |
return dict; |