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

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

Issue 12545035: Refactor QuicClientSession so that it owns the underlying socket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test leak Created 7 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 | « no previous file | net/quic/quic_client_session.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 // A client specific QuicSession subclass. This class owns the underlying 5 // A client specific QuicSession subclass. This class owns the underlying
6 // QuicConnection and QuicConnectionHelper objects. The connection stores 6 // QuicConnection and QuicConnectionHelper objects. The connection stores
7 // a non-owning pointer to the helper so this session needs to ensure that 7 // a non-owning pointer to the helper so this session needs to ensure that
8 // the helper outlives the connection. 8 // the helper outlives the connection.
9 9
10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ 10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_
11 #define NET_QUIC_QUIC_CLIENT_SESSION_H_ 11 #define NET_QUIC_QUIC_CLIENT_SESSION_H_
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "base/hash_tables.h" 15 #include "base/hash_tables.h"
16 #include "net/base/completion_callback.h" 16 #include "net/base/completion_callback.h"
17 #include "net/quic/quic_connection_logger.h" 17 #include "net/quic/quic_connection_logger.h"
18 #include "net/quic/quic_crypto_client_stream.h" 18 #include "net/quic/quic_crypto_client_stream.h"
19 #include "net/quic/quic_reliable_client_stream.h" 19 #include "net/quic/quic_reliable_client_stream.h"
20 #include "net/quic/quic_session.h" 20 #include "net/quic/quic_session.h"
21 21
22 namespace net { 22 namespace net {
23 23
24 class DatagramClientSocket;
24 class QuicConnectionHelper; 25 class QuicConnectionHelper;
25 class QuicStreamFactory; 26 class QuicStreamFactory;
26 27
27 class NET_EXPORT_PRIVATE QuicClientSession : public QuicSession { 28 class NET_EXPORT_PRIVATE QuicClientSession : public QuicSession {
28 public: 29 public:
29 // Constructs a new session which will own |connection| and |helper|, but 30 // Constructs a new session which will own |connection| and |helper|, but
30 // not |stream_factory|, which must outlive this session. 31 // not |stream_factory|, which must outlive this session.
31 // TODO(rch): decouple the factory from the session via a Delegate interface. 32 // TODO(rch): decouple the factory from the session via a Delegate interface.
32 QuicClientSession(QuicConnection* connection, 33 QuicClientSession(QuicConnection* connection,
33 QuicConnectionHelper* helper, 34 DatagramClientSocket* socket,
34 QuicStreamFactory* stream_factory, 35 QuicStreamFactory* stream_factory,
35 const std::string& server_hostname, 36 const std::string& server_hostname,
36 NetLog* net_log); 37 NetLog* net_log);
37 38
38 virtual ~QuicClientSession(); 39 virtual ~QuicClientSession();
39 40
40 // QuicSession methods: 41 // QuicSession methods:
41 virtual QuicReliableClientStream* CreateOutgoingReliableStream() OVERRIDE; 42 virtual QuicReliableClientStream* CreateOutgoingReliableStream() OVERRIDE;
42 virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE; 43 virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE;
43 virtual void CloseStream(QuicStreamId stream_id) OVERRIDE; 44 virtual void CloseStream(QuicStreamId stream_id) OVERRIDE;
(...skipping 17 matching lines...) Expand all
61 // QuicSession methods: 62 // QuicSession methods:
62 virtual ReliableQuicStream* CreateIncomingReliableStream( 63 virtual ReliableQuicStream* CreateIncomingReliableStream(
63 QuicStreamId id) OVERRIDE; 64 QuicStreamId id) OVERRIDE;
64 65
65 private: 66 private:
66 // A completion callback invoked when a read completes. 67 // A completion callback invoked when a read completes.
67 void OnReadComplete(int result); 68 void OnReadComplete(int result);
68 69
69 base::WeakPtrFactory<QuicClientSession> weak_factory_; 70 base::WeakPtrFactory<QuicClientSession> weak_factory_;
70 QuicCryptoClientStream crypto_stream_; 71 QuicCryptoClientStream crypto_stream_;
71 scoped_ptr<QuicConnectionHelper> helper_;
72 QuicStreamFactory* stream_factory_; 72 QuicStreamFactory* stream_factory_;
73 scoped_ptr<DatagramClientSocket> socket_;
73 scoped_refptr<IOBufferWithSize> read_buffer_; 74 scoped_refptr<IOBufferWithSize> read_buffer_;
74 bool read_pending_; 75 bool read_pending_;
75 CompletionCallback callback_; 76 CompletionCallback callback_;
76 size_t num_total_streams_; 77 size_t num_total_streams_;
77 BoundNetLog net_log_; 78 BoundNetLog net_log_;
78 QuicConnectionLogger logger_; 79 QuicConnectionLogger logger_;
79 80
80 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); 81 DISALLOW_COPY_AND_ASSIGN(QuicClientSession);
81 }; 82 };
82 83
83 } // namespace net 84 } // namespace net
84 85
85 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ 86 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698