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

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: Rebase 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
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/quic/quic_stream_factory.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 #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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } // namespace test 54 } // namespace test
55 55
56 // Encapsulates a pending request for a QuicHttpStream. 56 // Encapsulates a pending request for a QuicHttpStream.
57 // If the request is still pending when it is destroyed, it will 57 // If the request is still pending when it is destroyed, it will
58 // cancel the request with the factory. 58 // cancel the request with the factory.
59 class NET_EXPORT_PRIVATE QuicStreamRequest { 59 class NET_EXPORT_PRIVATE QuicStreamRequest {
60 public: 60 public:
61 explicit QuicStreamRequest(QuicStreamFactory* factory); 61 explicit QuicStreamRequest(QuicStreamFactory* factory);
62 ~QuicStreamRequest(); 62 ~QuicStreamRequest();
63 63
64 // For http, |is_https| is false.
65 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is 64 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is
66 // passed to CertVerifier::Verify. 65 // passed to CertVerifier::Verify.
67 int Request(const HostPortPair& host_port_pair, 66 int Request(const HostPortPair& host_port_pair,
68 bool is_https,
69 PrivacyMode privacy_mode, 67 PrivacyMode privacy_mode,
70 int cert_verify_flags, 68 int cert_verify_flags,
71 base::StringPiece origin_host, 69 base::StringPiece origin_host,
72 base::StringPiece method, 70 base::StringPiece method,
73 const BoundNetLog& net_log, 71 const BoundNetLog& net_log,
74 const CompletionCallback& callback); 72 const CompletionCallback& callback);
75 73
76 void OnRequestComplete(int rv); 74 void OnRequestComplete(int rv);
77 75
78 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It 76 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It
79 // returns the amount of time waiting job should be delayed. 77 // returns the amount of time waiting job should be delayed.
80 base::TimeDelta GetTimeDelayForWaitingJob() const; 78 base::TimeDelta GetTimeDelayForWaitingJob() const;
81 79
82 scoped_ptr<QuicHttpStream> ReleaseStream(); 80 scoped_ptr<QuicHttpStream> ReleaseStream();
83 81
84 void set_stream(scoped_ptr<QuicHttpStream> stream); 82 void set_stream(scoped_ptr<QuicHttpStream> stream);
85 83
86 const std::string& origin_host() const { return origin_host_; } 84 const std::string& origin_host() const { return origin_host_; }
87 85
88 PrivacyMode privacy_mode() const { return privacy_mode_; } 86 PrivacyMode privacy_mode() const { return privacy_mode_; }
89 87
90 const BoundNetLog& net_log() const { return net_log_; } 88 const BoundNetLog& net_log() const { return net_log_; }
91 89
92 private: 90 private:
93 QuicStreamFactory* factory_; 91 QuicStreamFactory* factory_;
94 HostPortPair host_port_pair_; 92 HostPortPair host_port_pair_;
95 std::string origin_host_; 93 std::string origin_host_;
96 bool is_https_;
97 PrivacyMode privacy_mode_; 94 PrivacyMode privacy_mode_;
98 BoundNetLog net_log_; 95 BoundNetLog net_log_;
99 CompletionCallback callback_; 96 CompletionCallback callback_;
100 scoped_ptr<QuicHttpStream> stream_; 97 scoped_ptr<QuicHttpStream> stream_;
101 98
102 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); 99 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest);
103 }; 100 };
104 101
105 // A factory for creating new QuicHttpStreams on top of a pool of 102 // A factory for creating new QuicHttpStreams on top of a pool of
106 // QuicChromiumClientSessions. 103 // QuicChromiumClientSessions.
(...skipping 30 matching lines...) Expand all
137 int max_recent_disabled_reasons, 134 int max_recent_disabled_reasons,
138 int threshold_timeouts_with_streams_open, 135 int threshold_timeouts_with_streams_open,
139 int threshold_public_resets_post_handshake, 136 int threshold_public_resets_post_handshake,
140 int socket_receive_buffer_size, 137 int socket_receive_buffer_size,
141 bool delay_tcp_race, 138 bool delay_tcp_race,
142 bool store_server_configs_in_properties, 139 bool store_server_configs_in_properties,
143 const QuicTagVector& connection_options); 140 const QuicTagVector& connection_options);
144 ~QuicStreamFactory() override; 141 ~QuicStreamFactory() override;
145 142
146 // Creates a new QuicHttpStream to |host_port_pair| which will be 143 // Creates a new QuicHttpStream to |host_port_pair| which will be
147 // owned by |request|. |is_https| specifies if the protocol is https or not. 144 // owned by |request|.
148 // If a matching session already exists, this method will return OK. If no 145 // If a matching session already exists, this method will return OK. If no
149 // matching session exists, this will return ERR_IO_PENDING and will invoke 146 // matching session exists, this will return ERR_IO_PENDING and will invoke
150 // OnRequestComplete asynchronously. 147 // OnRequestComplete asynchronously.
151 int Create(const HostPortPair& host_port_pair, 148 int Create(const HostPortPair& host_port_pair,
152 bool is_https,
153 PrivacyMode privacy_mode, 149 PrivacyMode privacy_mode,
154 int cert_verify_flags, 150 int cert_verify_flags,
155 base::StringPiece origin_host, 151 base::StringPiece origin_host,
156 base::StringPiece method, 152 base::StringPiece method,
157 const BoundNetLog& net_log, 153 const BoundNetLog& net_log,
158 QuicStreamRequest* request); 154 QuicStreamRequest* request);
159 155
160 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_| 156 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_|
161 // it marks QUIC as recently broken for the port of the session. Increments 157 // it marks QUIC as recently broken for the port of the session. Increments
162 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| 158 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_|
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 246
251 bool store_server_configs_in_properties() const { 247 bool store_server_configs_in_properties() const {
252 return store_server_configs_in_properties_; 248 return store_server_configs_in_properties_;
253 } 249 }
254 250
255 private: 251 private:
256 class Job; 252 class Job;
257 friend class test::QuicStreamFactoryPeer; 253 friend class test::QuicStreamFactoryPeer;
258 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad); 254 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad);
259 255
260 // The key used to find session by ip. Includes
261 // the ip address, port, and scheme.
262 struct NET_EXPORT_PRIVATE IpAliasKey {
263 IpAliasKey();
264 IpAliasKey(IPEndPoint ip_endpoint, bool is_https);
265 ~IpAliasKey();
266
267 IPEndPoint ip_endpoint;
268 bool is_https;
269
270 // Needed to be an element of std::set.
271 bool operator<(const IpAliasKey &other) const;
272 bool operator==(const IpAliasKey &other) const;
273 };
274
275 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap; 256 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap;
276 typedef std::map<QuicChromiumClientSession*, QuicServerId> SessionIdMap; 257 typedef std::map<QuicChromiumClientSession*, QuicServerId> SessionIdMap;
277 typedef std::set<QuicServerId> AliasSet; 258 typedef std::set<QuicServerId> AliasSet;
278 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap; 259 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap;
279 typedef std::set<QuicChromiumClientSession*> SessionSet; 260 typedef std::set<QuicChromiumClientSession*> SessionSet;
280 typedef std::map<IpAliasKey, SessionSet> IPAliasMap; 261 typedef std::map<IPEndPoint, SessionSet> IPAliasMap;
281 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; 262 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap;
282 typedef std::set<Job*> JobSet; 263 typedef std::set<Job*> JobSet;
283 typedef std::map<QuicServerId, JobSet> JobMap; 264 typedef std::map<QuicServerId, JobSet> JobMap;
284 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; 265 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap;
285 typedef std::set<QuicStreamRequest*> RequestSet; 266 typedef std::set<QuicStreamRequest*> RequestSet;
286 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; 267 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap;
287 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason> 268 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason>
288 DisabledReasonsQueue; 269 DisabledReasonsQueue;
289 270
290 // Creates a job which doesn't wait for server config to be loaded from the 271 // Creates a job which doesn't wait for server config to be loaded from the
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 base::TaskRunner* task_runner_; 456 base::TaskRunner* task_runner_;
476 457
477 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 458 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
478 459
479 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 460 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
480 }; 461 };
481 462
482 } // namespace net 463 } // namespace net
483 464
484 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 465 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698