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

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

Issue 1581283002: Rename chromium-specific QUIC classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing Created 4 years, 11 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
« no previous file with comments | « net/quic/p2p/quic_p2p_session_test.cc ('k') | net/quic/quic_chromium_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_CHROMIUM_CLIENT_SESSION_H_ 10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_
11 #define NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ 11 #define NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_
12 12
13 #include <stddef.h> 13 #include <stddef.h>
14 14
15 #include <string> 15 #include <string>
16 16
17 #include "base/containers/hash_tables.h" 17 #include "base/containers/hash_tables.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "net/base/completion_callback.h" 21 #include "net/base/completion_callback.h"
22 #include "net/base/socket_performance_watcher.h" 22 #include "net/base/socket_performance_watcher.h"
23 #include "net/cert/ct_verify_result.h" 23 #include "net/cert/ct_verify_result.h"
24 #include "net/proxy/proxy_server.h" 24 #include "net/proxy/proxy_server.h"
25 #include "net/quic/quic_chromium_client_stream.h"
25 #include "net/quic/quic_client_session_base.h" 26 #include "net/quic/quic_client_session_base.h"
26 #include "net/quic/quic_connection_logger.h" 27 #include "net/quic/quic_connection_logger.h"
27 #include "net/quic/quic_crypto_client_stream.h" 28 #include "net/quic/quic_crypto_client_stream.h"
28 #include "net/quic/quic_packet_reader.h" 29 #include "net/quic/quic_packet_reader.h"
29 #include "net/quic/quic_protocol.h" 30 #include "net/quic/quic_protocol.h"
30 #include "net/quic/quic_reliable_client_stream.h"
31 #include "net/quic/quic_time.h" 31 #include "net/quic/quic_time.h"
32 32
33 namespace net { 33 namespace net {
34 34
35 class CertVerifyResult; 35 class CertVerifyResult;
36 class DatagramClientSocket; 36 class DatagramClientSocket;
37 class QuicConnectionHelper; 37 class QuicChromiumConnectionHelper;
38 class QuicCryptoClientStreamFactory; 38 class QuicCryptoClientStreamFactory;
39 class QuicServerId; 39 class QuicServerId;
40 class QuicServerInfo; 40 class QuicServerInfo;
41 class QuicStreamFactory; 41 class QuicStreamFactory;
42 class SSLInfo; 42 class SSLInfo;
43 class TransportSecurityState; 43 class TransportSecurityState;
44 44
45 namespace test { 45 namespace test {
46 class QuicChromiumClientSessionPeer; 46 class QuicChromiumClientSessionPeer;
47 } // namespace test 47 } // namespace test
(...skipping 26 matching lines...) Expand all
74 class NET_EXPORT_PRIVATE StreamRequest { 74 class NET_EXPORT_PRIVATE StreamRequest {
75 public: 75 public:
76 StreamRequest(); 76 StreamRequest();
77 ~StreamRequest(); 77 ~StreamRequest();
78 78
79 // Starts a request to create a stream. If OK is returned, then 79 // Starts a request to create a stream. If OK is returned, then
80 // |stream| will be updated with the newly created stream. If 80 // |stream| will be updated with the newly created stream. If
81 // ERR_IO_PENDING is returned, then when the request is eventuallly 81 // ERR_IO_PENDING is returned, then when the request is eventuallly
82 // complete |callback| will be called. 82 // complete |callback| will be called.
83 int StartRequest(const base::WeakPtr<QuicChromiumClientSession>& session, 83 int StartRequest(const base::WeakPtr<QuicChromiumClientSession>& session,
84 QuicReliableClientStream** stream, 84 QuicChromiumClientStream** stream,
85 const CompletionCallback& callback); 85 const CompletionCallback& callback);
86 86
87 // Cancels any pending stream creation request. May be called 87 // Cancels any pending stream creation request. May be called
88 // repeatedly. 88 // repeatedly.
89 void CancelRequest(); 89 void CancelRequest();
90 90
91 private: 91 private:
92 friend class QuicChromiumClientSession; 92 friend class QuicChromiumClientSession;
93 93
94 // Called by |session_| for an asynchronous request when the stream 94 // Called by |session_| for an asynchronous request when the stream
95 // request has finished successfully. 95 // request has finished successfully.
96 void OnRequestCompleteSuccess(QuicReliableClientStream* stream); 96 void OnRequestCompleteSuccess(QuicChromiumClientStream* stream);
97 97
98 // Called by |session_| for an asynchronous request when the stream 98 // Called by |session_| for an asynchronous request when the stream
99 // request has finished with an error. Also called with ERR_ABORTED 99 // request has finished with an error. Also called with ERR_ABORTED
100 // if |session_| is destroyed while the stream request is still pending. 100 // if |session_| is destroyed while the stream request is still pending.
101 void OnRequestCompleteFailure(int rv); 101 void OnRequestCompleteFailure(int rv);
102 102
103 base::WeakPtr<QuicChromiumClientSession> session_; 103 base::WeakPtr<QuicChromiumClientSession> session_;
104 CompletionCallback callback_; 104 CompletionCallback callback_;
105 QuicReliableClientStream** stream_; 105 QuicChromiumClientStream** stream_;
106 106
107 DISALLOW_COPY_AND_ASSIGN(StreamRequest); 107 DISALLOW_COPY_AND_ASSIGN(StreamRequest);
108 }; 108 };
109 109
110 // Constructs a new session which will own |connection|, but not 110 // Constructs a new session which will own |connection|, but not
111 // |stream_factory|, which must outlive this session. 111 // |stream_factory|, which must outlive this session.
112 // TODO(rch): decouple the factory from the session via a Delegate interface. 112 // TODO(rch): decouple the factory from the session via a Delegate interface.
113 QuicChromiumClientSession( 113 QuicChromiumClientSession(
114 QuicConnection* connection, 114 QuicConnection* connection,
115 scoped_ptr<DatagramClientSocket> socket, 115 scoped_ptr<DatagramClientSocket> socket,
(...skipping 19 matching lines...) Expand all
135 void RemoveObserver(Observer* observer); 135 void RemoveObserver(Observer* observer);
136 136
137 // Attempts to create a new stream. If the stream can be 137 // Attempts to create a new stream. If the stream can be
138 // created immediately, returns OK. If the open stream limit 138 // created immediately, returns OK. If the open stream limit
139 // has been reached, returns ERR_IO_PENDING, and |request| 139 // has been reached, returns ERR_IO_PENDING, and |request|
140 // will be added to the stream requets queue and will 140 // will be added to the stream requets queue and will
141 // be completed asynchronously. 141 // be completed asynchronously.
142 // TODO(rch): remove |stream| from this and use setter on |request| 142 // TODO(rch): remove |stream| from this and use setter on |request|
143 // and fix in spdy too. 143 // and fix in spdy too.
144 int TryCreateStream(StreamRequest* request, 144 int TryCreateStream(StreamRequest* request,
145 QuicReliableClientStream** stream); 145 QuicChromiumClientStream** stream);
146 146
147 // Cancels the pending stream creation request. 147 // Cancels the pending stream creation request.
148 void CancelRequest(StreamRequest* request); 148 void CancelRequest(StreamRequest* request);
149 149
150 // QuicSpdySession methods: 150 // QuicSpdySession methods:
151 void OnHeadersHeadOfLineBlocking(QuicTime::Delta delta) override; 151 void OnHeadersHeadOfLineBlocking(QuicTime::Delta delta) override;
152 152
153 // QuicSession methods: 153 // QuicSession methods:
154 void OnStreamFrame(const QuicStreamFrame& frame) override; 154 void OnStreamFrame(const QuicStreamFrame& frame) override;
155 QuicReliableClientStream* CreateOutgoingDynamicStream( 155 QuicChromiumClientStream* CreateOutgoingDynamicStream(
156 SpdyPriority priority) override; 156 SpdyPriority priority) override;
157 QuicCryptoClientStream* GetCryptoStream() override; 157 QuicCryptoClientStream* GetCryptoStream() override;
158 void CloseStream(QuicStreamId stream_id) override; 158 void CloseStream(QuicStreamId stream_id) override;
159 void SendRstStream(QuicStreamId id, 159 void SendRstStream(QuicStreamId id,
160 QuicRstStreamErrorCode error, 160 QuicRstStreamErrorCode error,
161 QuicStreamOffset bytes_written) override; 161 QuicStreamOffset bytes_written) override;
162 void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override; 162 void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override;
163 void OnCryptoHandshakeMessageSent( 163 void OnCryptoHandshakeMessageSent(
164 const CryptoHandshakeMessage& message) override; 164 const CryptoHandshakeMessage& message) override;
165 void OnCryptoHandshakeMessageReceived( 165 void OnCryptoHandshakeMessageReceived(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 protected: 243 protected:
244 // QuicSession methods: 244 // QuicSession methods:
245 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; 245 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override;
246 246
247 private: 247 private:
248 friend class test::QuicChromiumClientSessionPeer; 248 friend class test::QuicChromiumClientSessionPeer;
249 249
250 typedef std::set<Observer*> ObserverSet; 250 typedef std::set<Observer*> ObserverSet;
251 typedef std::list<StreamRequest*> StreamRequestQueue; 251 typedef std::list<StreamRequest*> StreamRequestQueue;
252 252
253 QuicReliableClientStream* CreateOutgoingReliableStreamImpl(); 253 QuicChromiumClientStream* CreateOutgoingReliableStreamImpl();
254 // A completion callback invoked when a read completes. 254 // A completion callback invoked when a read completes.
255 void OnReadComplete(int result); 255 void OnReadComplete(int result);
256 256
257 void OnClosedStream(); 257 void OnClosedStream();
258 258
259 // Close the session because of |error| and records it in UMA histogram. 259 // Close the session because of |error| and records it in UMA histogram.
260 void RecordAndCloseSessionOnError(int error, QuicErrorCode quic_error); 260 void RecordAndCloseSessionOnError(int error, QuicErrorCode quic_error);
261 261
262 // A Session may be closed via any of three methods: 262 // A Session may be closed via any of three methods:
263 // OnConnectionClosed - called by the connection when the connection has been 263 // OnConnectionClosed - called by the connection when the connection has been
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 bool going_away_; 310 bool going_away_;
311 QuicDisabledReason disabled_reason_; 311 QuicDisabledReason disabled_reason_;
312 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; 312 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_;
313 313
314 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); 314 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession);
315 }; 315 };
316 316
317 } // namespace net 317 } // namespace net
318 318
319 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ 319 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_
OLDNEW
« no previous file with comments | « net/quic/p2p/quic_p2p_session_test.cc ('k') | net/quic/quic_chromium_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698