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/spdy/spdy_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include <algorithm> // min | 7 #include <algorithm> // min |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "net/spdy/spdy_http_utils.h" | 28 #include "net/spdy/spdy_http_utils.h" |
29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
30 | 30 |
31 namespace net { | 31 namespace net { |
32 | 32 |
33 SpdyProxyClientSocket::SpdyProxyClientSocket( | 33 SpdyProxyClientSocket::SpdyProxyClientSocket( |
34 const base::WeakPtr<SpdyStream>& spdy_stream, | 34 const base::WeakPtr<SpdyStream>& spdy_stream, |
35 const std::string& user_agent, | 35 const std::string& user_agent, |
36 const HostPortPair& endpoint, | 36 const HostPortPair& endpoint, |
37 const HostPortPair& proxy_server, | 37 const HostPortPair& proxy_server, |
38 const BoundNetLog& source_net_log, | 38 const NetLogWithSource& source_net_log, |
39 HttpAuthController* auth_controller) | 39 HttpAuthController* auth_controller) |
40 : next_state_(STATE_DISCONNECTED), | 40 : next_state_(STATE_DISCONNECTED), |
41 spdy_stream_(spdy_stream), | 41 spdy_stream_(spdy_stream), |
42 endpoint_(endpoint), | 42 endpoint_(endpoint), |
43 auth_(auth_controller), | 43 auth_(auth_controller), |
44 user_agent_(user_agent), | 44 user_agent_(user_agent), |
45 user_buffer_len_(0), | 45 user_buffer_len_(0), |
46 write_buffer_len_(0), | 46 write_buffer_len_(0), |
47 was_ever_used_(false), | 47 was_ever_used_(false), |
48 redirect_has_load_timing_info_(false), | 48 redirect_has_load_timing_info_(false), |
49 net_log_(BoundNetLog::Make(spdy_stream->net_log().net_log(), | 49 net_log_(NetLogWithSource::Make(spdy_stream->net_log().net_log(), |
50 NetLogSourceType::PROXY_CLIENT_SOCKET)), | 50 NetLogSourceType::PROXY_CLIENT_SOCKET)), |
51 weak_factory_(this), | 51 weak_factory_(this), |
52 write_callback_weak_factory_(this) { | 52 write_callback_weak_factory_(this) { |
53 request_.method = "CONNECT"; | 53 request_.method = "CONNECT"; |
54 request_.url = GURL("https://" + endpoint.ToString()); | 54 request_.url = GURL("https://" + endpoint.ToString()); |
55 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE, | 55 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE, |
56 source_net_log.source().ToEventParametersCallback()); | 56 source_net_log.source().ToEventParametersCallback()); |
57 net_log_.AddEvent( | 57 net_log_.AddEvent( |
58 NetLogEventType::HTTP2_PROXY_CLIENT_SESSION, | 58 NetLogEventType::HTTP2_PROXY_CLIENT_SESSION, |
59 spdy_stream->net_log().source().ToEventParametersCallback()); | 59 spdy_stream->net_log().source().ToEventParametersCallback()); |
60 | 60 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 bool SpdyProxyClientSocket::IsConnected() const { | 144 bool SpdyProxyClientSocket::IsConnected() const { |
145 return next_state_ == STATE_OPEN; | 145 return next_state_ == STATE_OPEN; |
146 } | 146 } |
147 | 147 |
148 bool SpdyProxyClientSocket::IsConnectedAndIdle() const { | 148 bool SpdyProxyClientSocket::IsConnectedAndIdle() const { |
149 return IsConnected() && read_buffer_queue_.IsEmpty() && | 149 return IsConnected() && read_buffer_queue_.IsEmpty() && |
150 spdy_stream_->IsOpen(); | 150 spdy_stream_->IsOpen(); |
151 } | 151 } |
152 | 152 |
153 const BoundNetLog& SpdyProxyClientSocket::NetLog() const { | 153 const NetLogWithSource& SpdyProxyClientSocket::NetLog() const { |
154 return net_log_; | 154 return net_log_; |
155 } | 155 } |
156 | 156 |
157 void SpdyProxyClientSocket::SetSubresourceSpeculation() { | 157 void SpdyProxyClientSocket::SetSubresourceSpeculation() { |
158 // TODO(rch): what should this implementation be? | 158 // TODO(rch): what should this implementation be? |
159 } | 159 } |
160 | 160 |
161 void SpdyProxyClientSocket::SetOmniboxSpeculation() { | 161 void SpdyProxyClientSocket::SetOmniboxSpeculation() { |
162 // TODO(rch): what should this implementation be? | 162 // TODO(rch): what should this implementation be? |
163 } | 163 } |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } else if (!read_callback_.is_null()) { | 519 } else if (!read_callback_.is_null()) { |
520 // If we have a read_callback_, the we need to make sure we call it back. | 520 // If we have a read_callback_, the we need to make sure we call it back. |
521 OnDataReceived(std::unique_ptr<SpdyBuffer>()); | 521 OnDataReceived(std::unique_ptr<SpdyBuffer>()); |
522 } | 522 } |
523 // This may have been deleted by read_callback_, so check first. | 523 // This may have been deleted by read_callback_, so check first. |
524 if (weak_ptr.get() && !write_callback.is_null()) | 524 if (weak_ptr.get() && !write_callback.is_null()) |
525 write_callback.Run(ERR_CONNECTION_CLOSED); | 525 write_callback.Run(ERR_CONNECTION_CLOSED); |
526 } | 526 } |
527 | 527 |
528 } // namespace net | 528 } // namespace net |
OLD | NEW |