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

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

Issue 7289006: Basic HTTP pipelining support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added about:flags entry Created 9 years, 5 months 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
(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 // Manages all of the pipelining state for specific host with active pipelined
6 // HTTP requests. Manages connection jobs, constructs pipelined streams, and
7 // assigns requests to the least loaded pipelined connection.
8
9 #ifndef NET_HTTP_HTTP_PIPELINED_HOST_H_
10 #define NET_HTTP_HTTP_PIPELINED_HOST_H_
11 #pragma once
12
13 #include <set>
14 #include <string>
15
16 #include "net/base/host_port_pair.h"
17
18 namespace net {
19
20 class BoundNetLog;
21 class ClientSocketHandle;
22 class HttpPipelinedConnection;
23 class HttpPipelinedHostPool;
24 class ProxyInfo;
25 class SSLConfig;
26
27 class HttpPipelinedHost {
28 public:
29 HttpPipelinedHost(HttpPipelinedHostPool* pool,
30 const HostPortPair& origin);
31 ~HttpPipelinedHost();
32
33 HttpPipelinedConnection* CreateNewPipeline(ClientSocketHandle* connection,
34 const SSLConfig& used_ssl_config,
35 const ProxyInfo& used_proxy_info,
36 const BoundNetLog& net_log,
37 bool was_npn_negotiated);
38
39 HttpPipelinedConnection* FindAvailablePipeline();
40
41 // Callbacks for HttpPipelinedConnection.
42
43 // Called when a pipelined connection completes a request. Adds a pending
44 // request to the pipeline if the pipeline is still usable.
45 void OnPipelineHasCapacity(HttpPipelinedConnection* pipeline);
46
47 const HostPortPair& origin() const { return origin_; }
48
49 private:
50 // Called when a pipeline is empty and there are no pending requests. Closes
51 // the connection.
52 void OnPipelineEmpty(HttpPipelinedConnection* pipeline);
53
54 // Adds the next pending request to the pipeline if it's still usuable.
55 void AddRequestToPipeline(HttpPipelinedConnection* connection);
56
57 int max_pipeline_depth() const { return 3; }
58
59 HttpPipelinedHostPool* pool_;
60 const HostPortPair origin_;
61 std::set<HttpPipelinedConnection*> pipelines_;
62
63 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHost);
64 };
65
66 } // namespace net
67
68 #endif // NET_HTTP_HTTP_PIPELINED_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698