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

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

Issue 196403002: Move QuicServerInfo management from CachedState to the QuicStreamFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix crash Created 6 years, 9 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
« no previous file with comments | « net/quic/quic_client_session.h ('k') | net/quic/quic_client_session_test.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"
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/quic_server_info.h"
16 #include "net/quic/quic_connection_helper.h" 17 #include "net/quic/quic_connection_helper.h"
17 #include "net/quic/quic_crypto_client_stream_factory.h" 18 #include "net/quic/quic_crypto_client_stream_factory.h"
18 #include "net/quic/quic_default_packet_writer.h" 19 #include "net/quic/quic_default_packet_writer.h"
19 #include "net/quic/quic_stream_factory.h" 20 #include "net/quic/quic_stream_factory.h"
20 #include "net/ssl/ssl_info.h" 21 #include "net/ssl/ssl_info.h"
21 #include "net/udp/datagram_client_socket.h" 22 #include "net/udp/datagram_client_socket.h"
22 23
23 namespace net { 24 namespace net {
24 25
25 namespace { 26 namespace {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 void QuicClientSession::StreamRequest::OnRequestCompleteFailure(int rv) { 79 void QuicClientSession::StreamRequest::OnRequestCompleteFailure(int rv) {
79 session_.reset(); 80 session_.reset();
80 ResetAndReturn(&callback_).Run(rv); 81 ResetAndReturn(&callback_).Run(rv);
81 } 82 }
82 83
83 QuicClientSession::QuicClientSession( 84 QuicClientSession::QuicClientSession(
84 QuicConnection* connection, 85 QuicConnection* connection,
85 scoped_ptr<DatagramClientSocket> socket, 86 scoped_ptr<DatagramClientSocket> socket,
86 scoped_ptr<QuicDefaultPacketWriter> writer, 87 scoped_ptr<QuicDefaultPacketWriter> writer,
87 QuicStreamFactory* stream_factory, 88 QuicStreamFactory* stream_factory,
89 scoped_ptr<QuicServerInfo> server_info,
88 QuicCryptoClientStreamFactory* crypto_client_stream_factory, 90 QuicCryptoClientStreamFactory* crypto_client_stream_factory,
89 const string& server_hostname, 91 const string& server_hostname,
90 const QuicConfig& config, 92 const QuicConfig& config,
91 QuicCryptoClientConfig* crypto_config, 93 QuicCryptoClientConfig* crypto_config,
92 NetLog* net_log) 94 NetLog* net_log)
93 : QuicSession(connection, config), 95 : QuicSession(connection, config),
94 require_confirmation_(false), 96 require_confirmation_(false),
95 stream_factory_(stream_factory), 97 stream_factory_(stream_factory),
96 socket_(socket.Pass()), 98 socket_(socket.Pass()),
97 writer_(writer.Pass()), 99 writer_(writer.Pass()),
98 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), 100 read_buffer_(new IOBufferWithSize(kMaxPacketSize)),
99 read_pending_(false), 101 read_pending_(false),
100 num_total_streams_(0), 102 num_total_streams_(0),
101 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 103 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
102 logger_(net_log_), 104 logger_(net_log_),
103 num_packets_read_(0), 105 num_packets_read_(0),
104 weak_factory_(this) { 106 weak_factory_(this) {
105 crypto_stream_.reset( 107 crypto_stream_.reset(
106 crypto_client_stream_factory ? 108 crypto_client_stream_factory ?
107 crypto_client_stream_factory->CreateQuicCryptoClientStream( 109 crypto_client_stream_factory->CreateQuicCryptoClientStream(
108 server_hostname, this, crypto_config) : 110 server_hostname, this, crypto_config) :
109 new QuicCryptoClientStream(server_hostname, this, crypto_config)); 111 new QuicCryptoClientStream(server_hostname, this, crypto_config));
110 112
113 crypto_stream_->SetQuicServerInfo(server_info.Pass());
114
111 connection->set_debug_visitor(&logger_); 115 connection->set_debug_visitor(&logger_);
112 // TODO(rch): pass in full host port proxy pair 116 // TODO(rch): pass in full host port proxy pair
113 net_log_.BeginEvent( 117 net_log_.BeginEvent(
114 NetLog::TYPE_QUIC_SESSION, 118 NetLog::TYPE_QUIC_SESSION,
115 NetLog::StringCallback("host", &server_hostname)); 119 NetLog::StringCallback("host", &server_hostname));
116 } 120 }
117 121
118 QuicClientSession::~QuicClientSession() { 122 QuicClientSession::~QuicClientSession() {
119 // The session must be closed before it is destroyed. 123 // The session must be closed before it is destroyed.
120 DCHECK(streams()->empty()); 124 DCHECK(streams()->empty());
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 571 }
568 572
569 void QuicClientSession::NotifyFactoryOfSessionClosed() { 573 void QuicClientSession::NotifyFactoryOfSessionClosed() {
570 DCHECK_EQ(0u, GetNumOpenStreams()); 574 DCHECK_EQ(0u, GetNumOpenStreams());
571 // Will delete |this|. 575 // Will delete |this|.
572 if (stream_factory_) 576 if (stream_factory_)
573 stream_factory_->OnSessionClosed(this); 577 stream_factory_->OnSessionClosed(this);
574 } 578 }
575 579
576 } // namespace net 580 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session.h ('k') | net/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698