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

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

Issue 1744693002: Implement QUIC-based net::BidirectionalStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@basecl
Patch Set: Created 4 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
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <list> 11 #include <list>
12 #include <map> 12 #include <map>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "net/base/address_list.h" 21 #include "net/base/address_list.h"
22 #include "net/base/completion_callback.h" 22 #include "net/base/completion_callback.h"
23 #include "net/base/host_port_pair.h" 23 #include "net/base/host_port_pair.h"
24 #include "net/base/network_change_notifier.h" 24 #include "net/base/network_change_notifier.h"
25 #include "net/cert/cert_database.h" 25 #include "net/cert/cert_database.h"
26 #include "net/http/http_server_properties.h" 26 #include "net/http/http_server_properties.h"
27 #include "net/log/net_log.h" 27 #include "net/log/net_log.h"
28 #include "net/net_features.h"
28 #include "net/proxy/proxy_server.h" 29 #include "net/proxy/proxy_server.h"
29 #include "net/quic/network_connection.h" 30 #include "net/quic/network_connection.h"
30 #include "net/quic/quic_chromium_client_session.h" 31 #include "net/quic/quic_chromium_client_session.h"
31 #include "net/quic/quic_client_push_promise_index.h" 32 #include "net/quic/quic_client_push_promise_index.h"
32 #include "net/quic/quic_config.h" 33 #include "net/quic/quic_config.h"
33 #include "net/quic/quic_crypto_stream.h" 34 #include "net/quic/quic_crypto_stream.h"
34 #include "net/quic/quic_http_stream.h" 35 #include "net/quic/quic_http_stream.h"
35 #include "net/quic/quic_protocol.h" 36 #include "net/quic/quic_protocol.h"
36 #include "net/ssl/ssl_config_service.h" 37 #include "net/ssl/ssl_config_service.h"
37 38
(...skipping 10 matching lines...) Expand all
48 class QuicChromiumClientSession; 49 class QuicChromiumClientSession;
49 class QuicChromiumConnectionHelper; 50 class QuicChromiumConnectionHelper;
50 class QuicCryptoClientStreamFactory; 51 class QuicCryptoClientStreamFactory;
51 class QuicRandom; 52 class QuicRandom;
52 class QuicServerId; 53 class QuicServerId;
53 class QuicServerInfo; 54 class QuicServerInfo;
54 class QuicServerInfoFactory; 55 class QuicServerInfoFactory;
55 class QuicStreamFactory; 56 class QuicStreamFactory;
56 class SocketPerformanceWatcherFactory; 57 class SocketPerformanceWatcherFactory;
57 class TransportSecurityState; 58 class TransportSecurityState;
59 class BidirectionalStreamJob;
58 60
59 namespace test { 61 namespace test {
60 class QuicStreamFactoryPeer; 62 class QuicStreamFactoryPeer;
61 } // namespace test 63 } // namespace test
62 64
63 // When a connection is idle for 30 seconds it will be closed. 65 // When a connection is idle for 30 seconds it will be closed.
64 const int kIdleConnectionTimeoutSeconds = 30; 66 const int kIdleConnectionTimeoutSeconds = 30;
65 67
66 // Encapsulates a pending request for a QuicHttpStream. 68 // Encapsulates a pending request for a QuicHttpStream.
67 // If the request is still pending when it is destroyed, it will 69 // If the request is still pending when it is destroyed, it will
68 // cancel the request with the factory. 70 // cancel the request with the factory.
69 class NET_EXPORT_PRIVATE QuicStreamRequest { 71 class NET_EXPORT_PRIVATE QuicStreamRequest {
70 public: 72 public:
71 explicit QuicStreamRequest(QuicStreamFactory* factory); 73 explicit QuicStreamRequest(QuicStreamFactory* factory);
72 ~QuicStreamRequest(); 74 ~QuicStreamRequest();
73 75
74 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is 76 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is
75 // passed to CertVerifier::Verify. 77 // passed to CertVerifier::Verify.
76 int Request(const HostPortPair& host_port_pair, 78 int Request(const HostPortPair& host_port_pair,
77 PrivacyMode privacy_mode, 79 PrivacyMode privacy_mode,
78 int cert_verify_flags, 80 int cert_verify_flags,
79 base::StringPiece origin_host, 81 base::StringPiece origin_host,
80 base::StringPiece method, 82 base::StringPiece method,
81 const BoundNetLog& net_log, 83 const BoundNetLog& net_log,
82 const CompletionCallback& callback); 84 const CompletionCallback& callback);
83 85
86 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is
87 // passed to CertVerifier::Verify.
88 int Request(const HostPortPair& host_port_pair,
89 PrivacyMode privacy_mode,
90 int cert_verify_flags,
91 base::StringPiece origin_host,
92 base::StringPiece method,
93 const BoundNetLog& net_log,
94 const CompletionCallback& callback,
95 bool for_bidirectional);
Ryan Hamilton 2016/02/27 00:21:14 If we need a new argument, just add it to the exis
xunjieli 2016/02/29 15:21:37 Done.
96
84 void OnRequestComplete(int rv); 97 void OnRequestComplete(int rv);
85 98
86 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It 99 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It
87 // returns the amount of time waiting job should be delayed. 100 // returns the amount of time waiting job should be delayed.
88 base::TimeDelta GetTimeDelayForWaitingJob() const; 101 base::TimeDelta GetTimeDelayForWaitingJob() const;
89 102
90 scoped_ptr<QuicHttpStream> ReleaseStream(); 103 scoped_ptr<QuicHttpStream> ReleaseStream();
91 104
92 void set_stream(scoped_ptr<QuicHttpStream> stream); 105 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM)
106 scoped_ptr<BidirectionalStreamJob> ReleaseBidirectionalStreamJob();
107 #endif
Ryan Hamilton 2016/02/27 00:21:14 oh man, I really really really don't like this #if
xunjieli 2016/02/29 15:21:38 Acknowledged. I agree it is pretty ugly. Do you ha
108
109 // Initializes |stream_| or |bidirectional_stream_job_| from |session|.
110 void InitializeStreamFromSession(QuicChromiumClientSession* session);
93 111
94 const std::string& origin_host() const { return origin_host_; } 112 const std::string& origin_host() const { return origin_host_; }
95 113
96 PrivacyMode privacy_mode() const { return privacy_mode_; } 114 PrivacyMode privacy_mode() const { return privacy_mode_; }
97 115
98 const BoundNetLog& net_log() const { return net_log_; } 116 const BoundNetLog& net_log() const { return net_log_; }
99 117
100 private: 118 private:
101 QuicStreamFactory* factory_; 119 QuicStreamFactory* factory_;
102 HostPortPair host_port_pair_; 120 HostPortPair host_port_pair_;
103 std::string origin_host_; 121 std::string origin_host_;
104 PrivacyMode privacy_mode_; 122 PrivacyMode privacy_mode_;
105 BoundNetLog net_log_; 123 BoundNetLog net_log_;
106 CompletionCallback callback_; 124 CompletionCallback callback_;
107 scoped_ptr<QuicHttpStream> stream_; 125 scoped_ptr<QuicHttpStream> stream_;
108 126
127 bool for_bidirectional_;
128 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM)
129 scoped_ptr<BidirectionalStreamJob> bidirectional_stream_job_;
130 #endif
131
109 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); 132 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest);
110 }; 133 };
111 134
112 // A factory for creating new QuicHttpStreams on top of a pool of 135 // A factory for creating new QuicHttpStreams on top of a pool of
113 // QuicChromiumClientSessions. 136 // QuicChromiumClientSessions.
114 class NET_EXPORT_PRIVATE QuicStreamFactory 137 class NET_EXPORT_PRIVATE QuicStreamFactory
115 : public NetworkChangeNotifier::IPAddressObserver, 138 : public NetworkChangeNotifier::IPAddressObserver,
116 public NetworkChangeNotifier::NetworkObserver, 139 public NetworkChangeNotifier::NetworkObserver,
117 public SSLConfigService::Observer, 140 public SSLConfigService::Observer,
118 public CertDatabase::Observer { 141 public CertDatabase::Observer {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 base::TaskRunner* task_runner_; 555 base::TaskRunner* task_runner_;
533 556
534 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 557 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
535 558
536 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 559 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
537 }; 560 };
538 561
539 } // namespace net 562 } // namespace net
540 563
541 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 564 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698