OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/quic_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 | 633 |
634 void QuicClientSession::CloseAllObservers(int net_error) { | 634 void QuicClientSession::CloseAllObservers(int net_error) { |
635 while (!observers_.empty()) { | 635 while (!observers_.empty()) { |
636 Observer* observer = *observers_.begin(); | 636 Observer* observer = *observers_.begin(); |
637 observers_.erase(observer); | 637 observers_.erase(observer); |
638 observer->OnSessionClosed(net_error); | 638 observer->OnSessionClosed(net_error); |
639 } | 639 } |
640 } | 640 } |
641 | 641 |
642 base::Value* QuicClientSession::GetInfoAsValue( | 642 base::Value* QuicClientSession::GetInfoAsValue( |
643 const std::set<HostPortPair>& aliases) const { | 643 const std::set<HostPortPair>& aliases) { |
644 base::DictionaryValue* dict = new base::DictionaryValue(); | 644 base::DictionaryValue* dict = new base::DictionaryValue(); |
645 // TODO(rch): remove "host_port_pair" when Chrome 34 is stable. | 645 // TODO(rch): remove "host_port_pair" when Chrome 34 is stable. |
646 dict->SetString("host_port_pair", aliases.begin()->ToString()); | 646 dict->SetString("host_port_pair", aliases.begin()->ToString()); |
647 dict->SetString("version", QuicVersionToString(connection()->version())); | 647 dict->SetString("version", QuicVersionToString(connection()->version())); |
648 dict->SetInteger("open_streams", GetNumOpenStreams()); | 648 dict->SetInteger("open_streams", GetNumOpenStreams()); |
| 649 base::ListValue* stream_list = new base::ListValue(); |
| 650 for (base::hash_map<QuicStreamId, QuicDataStream*>::const_iterator it |
| 651 = streams()->begin(); |
| 652 it != streams()->end(); |
| 653 ++it) { |
| 654 stream_list->Append(new base::StringValue( |
| 655 base::Uint64ToString(it->second->id()))); |
| 656 } |
| 657 dict->Set("active_streams", stream_list); |
| 658 |
649 dict->SetInteger("total_streams", num_total_streams_); | 659 dict->SetInteger("total_streams", num_total_streams_); |
650 dict->SetString("peer_address", peer_address().ToString()); | 660 dict->SetString("peer_address", peer_address().ToString()); |
651 dict->SetString("connection_id", base::Uint64ToString(connection_id())); | 661 dict->SetString("connection_id", base::Uint64ToString(connection_id())); |
652 dict->SetBoolean("connected", connection()->connected()); | 662 dict->SetBoolean("connected", connection()->connected()); |
| 663 const QuicConnectionStats& stats = connection()->GetStats(); |
| 664 dict->SetInteger("packets_sent", stats.packets_sent); |
| 665 dict->SetInteger("packets_received", stats.packets_received); |
| 666 dict->SetInteger("packets_lost", stats.packets_lost); |
653 SSLInfo ssl_info; | 667 SSLInfo ssl_info; |
654 dict->SetBoolean("secure", GetSSLInfo(&ssl_info) && ssl_info.cert); | 668 dict->SetBoolean("secure", GetSSLInfo(&ssl_info) && ssl_info.cert); |
655 | 669 |
656 base::ListValue* alias_list = new base::ListValue(); | 670 base::ListValue* alias_list = new base::ListValue(); |
657 for (std::set<HostPortPair>::const_iterator it = aliases.begin(); | 671 for (std::set<HostPortPair>::const_iterator it = aliases.begin(); |
658 it != aliases.end(); it++) { | 672 it != aliases.end(); it++) { |
659 alias_list->Append(new base::StringValue(it->ToString())); | 673 alias_list->Append(new base::StringValue(it->ToString())); |
660 } | 674 } |
661 dict->Set("aliases", alias_list); | 675 dict->Set("aliases", alias_list); |
662 | 676 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 RecordUnexpectedNotGoingAway(NOTIFY_FACTORY_OF_SESSION_CLOSED); | 742 RecordUnexpectedNotGoingAway(NOTIFY_FACTORY_OF_SESSION_CLOSED); |
729 | 743 |
730 going_away_ = true; | 744 going_away_ = true; |
731 DCHECK_EQ(0u, GetNumOpenStreams()); | 745 DCHECK_EQ(0u, GetNumOpenStreams()); |
732 // Will delete |this|. | 746 // Will delete |this|. |
733 if (stream_factory_) | 747 if (stream_factory_) |
734 stream_factory_->OnSessionClosed(this); | 748 stream_factory_->OnSessionClosed(this); |
735 } | 749 } |
736 | 750 |
737 } // namespace net | 751 } // namespace net |
OLD | NEW |