Add signalSyncPoint to the WebGraphicsContext3D command buffer impls.
[chromium-blink-merge.git] / net / quic / quic_client_session.h
blob2bf6e7856e59e0a0a56d1836228024df5cb4b2af
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.
4 //
5 // A client specific QuicSession subclass. This class owns the underlying
6 // QuicConnection and QuicConnectionHelper objects. The connection stores
7 // a non-owning pointer to the helper so this session needs to ensure that
8 // the helper outlives the connection.
10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_
11 #define NET_QUIC_QUIC_CLIENT_SESSION_H_
13 #include <string>
15 #include "base/hash_tables.h"
16 #include "net/base/completion_callback.h"
17 #include "net/quic/quic_connection_logger.h"
18 #include "net/quic/quic_crypto_client_stream.h"
19 #include "net/quic/quic_reliable_client_stream.h"
20 #include "net/quic/quic_session.h"
22 namespace net {
24 class DatagramClientSocket;
25 class QuicConnectionHelper;
26 class QuicCryptoClientStreamFactory;
27 class QuicStreamFactory;
29 class NET_EXPORT_PRIVATE QuicClientSession : public QuicSession {
30 public:
31 // Constructs a new session which will own |connection| and |helper|, but
32 // not |stream_factory|, which must outlive this session.
33 // TODO(rch): decouple the factory from the session via a Delegate interface.
34 QuicClientSession(QuicConnection* connection,
35 DatagramClientSocket* socket,
36 QuicStreamFactory* stream_factory,
37 QuicCryptoClientStreamFactory* crypto_client_stream_factory,
38 const std::string& server_hostname,
39 QuicCryptoClientConfig* crypto_config,
40 NetLog* net_log);
42 virtual ~QuicClientSession();
44 // QuicSession methods:
45 virtual QuicReliableClientStream* CreateOutgoingReliableStream() OVERRIDE;
46 virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE;
47 virtual void CloseStream(QuicStreamId stream_id) OVERRIDE;
48 virtual void OnCryptoHandshakeComplete(QuicErrorCode error) OVERRIDE;
50 // Performs a crypto handshake with the server.
51 int CryptoConnect(const CompletionCallback& callback);
53 // Causes the QuicConnectionHelper to start reading from the socket
54 // and passing the data along to the QuicConnection.
55 void StartReading();
57 // Close the session because of |error|.
58 void CloseSessionOnError(int error);
60 base::Value* GetInfoAsValue(const HostPortPair& pair) const;
62 const BoundNetLog& net_log() const { return net_log_; }
64 protected:
65 // QuicSession methods:
66 virtual ReliableQuicStream* CreateIncomingReliableStream(
67 QuicStreamId id) OVERRIDE;
69 private:
70 // A completion callback invoked when a read completes.
71 void OnReadComplete(int result);
73 base::WeakPtrFactory<QuicClientSession> weak_factory_;
74 // config_ contains non-crypto configuration options negotiated in the crypto
75 // handshake.
76 QuicConfig config_;
77 scoped_ptr<QuicCryptoClientStream> crypto_stream_;
78 QuicStreamFactory* stream_factory_;
79 scoped_ptr<DatagramClientSocket> socket_;
80 scoped_refptr<IOBufferWithSize> read_buffer_;
81 bool read_pending_;
82 CompletionCallback callback_;
83 size_t num_total_streams_;
84 BoundNetLog net_log_;
85 QuicConnectionLogger logger_;
87 DISALLOW_COPY_AND_ASSIGN(QuicClientSession);
90 } // namespace net
92 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_