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

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

Issue 1425363002: Factor QuicCryptoClientStream APIs into QuicCryptoClientStreamBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106313860
Patch Set: Created 5 years, 1 month 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/tools/quic/quic_client_session.h ('k') | net/tools/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/tools/quic/quic_client_session.h" 5 #include "net/tools/quic/quic_client_session.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/quic/crypto/crypto_protocol.h" 8 #include "net/quic/crypto/crypto_protocol.h"
9 #include "net/quic/crypto/proof_verifier_chromium.h" 9 #include "net/quic/crypto/proof_verifier_chromium.h"
10 #include "net/quic/quic_server_id.h" 10 #include "net/quic/quic_server_id.h"
11 #include "net/tools/quic/quic_spdy_client_stream.h" 11 #include "net/tools/quic/quic_spdy_client_stream.h"
12 12
13 using std::string; 13 using std::string;
14 14
15 namespace net { 15 namespace net {
16 namespace tools { 16 namespace tools {
17 17
18 QuicClientSession::QuicClientSession(const QuicConfig& config, 18 QuicClientSession::QuicClientSession(const QuicConfig& config,
19 QuicConnection* connection, 19 QuicConnection* connection,
20 const QuicServerId& server_id, 20 const QuicServerId& server_id,
21 QuicCryptoClientConfig* crypto_config) 21 QuicCryptoClientConfig* crypto_config)
22 : QuicClientSessionBase(connection, config), 22 : QuicClientSessionBase(connection, config),
23 crypto_stream_(new QuicCryptoClientStream( 23 server_id_(server_id),
24 server_id, 24 crypto_config_(crypto_config),
25 this,
26 new ProofVerifyContextChromium(0, BoundNetLog()),
27 crypto_config)),
28 respect_goaway_(true) { 25 respect_goaway_(true) {
29 } 26 }
30 27
31 QuicClientSession::~QuicClientSession() { 28 QuicClientSession::~QuicClientSession() {
32 } 29 }
33 30
31 void QuicClientSession::Initialize() {
32 crypto_stream_.reset(CreateQuicCryptoStream());
33 QuicClientSessionBase::Initialize();
34 }
35
34 void QuicClientSession::OnProofValid( 36 void QuicClientSession::OnProofValid(
35 const QuicCryptoClientConfig::CachedState& /*cached*/) {} 37 const QuicCryptoClientConfig::CachedState& /*cached*/) {}
36 38
37 void QuicClientSession::OnProofVerifyDetailsAvailable( 39 void QuicClientSession::OnProofVerifyDetailsAvailable(
38 const ProofVerifyDetails& /*verify_details*/) {} 40 const ProofVerifyDetails& /*verify_details*/) {}
39 41
40 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream() { 42 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream() {
41 if (!crypto_stream_->encryption_established()) { 43 if (!crypto_stream_->encryption_established()) {
42 DVLOG(1) << "Encryption not active so no outgoing stream created."; 44 DVLOG(1) << "Encryption not active so no outgoing stream created.";
43 return nullptr; 45 return nullptr;
(...skipping 10 matching lines...) Expand all
54 } 56 }
55 QuicSpdyClientStream* stream = CreateClientStream(); 57 QuicSpdyClientStream* stream = CreateClientStream();
56 ActivateStream(stream); 58 ActivateStream(stream);
57 return stream; 59 return stream;
58 } 60 }
59 61
60 QuicSpdyClientStream* QuicClientSession::CreateClientStream() { 62 QuicSpdyClientStream* QuicClientSession::CreateClientStream() {
61 return new QuicSpdyClientStream(GetNextOutgoingStreamId(), this); 63 return new QuicSpdyClientStream(GetNextOutgoingStreamId(), this);
62 } 64 }
63 65
64 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() { 66 QuicCryptoClientStreamBase* QuicClientSession::GetCryptoStream() {
65 return crypto_stream_.get(); 67 return crypto_stream_.get();
66 } 68 }
67 69
68 void QuicClientSession::CryptoConnect() { 70 void QuicClientSession::CryptoConnect() {
69 DCHECK(flow_controller()); 71 DCHECK(flow_controller());
70 crypto_stream_->CryptoConnect(); 72 crypto_stream_->CryptoConnect();
71 } 73 }
72 74
73 int QuicClientSession::GetNumSentClientHellos() const { 75 int QuicClientSession::GetNumSentClientHellos() const {
74 return crypto_stream_->num_sent_client_hellos(); 76 return crypto_stream_->num_sent_client_hellos();
75 } 77 }
76 78
77 QuicSpdyStream* QuicClientSession::CreateIncomingDynamicStream( 79 QuicSpdyStream* QuicClientSession::CreateIncomingDynamicStream(
78 QuicStreamId id) { 80 QuicStreamId id) {
79 DLOG(ERROR) << "Server push not supported"; 81 DLOG(ERROR) << "Server push not supported";
80 return nullptr; 82 return nullptr;
81 } 83 }
82 84
85 QuicCryptoClientStreamBase* QuicClientSession::CreateQuicCryptoStream() {
86 return new QuicCryptoClientStream(
87 server_id_, this, new ProofVerifyContextChromium(0, BoundNetLog()),
88 crypto_config_);
89 }
90
83 } // namespace tools 91 } // namespace tools
92
84 } // namespace net 93 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_session.h ('k') | net/tools/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698