[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / net / tools / quic / quic_client_session.cc
blob0b9942084982ba61bc09e6672e5004a468ec506b
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
3 // found in the LICENSE file.
5 #include "net/tools/quic/quic_client_session.h"
7 #include "base/logging.h"
8 #include "net/quic/crypto/crypto_protocol.h"
9 #include "net/quic/quic_server_id.h"
10 #include "net/tools/quic/quic_spdy_client_stream.h"
12 using std::string;
14 namespace net {
15 namespace tools {
17 QuicClientSession::QuicClientSession(const QuicConfig& config,
18 QuicConnection* connection,
19 const QuicServerId& server_id,
20 QuicCryptoClientConfig* crypto_config)
21 : QuicClientSessionBase(connection, config),
22 crypto_stream_(
23 new QuicCryptoClientStream(server_id, this, nullptr, crypto_config)),
24 respect_goaway_(true) {
27 QuicClientSession::~QuicClientSession() {
30 void QuicClientSession::OnProofValid(
31 const QuicCryptoClientConfig::CachedState& /*cached*/) {}
33 void QuicClientSession::OnProofVerifyDetailsAvailable(
34 const ProofVerifyDetails& /*verify_details*/) {}
36 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDataStream() {
37 if (!crypto_stream_->encryption_established()) {
38 DVLOG(1) << "Encryption not active so no outgoing stream created.";
39 return nullptr;
41 if (GetNumOpenStreams() >= get_max_open_streams()) {
42 DVLOG(1) << "Failed to create a new outgoing stream. "
43 << "Already " << GetNumOpenStreams() << " open.";
44 return nullptr;
46 if (goaway_received() && respect_goaway_) {
47 DVLOG(1) << "Failed to create a new outgoing stream. "
48 << "Already received goaway.";
49 return nullptr;
51 QuicSpdyClientStream* stream
52 = new QuicSpdyClientStream(GetNextStreamId(), this);
53 ActivateStream(stream);
54 return stream;
57 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() {
58 return crypto_stream_.get();
61 void QuicClientSession::CryptoConnect() {
62 DCHECK(flow_controller());
63 crypto_stream_->CryptoConnect();
66 int QuicClientSession::GetNumSentClientHellos() const {
67 return crypto_stream_->num_sent_client_hellos();
70 QuicDataStream* QuicClientSession::CreateIncomingDataStream(
71 QuicStreamId id) {
72 DLOG(ERROR) << "Server push not supported";
73 return nullptr;
76 } // namespace tools
77 } // namespace net