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

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

Issue 1393713003: Remove insecure QUIC support from Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 2 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
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 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ 5 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_
6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } // namespace test 53 } // namespace test
54 54
55 // Encapsulates a pending request for a QuicHttpStream. 55 // Encapsulates a pending request for a QuicHttpStream.
56 // If the request is still pending when it is destroyed, it will 56 // If the request is still pending when it is destroyed, it will
57 // cancel the request with the factory. 57 // cancel the request with the factory.
58 class NET_EXPORT_PRIVATE QuicStreamRequest { 58 class NET_EXPORT_PRIVATE QuicStreamRequest {
59 public: 59 public:
60 explicit QuicStreamRequest(QuicStreamFactory* factory); 60 explicit QuicStreamRequest(QuicStreamFactory* factory);
61 ~QuicStreamRequest(); 61 ~QuicStreamRequest();
62 62
63 // For http, |is_https| is false.
64 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is 63 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is
65 // passed to CertVerifier::Verify. 64 // passed to CertVerifier::Verify.
66 int Request(const HostPortPair& host_port_pair, 65 int Request(const HostPortPair& host_port_pair,
67 bool is_https,
68 PrivacyMode privacy_mode, 66 PrivacyMode privacy_mode,
69 int cert_verify_flags, 67 int cert_verify_flags,
70 base::StringPiece origin_host, 68 base::StringPiece origin_host,
71 base::StringPiece method, 69 base::StringPiece method,
72 const BoundNetLog& net_log, 70 const BoundNetLog& net_log,
73 const CompletionCallback& callback); 71 const CompletionCallback& callback);
74 72
75 void OnRequestComplete(int rv); 73 void OnRequestComplete(int rv);
76 74
77 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It 75 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It
78 // returns the amount of time waiting job should be delayed. 76 // returns the amount of time waiting job should be delayed.
79 base::TimeDelta GetTimeDelayForWaitingJob() const; 77 base::TimeDelta GetTimeDelayForWaitingJob() const;
80 78
81 scoped_ptr<QuicHttpStream> ReleaseStream(); 79 scoped_ptr<QuicHttpStream> ReleaseStream();
82 80
83 void set_stream(scoped_ptr<QuicHttpStream> stream); 81 void set_stream(scoped_ptr<QuicHttpStream> stream);
84 82
85 const std::string& origin_host() const { return origin_host_; } 83 const std::string& origin_host() const { return origin_host_; }
86 84
87 PrivacyMode privacy_mode() const { return privacy_mode_; } 85 PrivacyMode privacy_mode() const { return privacy_mode_; }
88 86
89 const BoundNetLog& net_log() const { return net_log_; } 87 const BoundNetLog& net_log() const { return net_log_; }
90 88
91 private: 89 private:
92 QuicStreamFactory* factory_; 90 QuicStreamFactory* factory_;
93 HostPortPair host_port_pair_; 91 HostPortPair host_port_pair_;
94 std::string origin_host_; 92 std::string origin_host_;
95 bool is_https_;
96 PrivacyMode privacy_mode_; 93 PrivacyMode privacy_mode_;
97 BoundNetLog net_log_; 94 BoundNetLog net_log_;
98 CompletionCallback callback_; 95 CompletionCallback callback_;
99 scoped_ptr<QuicHttpStream> stream_; 96 scoped_ptr<QuicHttpStream> stream_;
100 97
101 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); 98 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest);
102 }; 99 };
103 100
104 // A factory for creating new QuicHttpStreams on top of a pool of 101 // A factory for creating new QuicHttpStreams on top of a pool of
105 // QuicChromiumClientSessions. 102 // QuicChromiumClientSessions.
(...skipping 29 matching lines...) Expand all
135 float packet_loss_threshold, 132 float packet_loss_threshold,
136 int max_recent_disabled_reasons, 133 int max_recent_disabled_reasons,
137 int threshold_timeouts_with_streams_open, 134 int threshold_timeouts_with_streams_open,
138 int threshold_public_resets_post_handshake, 135 int threshold_public_resets_post_handshake,
139 int socket_receive_buffer_size, 136 int socket_receive_buffer_size,
140 bool delay_tcp_race, 137 bool delay_tcp_race,
141 const QuicTagVector& connection_options); 138 const QuicTagVector& connection_options);
142 ~QuicStreamFactory() override; 139 ~QuicStreamFactory() override;
143 140
144 // Creates a new QuicHttpStream to |host_port_pair| which will be 141 // Creates a new QuicHttpStream to |host_port_pair| which will be
145 // owned by |request|. |is_https| specifies if the protocol is https or not. 142 // owned by |request|.
146 // If a matching session already exists, this method will return OK. If no 143 // If a matching session already exists, this method will return OK. If no
147 // matching session exists, this will return ERR_IO_PENDING and will invoke 144 // matching session exists, this will return ERR_IO_PENDING and will invoke
148 // OnRequestComplete asynchronously. 145 // OnRequestComplete asynchronously.
149 int Create(const HostPortPair& host_port_pair, 146 int Create(const HostPortPair& host_port_pair,
150 bool is_https,
151 PrivacyMode privacy_mode, 147 PrivacyMode privacy_mode,
152 int cert_verify_flags, 148 int cert_verify_flags,
153 base::StringPiece origin_host, 149 base::StringPiece origin_host,
154 base::StringPiece method, 150 base::StringPiece method,
155 const BoundNetLog& net_log, 151 const BoundNetLog& net_log,
156 QuicStreamRequest* request); 152 QuicStreamRequest* request);
157 153
158 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_| 154 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_|
159 // it marks QUIC as recently broken for the port of the session. Increments 155 // it marks QUIC as recently broken for the port of the session. Increments
160 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| 156 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_|
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 243
248 int socket_receive_buffer_size() const { return socket_receive_buffer_size_; } 244 int socket_receive_buffer_size() const { return socket_receive_buffer_size_; }
249 245
250 bool delay_tcp_race() const { return delay_tcp_race_; } 246 bool delay_tcp_race() const { return delay_tcp_race_; }
251 247
252 private: 248 private:
253 class Job; 249 class Job;
254 friend class test::QuicStreamFactoryPeer; 250 friend class test::QuicStreamFactoryPeer;
255 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad); 251 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad);
256 252
257 // The key used to find session by ip. Includes
258 // the ip address, port, and scheme.
259 struct NET_EXPORT_PRIVATE IpAliasKey {
260 IpAliasKey();
261 IpAliasKey(IPEndPoint ip_endpoint, bool is_https);
262 ~IpAliasKey();
263
264 IPEndPoint ip_endpoint;
265 bool is_https;
266
267 // Needed to be an element of std::set.
268 bool operator<(const IpAliasKey &other) const;
269 bool operator==(const IpAliasKey &other) const;
270 };
271
272 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap; 253 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap;
273 typedef std::map<QuicChromiumClientSession*, QuicServerId> SessionIdMap; 254 typedef std::map<QuicChromiumClientSession*, QuicServerId> SessionIdMap;
274 typedef std::set<QuicServerId> AliasSet; 255 typedef std::set<QuicServerId> AliasSet;
275 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap; 256 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap;
276 typedef std::set<QuicChromiumClientSession*> SessionSet; 257 typedef std::set<QuicChromiumClientSession*> SessionSet;
277 typedef std::map<IpAliasKey, SessionSet> IPAliasMap; 258 typedef std::map<IPEndPoint, SessionSet> IPAliasMap;
278 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; 259 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap;
279 typedef std::set<Job*> JobSet; 260 typedef std::set<Job*> JobSet;
280 typedef std::map<QuicServerId, JobSet> JobMap; 261 typedef std::map<QuicServerId, JobSet> JobMap;
281 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; 262 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap;
282 typedef std::set<QuicStreamRequest*> RequestSet; 263 typedef std::set<QuicStreamRequest*> RequestSet;
283 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; 264 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap;
284 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason> 265 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason>
285 DisabledReasonsQueue; 266 DisabledReasonsQueue;
286 267
287 // Creates a job which doesn't wait for server config to be loaded from the 268 // Creates a job which doesn't wait for server config to be loaded from the
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 base::TaskRunner* task_runner_; 449 base::TaskRunner* task_runner_;
469 450
470 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 451 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
471 452
472 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 453 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
473 }; 454 };
474 455
475 } // namespace net 456 } // namespace net
476 457
477 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 458 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698