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