OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_HTTP_HTTP_PIPELINED_HOST_FORCED_H_ | |
6 #define NET_HTTP_HTTP_PIPELINED_HOST_FORCED_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "net/base/host_port_pair.h" | |
13 #include "net/base/net_export.h" | |
14 #include "net/http/http_pipelined_connection.h" | |
15 #include "net/http/http_pipelined_host.h" | |
16 #include "net/http/http_pipelined_host_capability.h" | |
17 | |
18 namespace base { | |
19 class Value; | |
20 } | |
21 | |
22 namespace net { | |
23 | |
24 class BoundNetLog; | |
25 class ClientSocketHandle; | |
26 class HttpPipelinedStream; | |
27 class ProxyInfo; | |
28 struct SSLConfig; | |
29 | |
30 // Manages a single pipelined connection for requests to a host that are forced | |
31 // to use pipelining. Note that this is normally not used. It is intended to | |
32 // test the user's connection for pipelining compatibility. | |
33 class NET_EXPORT_PRIVATE HttpPipelinedHostForced | |
34 : public HttpPipelinedHost, | |
35 public HttpPipelinedConnection::Delegate { | |
36 public: | |
37 HttpPipelinedHostForced(HttpPipelinedHost::Delegate* delegate, | |
38 const Key& key, | |
39 HttpPipelinedConnection::Factory* factory); | |
40 virtual ~HttpPipelinedHostForced(); | |
41 | |
42 // HttpPipelinedHost interface | |
43 virtual HttpPipelinedStream* CreateStreamOnNewPipeline( | |
44 ClientSocketHandle* connection, | |
45 const SSLConfig& used_ssl_config, | |
46 const ProxyInfo& used_proxy_info, | |
47 const BoundNetLog& net_log, | |
48 bool was_npn_negotiated, | |
49 NextProto protocol_negotiated) OVERRIDE; | |
50 | |
51 virtual HttpPipelinedStream* CreateStreamOnExistingPipeline() OVERRIDE; | |
52 | |
53 virtual bool IsExistingPipelineAvailable() const OVERRIDE; | |
54 | |
55 virtual const Key& GetKey() const OVERRIDE; | |
56 | |
57 virtual base::Value* PipelineInfoToValue() const OVERRIDE; | |
58 | |
59 // HttpPipelinedConnection::Delegate interface | |
60 | |
61 virtual void OnPipelineHasCapacity( | |
62 HttpPipelinedConnection* pipeline) OVERRIDE; | |
63 | |
64 virtual void OnPipelineFeedback( | |
65 HttpPipelinedConnection* pipeline, | |
66 HttpPipelinedConnection::Feedback feedback) OVERRIDE; | |
67 | |
68 private: | |
69 // Called when a pipeline is empty and there are no pending requests. Closes | |
70 // the connection. | |
71 void OnPipelineEmpty(HttpPipelinedConnection* pipeline); | |
72 | |
73 HttpPipelinedHost::Delegate* delegate_; | |
74 const Key key_; | |
75 scoped_ptr<HttpPipelinedConnection> pipeline_; | |
76 scoped_ptr<HttpPipelinedConnection::Factory> factory_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostForced); | |
79 }; | |
80 | |
81 } // namespace net | |
82 | |
83 #endif // NET_HTTP_HTTP_PIPELINED_HOST_FORCED_H_ | |
OLD | NEW |