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

Side by Side Diff: net/quic/quic_client_session.cc

Issue 1149763005: Change NetLog::ParametersCallback to return a scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments on ownership removed Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/quic/quic_connection_logger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 STATE_HANDSHAKE_CONFIRMED = 2, 89 STATE_HANDSHAKE_CONFIRMED = 2,
90 STATE_FAILED = 3, 90 STATE_FAILED = 3,
91 NUM_HANDSHAKE_STATES = 4 91 NUM_HANDSHAKE_STATES = 4
92 }; 92 };
93 93
94 void RecordHandshakeState(HandshakeState state) { 94 void RecordHandshakeState(HandshakeState state) {
95 UMA_HISTOGRAM_ENUMERATION("Net.QuicHandshakeState", state, 95 UMA_HISTOGRAM_ENUMERATION("Net.QuicHandshakeState", state,
96 NUM_HANDSHAKE_STATES); 96 NUM_HANDSHAKE_STATES);
97 } 97 }
98 98
99 base::Value* NetLogQuicClientSessionCallback( 99 scoped_ptr<base::Value> NetLogQuicClientSessionCallback(
100 const QuicServerId* server_id, 100 const QuicServerId* server_id,
101 bool require_confirmation, 101 bool require_confirmation,
102 NetLogCaptureMode /* capture_mode */) { 102 NetLogCaptureMode /* capture_mode */) {
103 base::DictionaryValue* dict = new base::DictionaryValue(); 103 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
104 dict->SetString("host", server_id->host()); 104 dict->SetString("host", server_id->host());
105 dict->SetInteger("port", server_id->port()); 105 dict->SetInteger("port", server_id->port());
106 dict->SetBoolean("is_https", server_id->is_https()); 106 dict->SetBoolean("is_https", server_id->is_https());
107 dict->SetBoolean("privacy_mode", 107 dict->SetBoolean("privacy_mode",
108 server_id->privacy_mode() == PRIVACY_MODE_ENABLED); 108 server_id->privacy_mode() == PRIVACY_MODE_ENABLED);
109 dict->SetBoolean("require_confirmation", require_confirmation); 109 dict->SetBoolean("require_confirmation", require_confirmation);
110 return dict; 110 return dict.Pass();
111 } 111 }
112 112
113 } // namespace 113 } // namespace
114 114
115 QuicClientSession::StreamRequest::StreamRequest() : stream_(nullptr) {} 115 QuicClientSession::StreamRequest::StreamRequest() : stream_(nullptr) {}
116 116
117 QuicClientSession::StreamRequest::~StreamRequest() { 117 QuicClientSession::StreamRequest::~StreamRequest() {
118 CancelRequest(); 118 CancelRequest();
119 } 119 }
120 120
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 void QuicClientSession::CloseAllObservers(int net_error) { 825 void QuicClientSession::CloseAllObservers(int net_error) {
826 while (!observers_.empty()) { 826 while (!observers_.empty()) {
827 Observer* observer = *observers_.begin(); 827 Observer* observer = *observers_.begin();
828 observers_.erase(observer); 828 observers_.erase(observer);
829 observer->OnSessionClosed(net_error); 829 observer->OnSessionClosed(net_error);
830 } 830 }
831 } 831 }
832 832
833 base::Value* QuicClientSession::GetInfoAsValue( 833 base::Value* QuicClientSession::GetInfoAsValue(
834 const std::set<HostPortPair>& aliases) { 834 const std::set<HostPortPair>& aliases) {
835 base::DictionaryValue* dict = new base::DictionaryValue(); 835 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
836 dict->SetString("version", QuicVersionToString(connection()->version())); 836 dict->SetString("version", QuicVersionToString(connection()->version()));
837 dict->SetInteger("open_streams", GetNumOpenStreams()); 837 dict->SetInteger("open_streams", GetNumOpenStreams());
838 base::ListValue* stream_list = new base::ListValue(); 838 base::ListValue* stream_list = new base::ListValue();
839 for (base::hash_map<QuicStreamId, QuicDataStream*>::const_iterator it 839 for (base::hash_map<QuicStreamId, QuicDataStream*>::const_iterator it
840 = streams()->begin(); 840 = streams()->begin();
841 it != streams()->end(); 841 it != streams()->end();
842 ++it) { 842 ++it) {
843 stream_list->Append(new base::StringValue( 843 stream_list->Append(new base::StringValue(
844 base::Uint64ToString(it->second->id()))); 844 base::Uint64ToString(it->second->id())));
845 } 845 }
(...skipping 10 matching lines...) Expand all
856 SSLInfo ssl_info; 856 SSLInfo ssl_info;
857 dict->SetBoolean("secure", GetSSLInfo(&ssl_info) && ssl_info.cert.get()); 857 dict->SetBoolean("secure", GetSSLInfo(&ssl_info) && ssl_info.cert.get());
858 858
859 base::ListValue* alias_list = new base::ListValue(); 859 base::ListValue* alias_list = new base::ListValue();
860 for (std::set<HostPortPair>::const_iterator it = aliases.begin(); 860 for (std::set<HostPortPair>::const_iterator it = aliases.begin();
861 it != aliases.end(); it++) { 861 it != aliases.end(); it++) {
862 alias_list->Append(new base::StringValue(it->ToString())); 862 alias_list->Append(new base::StringValue(it->ToString()));
863 } 863 }
864 dict->Set("aliases", alias_list); 864 dict->Set("aliases", alias_list);
865 865
866 return dict; 866 return dict.release();
867 } 867 }
868 868
869 base::WeakPtr<QuicClientSession> QuicClientSession::GetWeakPtr() { 869 base::WeakPtr<QuicClientSession> QuicClientSession::GetWeakPtr() {
870 return weak_factory_.GetWeakPtr(); 870 return weak_factory_.GetWeakPtr();
871 } 871 }
872 872
873 void QuicClientSession::OnReadError(int result) { 873 void QuicClientSession::OnReadError(int result) {
874 DVLOG(1) << "Closing session on read error: " << result; 874 DVLOG(1) << "Closing session on read error: " << result;
875 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ReadError", -result); 875 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ReadError", -result);
876 NotifyFactoryOfSessionGoingAway(); 876 NotifyFactoryOfSessionGoingAway();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 return; 933 return;
934 934
935 // TODO(rch): re-enable this code once beta is cut. 935 // TODO(rch): re-enable this code once beta is cut.
936 // if (stream_factory_) 936 // if (stream_factory_)
937 // stream_factory_->OnSessionConnectTimeout(this); 937 // stream_factory_->OnSessionConnectTimeout(this);
938 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); 938 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED);
939 // DCHECK_EQ(0u, GetNumOpenStreams()); 939 // DCHECK_EQ(0u, GetNumOpenStreams());
940 } 940 }
941 941
942 } // namespace net 942 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/quic/quic_connection_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698