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