OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "net/http/http_pipelined_host_forced.h" | 5 #include "net/http/http_pipelined_host_forced.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "net/http/http_pipelined_connection_impl.h" | 8 #include "net/http/http_pipelined_connection_impl.h" |
9 #include "net/http/http_pipelined_stream.h" | 9 #include "net/http/http_pipelined_stream.h" |
10 #include "net/socket/buffered_write_stream_socket.h" | 10 #include "net/socket/buffered_write_stream_socket.h" |
11 #include "net/socket/client_socket_handle.h" | 11 #include "net/socket/client_socket_handle.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 HttpPipelinedHostForced::HttpPipelinedHostForced( | 15 HttpPipelinedHostForced::HttpPipelinedHostForced( |
16 HttpPipelinedHost::Delegate* delegate, | 16 HttpPipelinedHost::Delegate* delegate, |
17 const Key& key, | 17 const Key& key, |
18 HttpPipelinedConnection::Factory* factory) | 18 HttpPipelinedConnection::Factory* factory) |
19 : delegate_(delegate), | 19 : delegate_(delegate), key_(key), factory_(factory) { |
20 key_(key), | |
21 factory_(factory) { | |
22 if (!factory) { | 20 if (!factory) { |
23 factory_.reset(new HttpPipelinedConnectionImpl::Factory()); | 21 factory_.reset(new HttpPipelinedConnectionImpl::Factory()); |
24 } | 22 } |
25 } | 23 } |
26 | 24 |
27 HttpPipelinedHostForced::~HttpPipelinedHostForced() { | 25 HttpPipelinedHostForced::~HttpPipelinedHostForced() { |
28 CHECK(!pipeline_.get()); | 26 CHECK(!pipeline_.get()); |
29 } | 27 } |
30 | 28 |
31 HttpPipelinedStream* HttpPipelinedHostForced::CreateStreamOnNewPipeline( | 29 HttpPipelinedStream* HttpPipelinedHostForced::CreateStreamOnNewPipeline( |
32 ClientSocketHandle* connection, | 30 ClientSocketHandle* connection, |
33 const SSLConfig& used_ssl_config, | 31 const SSLConfig& used_ssl_config, |
34 const ProxyInfo& used_proxy_info, | 32 const ProxyInfo& used_proxy_info, |
35 const BoundNetLog& net_log, | 33 const BoundNetLog& net_log, |
36 bool was_npn_negotiated, | 34 bool was_npn_negotiated, |
37 NextProto protocol_negotiated) { | 35 NextProto protocol_negotiated) { |
38 CHECK(!pipeline_.get()); | 36 CHECK(!pipeline_.get()); |
39 scoped_ptr<BufferedWriteStreamSocket> buffered_socket( | 37 scoped_ptr<BufferedWriteStreamSocket> buffered_socket( |
40 new BufferedWriteStreamSocket(connection->PassSocket())); | 38 new BufferedWriteStreamSocket(connection->PassSocket())); |
41 connection->SetSocket(buffered_socket.PassAs<StreamSocket>()); | 39 connection->SetSocket(buffered_socket.PassAs<StreamSocket>()); |
42 pipeline_.reset(factory_->CreateNewPipeline( | 40 pipeline_.reset(factory_->CreateNewPipeline(connection, |
43 connection, this, key_.origin(), used_ssl_config, used_proxy_info, | 41 this, |
44 net_log, was_npn_negotiated, protocol_negotiated)); | 42 key_.origin(), |
| 43 used_ssl_config, |
| 44 used_proxy_info, |
| 45 net_log, |
| 46 was_npn_negotiated, |
| 47 protocol_negotiated)); |
45 return pipeline_->CreateNewStream(); | 48 return pipeline_->CreateNewStream(); |
46 } | 49 } |
47 | 50 |
48 HttpPipelinedStream* HttpPipelinedHostForced::CreateStreamOnExistingPipeline() { | 51 HttpPipelinedStream* HttpPipelinedHostForced::CreateStreamOnExistingPipeline() { |
49 if (!pipeline_.get()) { | 52 if (!pipeline_.get()) { |
50 return NULL; | 53 return NULL; |
51 } | 54 } |
52 return pipeline_->CreateNewStream(); | 55 return pipeline_->CreateNewStream(); |
53 } | 56 } |
54 | 57 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 pipeline_dict->SetInteger("capacity", 1000); | 97 pipeline_dict->SetInteger("capacity", 1000); |
95 pipeline_dict->SetBoolean("usable", pipeline_->usable()); | 98 pipeline_dict->SetBoolean("usable", pipeline_->usable()); |
96 pipeline_dict->SetBoolean("active", pipeline_->active()); | 99 pipeline_dict->SetBoolean("active", pipeline_->active()); |
97 pipeline_dict->SetInteger("source_id", pipeline_->net_log().source().id); | 100 pipeline_dict->SetInteger("source_id", pipeline_->net_log().source().id); |
98 list_value->Append(pipeline_dict); | 101 list_value->Append(pipeline_dict); |
99 } | 102 } |
100 return list_value; | 103 return list_value; |
101 } | 104 } |
102 | 105 |
103 } // namespace net | 106 } // namespace net |
OLD | NEW |