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

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

Issue 8770035: Save pipelining capabilities for the most used hosts between sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged 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"
10 #include "net/base/net_export.h" 9 #include "net/base/net_export.h"
11 #include "net/http/http_pipelined_connection.h" 10 #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;
17 class HttpPipelinedStream; 18 class HttpPipelinedStream;
18 class ProxyInfo; 19 class ProxyInfo;
19 struct SSLConfig; 20 struct SSLConfig;
20 21
21 // Manages all of the pipelining state for specific host with active pipelined 22 // Manages all of the pipelining state for specific host with active pipelined
22 // HTTP requests. Manages connection jobs, constructs pipelined streams, and 23 // HTTP requests. Manages connection jobs, constructs pipelined streams, and
23 // assigns requests to the least loaded pipelined connection. 24 // assigns requests to the least loaded pipelined connection.
24 class NET_EXPORT_PRIVATE HttpPipelinedHost { 25 class NET_EXPORT_PRIVATE HttpPipelinedHost {
25 public: 26 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
34 class Delegate { 27 class Delegate {
35 public: 28 public:
36 // Called when a pipelined host has no outstanding requests on any of its 29 // Called when a pipelined host has no outstanding requests on any of its
37 // pipelined connections. 30 // pipelined connections.
38 virtual void OnHostIdle(HttpPipelinedHost* host) = 0; 31 virtual void OnHostIdle(HttpPipelinedHost* host) = 0;
39 32
40 // Called when a pipelined host has newly available pipeline capacity, like 33 // Called when a pipelined host has newly available pipeline capacity, like
41 // when a request completes. 34 // when a request completes.
42 virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) = 0; 35 virtual void OnHostHasAdditionalCapacity(HttpPipelinedHost* host) = 0;
43 36
44 // Called when a host determines if pipelining can be used. 37 // Called when a host determines if pipelining can be used.
45 virtual void OnHostDeterminedCapability(HttpPipelinedHost* host, 38 virtual void OnHostDeterminedCapability(
46 Capability capability) = 0; 39 HttpPipelinedHost* host,
40 HttpPipelinedHostCapability capability) = 0;
47 }; 41 };
48 42
49 class Factory { 43 class Factory {
50 public: 44 public:
51 virtual ~Factory() {} 45 virtual ~Factory() {}
52 46
53 // Returns a new HttpPipelinedHost. 47 // Returns a new HttpPipelinedHost.
54 virtual HttpPipelinedHost* CreateNewHost( 48 virtual HttpPipelinedHost* CreateNewHost(
55 Delegate* delegate, const HostPortPair& origin, 49 Delegate* delegate, const HostPortPair& origin,
56 HttpPipelinedConnection::Factory* factory, 50 HttpPipelinedConnection::Factory* factory,
57 Capability capability) = 0; 51 HttpPipelinedHostCapability capability) = 0;
58 }; 52 };
59 53
60 virtual ~HttpPipelinedHost() {} 54 virtual ~HttpPipelinedHost() {}
61 55
62 // Constructs a new pipeline on |connection| and returns a new 56 // Constructs a new pipeline on |connection| and returns a new
63 // HttpPipelinedStream that uses it. 57 // HttpPipelinedStream that uses it.
64 virtual HttpPipelinedStream* CreateStreamOnNewPipeline( 58 virtual HttpPipelinedStream* CreateStreamOnNewPipeline(
65 ClientSocketHandle* connection, 59 ClientSocketHandle* connection,
66 const SSLConfig& used_ssl_config, 60 const SSLConfig& used_ssl_config,
67 const ProxyInfo& used_proxy_info, 61 const ProxyInfo& used_proxy_info,
68 const BoundNetLog& net_log, 62 const BoundNetLog& net_log,
69 bool was_npn_negotiated) = 0; 63 bool was_npn_negotiated) = 0;
70 64
71 // Tries to find an existing pipeline with capacity for a new request. If 65 // Tries to find an existing pipeline with capacity for a new request. If
72 // successful, returns a new stream on that pipeline. Otherwise, returns NULL. 66 // successful, returns a new stream on that pipeline. Otherwise, returns NULL.
73 virtual HttpPipelinedStream* CreateStreamOnExistingPipeline() = 0; 67 virtual HttpPipelinedStream* CreateStreamOnExistingPipeline() = 0;
74 68
75 // Returns true if we have a pipelined connection that can accept new 69 // Returns true if we have a pipelined connection that can accept new
76 // requests. 70 // requests.
77 virtual bool IsExistingPipelineAvailable() const = 0; 71 virtual bool IsExistingPipelineAvailable() const = 0;
78 72
79 // Returns the host and port associated with this class. 73 // Returns the host and port associated with this class.
80 virtual const HostPortPair& origin() const = 0; 74 virtual const HostPortPair& origin() const = 0;
81 }; 75 };
82 76
83 } // namespace net 77 } // namespace net
84 78
85 #endif // NET_HTTP_HTTP_PIPELINED_HOST_H_ 79 #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