OLD | NEW |
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/http/http_stream_factory.h" |
27 #include "net/log/net_log.h" | 28 #include "net/log/net_log.h" |
| 29 #include "net/net_features.h" |
28 #include "net/proxy/proxy_server.h" | 30 #include "net/proxy/proxy_server.h" |
29 #include "net/quic/network_connection.h" | 31 #include "net/quic/network_connection.h" |
30 #include "net/quic/quic_chromium_client_session.h" | 32 #include "net/quic/quic_chromium_client_session.h" |
31 #include "net/quic/quic_client_push_promise_index.h" | 33 #include "net/quic/quic_client_push_promise_index.h" |
32 #include "net/quic/quic_config.h" | 34 #include "net/quic/quic_config.h" |
33 #include "net/quic/quic_crypto_stream.h" | 35 #include "net/quic/quic_crypto_stream.h" |
34 #include "net/quic/quic_http_stream.h" | 36 #include "net/quic/quic_http_stream.h" |
35 #include "net/quic/quic_protocol.h" | 37 #include "net/quic/quic_protocol.h" |
36 #include "net/ssl/ssl_config_service.h" | 38 #include "net/ssl/ssl_config_service.h" |
37 | 39 |
(...skipping 10 matching lines...) Expand all Loading... |
48 class QuicChromiumClientSession; | 50 class QuicChromiumClientSession; |
49 class QuicChromiumConnectionHelper; | 51 class QuicChromiumConnectionHelper; |
50 class QuicCryptoClientStreamFactory; | 52 class QuicCryptoClientStreamFactory; |
51 class QuicRandom; | 53 class QuicRandom; |
52 class QuicServerId; | 54 class QuicServerId; |
53 class QuicServerInfo; | 55 class QuicServerInfo; |
54 class QuicServerInfoFactory; | 56 class QuicServerInfoFactory; |
55 class QuicStreamFactory; | 57 class QuicStreamFactory; |
56 class SocketPerformanceWatcherFactory; | 58 class SocketPerformanceWatcherFactory; |
57 class TransportSecurityState; | 59 class TransportSecurityState; |
| 60 class BidirectionalStreamJob; |
58 | 61 |
59 namespace test { | 62 namespace test { |
60 class QuicStreamFactoryPeer; | 63 class QuicStreamFactoryPeer; |
61 } // namespace test | 64 } // namespace test |
62 | 65 |
63 // When a connection is idle for 30 seconds it will be closed. | 66 // When a connection is idle for 30 seconds it will be closed. |
64 const int kIdleConnectionTimeoutSeconds = 30; | 67 const int kIdleConnectionTimeoutSeconds = 30; |
65 | 68 |
66 // Encapsulates a pending request for a QuicHttpStream. | 69 // Encapsulates a pending request for a QuicHttpStream. |
67 // If the request is still pending when it is destroyed, it will | 70 // If the request is still pending when it is destroyed, it will |
(...skipping 12 matching lines...) Expand all Loading... |
80 base::StringPiece method, | 83 base::StringPiece method, |
81 const BoundNetLog& net_log, | 84 const BoundNetLog& net_log, |
82 const CompletionCallback& callback); | 85 const CompletionCallback& callback); |
83 | 86 |
84 void OnRequestComplete(int rv); | 87 void OnRequestComplete(int rv); |
85 | 88 |
86 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It | 89 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It |
87 // returns the amount of time waiting job should be delayed. | 90 // returns the amount of time waiting job should be delayed. |
88 base::TimeDelta GetTimeDelayForWaitingJob() const; | 91 base::TimeDelta GetTimeDelayForWaitingJob() const; |
89 | 92 |
90 scoped_ptr<QuicHttpStream> ReleaseStream(); | 93 scoped_ptr<QuicHttpStream> CreateStream(); |
91 | 94 |
92 void set_stream(scoped_ptr<QuicHttpStream> stream); | 95 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
| 96 scoped_ptr<BidirectionalStreamJob> CreateBidirectionalStreamJob(); |
| 97 #endif |
| 98 |
| 99 // Sets |session_|. |
| 100 void SetSession(QuicChromiumClientSession* session); |
93 | 101 |
94 const std::string& origin_host() const { return origin_host_; } | 102 const std::string& origin_host() const { return origin_host_; } |
95 | 103 |
96 PrivacyMode privacy_mode() const { return privacy_mode_; } | 104 PrivacyMode privacy_mode() const { return privacy_mode_; } |
97 | 105 |
98 const BoundNetLog& net_log() const { return net_log_; } | 106 const BoundNetLog& net_log() const { return net_log_; } |
99 | 107 |
100 private: | 108 private: |
101 QuicStreamFactory* factory_; | 109 QuicStreamFactory* factory_; |
102 HostPortPair host_port_pair_; | 110 HostPortPair host_port_pair_; |
103 std::string origin_host_; | 111 std::string origin_host_; |
104 string url_; | 112 string url_; |
105 PrivacyMode privacy_mode_; | 113 PrivacyMode privacy_mode_; |
106 BoundNetLog net_log_; | 114 BoundNetLog net_log_; |
107 CompletionCallback callback_; | 115 CompletionCallback callback_; |
108 scoped_ptr<QuicHttpStream> stream_; | 116 base::WeakPtr<QuicChromiumClientSession> session_; |
109 | 117 |
110 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); | 118 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); |
111 }; | 119 }; |
112 | 120 |
113 // A factory for creating new QuicHttpStreams on top of a pool of | 121 // A factory for creating new QuicHttpStreams on top of a pool of |
114 // QuicChromiumClientSessions. | 122 // QuicChromiumClientSessions. |
115 class NET_EXPORT_PRIVATE QuicStreamFactory | 123 class NET_EXPORT_PRIVATE QuicStreamFactory |
116 : public NetworkChangeNotifier::IPAddressObserver, | 124 : public NetworkChangeNotifier::IPAddressObserver, |
117 public NetworkChangeNotifier::NetworkObserver, | 125 public NetworkChangeNotifier::NetworkObserver, |
118 public SSLConfigService::Observer, | 126 public SSLConfigService::Observer, |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 base::TaskRunner* task_runner_; | 559 base::TaskRunner* task_runner_; |
552 | 560 |
553 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 561 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
554 | 562 |
555 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 563 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
556 }; | 564 }; |
557 | 565 |
558 } // namespace net | 566 } // namespace net |
559 | 567 |
560 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 568 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |