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

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

Issue 218923002: Merge internal change: 63891842 - QuicServerId changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/quic/crypto/proof_verifier_chromium.h" 16 #include "net/quic/crypto/proof_verifier_chromium.h"
17 #include "net/quic/crypto/quic_server_info.h" 17 #include "net/quic/crypto/quic_server_info.h"
18 #include "net/quic/quic_connection_helper.h" 18 #include "net/quic/quic_connection_helper.h"
19 #include "net/quic/quic_crypto_client_stream_factory.h" 19 #include "net/quic/quic_crypto_client_stream_factory.h"
20 #include "net/quic/quic_default_packet_writer.h" 20 #include "net/quic/quic_default_packet_writer.h"
21 #include "net/quic/quic_session_key.h" 21 #include "net/quic/quic_server_id.h"
22 #include "net/quic/quic_stream_factory.h" 22 #include "net/quic/quic_stream_factory.h"
23 #include "net/ssl/ssl_connection_status_flags.h" 23 #include "net/ssl/ssl_connection_status_flags.h"
24 #include "net/ssl/ssl_info.h" 24 #include "net/ssl/ssl_info.h"
25 #include "net/udp/datagram_client_socket.h" 25 #include "net/udp/datagram_client_socket.h"
26 26
27 namespace net { 27 namespace net {
28 28
29 namespace { 29 namespace {
30 30
31 // Histograms for tracking down the crashes from http://crbug.com/354669 31 // Histograms for tracking down the crashes from http://crbug.com/354669
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ResetAndReturn(&callback_).Run(rv); 112 ResetAndReturn(&callback_).Run(rv);
113 } 113 }
114 114
115 QuicClientSession::QuicClientSession( 115 QuicClientSession::QuicClientSession(
116 QuicConnection* connection, 116 QuicConnection* connection,
117 scoped_ptr<DatagramClientSocket> socket, 117 scoped_ptr<DatagramClientSocket> socket,
118 scoped_ptr<QuicDefaultPacketWriter> writer, 118 scoped_ptr<QuicDefaultPacketWriter> writer,
119 QuicStreamFactory* stream_factory, 119 QuicStreamFactory* stream_factory,
120 QuicCryptoClientStreamFactory* crypto_client_stream_factory, 120 QuicCryptoClientStreamFactory* crypto_client_stream_factory,
121 scoped_ptr<QuicServerInfo> server_info, 121 scoped_ptr<QuicServerInfo> server_info,
122 const QuicSessionKey& server_key, 122 const QuicServerId& server_id,
123 const QuicConfig& config, 123 const QuicConfig& config,
124 QuicCryptoClientConfig* crypto_config, 124 QuicCryptoClientConfig* crypto_config,
125 NetLog* net_log) 125 NetLog* net_log)
126 : QuicClientSessionBase(connection, config), 126 : QuicClientSessionBase(connection, config),
127 require_confirmation_(false), 127 require_confirmation_(false),
128 stream_factory_(stream_factory), 128 stream_factory_(stream_factory),
129 socket_(socket.Pass()), 129 socket_(socket.Pass()),
130 writer_(writer.Pass()), 130 writer_(writer.Pass()),
131 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), 131 read_buffer_(new IOBufferWithSize(kMaxPacketSize)),
132 server_info_(server_info.Pass()), 132 server_info_(server_info.Pass()),
133 read_pending_(false), 133 read_pending_(false),
134 num_total_streams_(0), 134 num_total_streams_(0),
135 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 135 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
136 logger_(net_log_), 136 logger_(net_log_),
137 num_packets_read_(0), 137 num_packets_read_(0),
138 going_away_(false), 138 going_away_(false),
139 weak_factory_(this) { 139 weak_factory_(this) {
140 crypto_stream_.reset( 140 crypto_stream_.reset(
141 crypto_client_stream_factory ? 141 crypto_client_stream_factory ?
142 crypto_client_stream_factory->CreateQuicCryptoClientStream( 142 crypto_client_stream_factory->CreateQuicCryptoClientStream(
143 server_key, this, crypto_config) : 143 server_id, this, crypto_config) :
144 new QuicCryptoClientStream(server_key, this, 144 new QuicCryptoClientStream(server_id, this,
145 new ProofVerifyContextChromium(net_log_), 145 new ProofVerifyContextChromium(net_log_),
146 crypto_config)); 146 crypto_config));
147 147
148 connection->set_debug_visitor(&logger_); 148 connection->set_debug_visitor(&logger_);
149 // TODO(rch): pass in full host port proxy pair 149 // TODO(rch): pass in full host port proxy pair
150 net_log_.BeginEvent( 150 net_log_.BeginEvent(
151 NetLog::TYPE_QUIC_SESSION, 151 NetLog::TYPE_QUIC_SESSION,
152 NetLog::StringCallback("host", &server_key.host())); 152 NetLog::StringCallback("host", &server_id.host()));
153 } 153 }
154 154
155 QuicClientSession::~QuicClientSession() { 155 QuicClientSession::~QuicClientSession() {
156 if (!streams()->empty()) 156 if (!streams()->empty())
157 RecordUnexpectedOpenStreams(DESTRUCTOR); 157 RecordUnexpectedOpenStreams(DESTRUCTOR);
158 if (!observers_.empty()) 158 if (!observers_.empty())
159 RecordUnexpectedObservers(DESTRUCTOR); 159 RecordUnexpectedObservers(DESTRUCTOR);
160 if (!going_away_) 160 if (!going_away_)
161 RecordUnexpectedNotGoingAway(DESTRUCTOR); 161 RecordUnexpectedNotGoingAway(DESTRUCTOR);
162 162
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 RecordUnexpectedNotGoingAway(NOTIFY_FACTORY_OF_SESSION_CLOSED); 695 RecordUnexpectedNotGoingAway(NOTIFY_FACTORY_OF_SESSION_CLOSED);
696 696
697 going_away_ = true; 697 going_away_ = true;
698 DCHECK_EQ(0u, GetNumOpenStreams()); 698 DCHECK_EQ(0u, GetNumOpenStreams());
699 // Will delete |this|. 699 // Will delete |this|.
700 if (stream_factory_) 700 if (stream_factory_)
701 stream_factory_->OnSessionClosed(this); 701 stream_factory_->OnSessionClosed(this);
702 } 702 }
703 703
704 } // namespace net 704 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698