Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: net/http/http_pipelined_host.h

Issue 8833003: Revert 113315 (speculative revert for http://crbug.com/106657) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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_HTTP_HTTP_PIPELINED_HOST_H_ 5 #ifndef NET_HTTP_HTTP_PIPELINED_HOST_H_
6 #define NET_HTTP_HTTP_PIPELINED_HOST_H_ 6 #define NET_HTTP_HTTP_PIPELINED_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include "net/base/host_port_pair.h"
9 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
10 #include "net/http/http_pipelined_connection.h" 11 #include "net/http/http_pipelined_connection.h"
11 #include "net/http/http_pipelined_host_capability.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 class BoundNetLog; 15 class BoundNetLog;
16 class ClientSocketHandle; 16 class ClientSocketHandle;
17 class HostPortPair;
18 class HttpPipelinedStream; 17 class HttpPipelinedStream;
19 class ProxyInfo; 18 class ProxyInfo;
20 struct SSLConfig; 19 struct SSLConfig;
21 20
22 // Manages all of the pipelining state for specific host with active pipelined 21 // Manages all of the pipelining state for specific host with active pipelined
23 // HTTP requests. Manages connection jobs, constructs pipelined streams, and 22 // HTTP requests. Manages connection jobs, constructs pipelined streams, and
24 // assigns requests to the least loaded pipelined connection. 23 // assigns requests to the least loaded pipelined connection.
25 class NET_EXPORT_PRIVATE HttpPipelinedHost { 24 class NET_EXPORT_PRIVATE HttpPipelinedHost {
26 public: 25 public:
26 enum Capability {
27 UNKNOWN,
28 INCAPABLE,
29 CAPABLE,
30 PROBABLY_CAPABLE, // We are using pipelining, but haven't processed enough
31 // requests to record this host as known to be capable.
32 };
33
27 class Delegate { 34 class Delegate {
28 public: 35 public:
29 // Called when a pipelined host has no outstanding requests on any of its 36 // Called when a pipelined host has no outstanding requests on any of its
30 // pipelined connections. 37 // pipelined connections.
31 virtual void OnHostIdle(HttpPipelinedHost* host) = 0; 38 virtual void OnHostIdle(HttpPipelinedHost* host) = 0;
32 39
33 // Called when a pipelined host has newly available pipeline capacity, like 40 // Called when a pipelined host has newly available pipeline capacity, like
34 // when a request completes. 41 // when a request completes.
35 virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) = 0; 42 virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) = 0;
36 43
37 // Called when a host determines if pipelining can be used. 44 // Called when a host determines if pipelining can be used.
38 virtual void OnHostDeterminedCapability( 45 virtual void OnHostDeterminedCapability(HttpPipelinedHost* host,
39 HttpPipelinedHost* host, 46 Capability capability) = 0;
40 HttpPipelinedHostCapability capability) = 0;
41 }; 47 };
42 48
43 class Factory { 49 class Factory {
44 public: 50 public:
45 virtual ~Factory() {} 51 virtual ~Factory() {}
46 52
47 // Returns a new HttpPipelinedHost. 53 // Returns a new HttpPipelinedHost.
48 virtual HttpPipelinedHost* CreateNewHost( 54 virtual HttpPipelinedHost* CreateNewHost(
49 Delegate* delegate, const HostPortPair& origin, 55 Delegate* delegate, const HostPortPair& origin,
50 HttpPipelinedConnection::Factory* factory, 56 HttpPipelinedConnection::Factory* factory,
51 HttpPipelinedHostCapability capability) = 0; 57 Capability capability) = 0;
52 }; 58 };
53 59
54 virtual ~HttpPipelinedHost() {} 60 virtual ~HttpPipelinedHost() {}
55 61
56 // Constructs a new pipeline on |connection| and returns a new 62 // Constructs a new pipeline on |connection| and returns a new
57 // HttpPipelinedStream that uses it. 63 // HttpPipelinedStream that uses it.
58 virtual HttpPipelinedStream* CreateStreamOnNewPipeline( 64 virtual HttpPipelinedStream* CreateStreamOnNewPipeline(
59 ClientSocketHandle* connection, 65 ClientSocketHandle* connection,
60 const SSLConfig& used_ssl_config, 66 const SSLConfig& used_ssl_config,
61 const ProxyInfo& used_proxy_info, 67 const ProxyInfo& used_proxy_info,
62 const BoundNetLog& net_log, 68 const BoundNetLog& net_log,
63 bool was_npn_negotiated) = 0; 69 bool was_npn_negotiated) = 0;
64 70
65 // Tries to find an existing pipeline with capacity for a new request. If 71 // Tries to find an existing pipeline with capacity for a new request. If
66 // successful, returns a new stream on that pipeline. Otherwise, returns NULL. 72 // successful, returns a new stream on that pipeline. Otherwise, returns NULL.
67 virtual HttpPipelinedStream* CreateStreamOnExistingPipeline() = 0; 73 virtual HttpPipelinedStream* CreateStreamOnExistingPipeline() = 0;
68 74
69 // Returns true if we have a pipelined connection that can accept new 75 // Returns true if we have a pipelined connection that can accept new
70 // requests. 76 // requests.
71 virtual bool IsExistingPipelineAvailable() const = 0; 77 virtual bool IsExistingPipelineAvailable() const = 0;
72 78
73 // Returns the host and port associated with this class. 79 // Returns the host and port associated with this class.
74 virtual const HostPortPair& origin() const = 0; 80 virtual const HostPortPair& origin() const = 0;
75 }; 81 };
76 82
77 } // namespace net 83 } // namespace net
78 84
79 #endif // NET_HTTP_HTTP_PIPELINED_HOST_H_ 85 #endif // NET_HTTP_HTTP_PIPELINED_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/http_server_properties_manager_unittest.cc ('k') | net/http/http_pipelined_host_capability.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698