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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // A factory for creating new QuicHttpStreams on top of a pool of | 60 // A factory for creating new QuicHttpStreams on top of a pool of |
61 // QuicClientSessions. | 61 // QuicClientSessions. |
62 class NET_EXPORT_PRIVATE QuicStreamFactory { | 62 class NET_EXPORT_PRIVATE QuicStreamFactory { |
63 public: | 63 public: |
64 typedef base::Callback<uint64()> RandomUint64Callback; | 64 typedef base::Callback<uint64()> RandomUint64Callback; |
65 | 65 |
66 QuicStreamFactory(HostResolver* host_resolver, | 66 QuicStreamFactory(HostResolver* host_resolver, |
67 ClientSocketFactory* client_socket_factory, | 67 ClientSocketFactory* client_socket_factory, |
68 const RandomUint64Callback& random_uint64_callback, | 68 const RandomUint64Callback& random_uint64_callback, |
69 const QuicClock* clock); | 69 QuicClock* clock); |
70 virtual ~QuicStreamFactory(); | 70 virtual ~QuicStreamFactory(); |
71 | 71 |
72 // Creates a new QuicHttpStream to |host_port_proxy_pair| which will be | 72 // Creates a new QuicHttpStream to |host_port_proxy_pair| which will be |
73 // owned by |request|. If a matching session already exists, this | 73 // owned by |request|. If a matching session already exists, this |
74 // method will return OK. If no matching session exists, this will | 74 // method will return OK. If no matching session exists, this will |
75 // return ERR_IO_PENDING and will invoke OnRequestComplete asynchronously. | 75 // return ERR_IO_PENDING and will invoke OnRequestComplete asynchronously. |
76 int Create(const HostPortProxyPair& host_port_proxy_pair, | 76 int Create(const HostPortProxyPair& host_port_proxy_pair, |
77 const BoundNetLog& net_log, | 77 const BoundNetLog& net_log, |
78 QuicStreamRequest* request); | 78 QuicStreamRequest* request); |
79 | 79 |
(...skipping 28 matching lines...) Expand all Loading... |
108 bool HasActiveSession(const HostPortProxyPair& host_port_proxy_pair); | 108 bool HasActiveSession(const HostPortProxyPair& host_port_proxy_pair); |
109 bool HasActiveJob(const HostPortProxyPair& host_port_proxy_pair); | 109 bool HasActiveJob(const HostPortProxyPair& host_port_proxy_pair); |
110 QuicClientSession* CreateSession(const AddressList& address_list_, | 110 QuicClientSession* CreateSession(const AddressList& address_list_, |
111 const BoundNetLog& net_log); | 111 const BoundNetLog& net_log); |
112 void ActivateSession(const HostPortProxyPair& host_port_proxy_pair, | 112 void ActivateSession(const HostPortProxyPair& host_port_proxy_pair, |
113 QuicClientSession* session); | 113 QuicClientSession* session); |
114 | 114 |
115 HostResolver* host_resolver_; | 115 HostResolver* host_resolver_; |
116 ClientSocketFactory* client_socket_factory_; | 116 ClientSocketFactory* client_socket_factory_; |
117 RandomUint64Callback random_uint64_callback_; | 117 RandomUint64Callback random_uint64_callback_; |
118 const QuicClock* clock_; | 118 scoped_ptr<QuicClock> clock_; |
119 | 119 |
120 // Contains owning pointers to all sessions that currently exist. | 120 // Contains owning pointers to all sessions that currently exist. |
121 SessionSet all_sessions_; | 121 SessionSet all_sessions_; |
122 // Contains non-owning pointers to currently active session | 122 // Contains non-owning pointers to currently active session |
123 // (not going away session, once they're implemented). | 123 // (not going away session, once they're implemented). |
124 SessionMap active_sessions_; | 124 SessionMap active_sessions_; |
125 SessionAliasMap session_aliases_; | 125 SessionAliasMap session_aliases_; |
126 | 126 |
127 JobMap active_jobs_; | 127 JobMap active_jobs_; |
128 JobRequestsMap job_requests_map_; | 128 JobRequestsMap job_requests_map_; |
129 RequestMap active_requests_; | 129 RequestMap active_requests_; |
130 | 130 |
131 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 131 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
132 | 132 |
133 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 133 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
134 }; | 134 }; |
135 | 135 |
136 } // namespace net | 136 } // namespace net |
137 | 137 |
138 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 138 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |