OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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_CONNECTION_H_ |
| 6 #define NET_HTTP_HTTP_PIPELINED_CONNECTION_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "net/base/net_log.h" |
| 10 |
| 11 namespace net { |
| 12 |
| 13 class BoundNetLog; |
| 14 class ClientSocketHandle; |
| 15 class HttpStream; |
| 16 class ProxyInfo; |
| 17 class SSLConfig; |
| 18 |
| 19 class HttpPipelinedConnection { |
| 20 public: |
| 21 class Delegate { |
| 22 public: |
| 23 // Called when a pipeline has newly available capacity. This may be because |
| 24 // the first request has been sent and the pipeline is now active. Or, it |
| 25 // may be because a request successfully completed. |
| 26 virtual void OnPipelineHasCapacity(HttpPipelinedConnection* pipeline) = 0; |
| 27 }; |
| 28 |
| 29 class Factory { |
| 30 public: |
| 31 virtual HttpPipelinedConnection* CreateNewPipeline( |
| 32 ClientSocketHandle* connection, |
| 33 Delegate* delegate, |
| 34 const SSLConfig& used_ssl_config, |
| 35 const ProxyInfo& used_proxy_info, |
| 36 const BoundNetLog& net_log, |
| 37 bool was_npn_negotiated) = 0; |
| 38 }; |
| 39 |
| 40 virtual ~HttpPipelinedConnection() {} |
| 41 |
| 42 // Returns a new stream that uses this pipeline. |
| 43 virtual HttpStream* CreateNewStream() = 0; |
| 44 |
| 45 // Notifies this pipeline that a stream is no longer using it. |
| 46 virtual void OnStreamDeleted(int pipeline_id) = 0; |
| 47 |
| 48 // The number of streams currently associated with this pipeline. |
| 49 virtual int depth() const = 0; |
| 50 |
| 51 // True if this pipeline can accept new HTTP requests. False if a fatal error |
| 52 // has occurred. |
| 53 virtual bool usable() const = 0; |
| 54 |
| 55 // True if this pipeline has bound one request and is ready for additional |
| 56 // requests. |
| 57 virtual bool active() const = 0; |
| 58 |
| 59 // The SSLConfig used to establish this connection. |
| 60 virtual const SSLConfig& used_ssl_config() const = 0; |
| 61 |
| 62 // The ProxyInfo used to establish this connection. |
| 63 virtual const ProxyInfo& used_proxy_info() const = 0; |
| 64 |
| 65 // The source of this piplened connection. |
| 66 virtual const NetLog::Source& source() const = 0; |
| 67 |
| 68 // True if this connection was NPN negotiated. |
| 69 virtual bool was_npn_negotiated() const = 0; |
| 70 }; |
| 71 |
| 72 } // namespace net |
| 73 |
| 74 #endif // NET_HTTP_HTTP_PIPELINED_CONNECTION_H_ |
OLD | NEW |