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/socket/buffered_write_stream_socket.h" | 5 #include "net/socket/buffered_write_stream_socket.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 int64 BufferedWriteStreamSocket::NumBytesRead() const { | 114 int64 BufferedWriteStreamSocket::NumBytesRead() const { |
115 return wrapped_socket_->NumBytesRead(); | 115 return wrapped_socket_->NumBytesRead(); |
116 } | 116 } |
117 | 117 |
118 base::TimeDelta BufferedWriteStreamSocket::GetConnectTimeMicros() const { | 118 base::TimeDelta BufferedWriteStreamSocket::GetConnectTimeMicros() const { |
119 return wrapped_socket_->GetConnectTimeMicros(); | 119 return wrapped_socket_->GetConnectTimeMicros(); |
120 } | 120 } |
121 | 121 |
| 122 bool BufferedWriteStreamSocket::WasNpnNegotiated() const { |
| 123 return wrapped_socket_->WasNpnNegotiated(); |
| 124 } |
| 125 |
122 NextProto BufferedWriteStreamSocket::GetNegotiatedProtocol() const { | 126 NextProto BufferedWriteStreamSocket::GetNegotiatedProtocol() const { |
123 return wrapped_socket_->GetNegotiatedProtocol(); | 127 return wrapped_socket_->GetNegotiatedProtocol(); |
124 } | 128 } |
125 | 129 |
| 130 bool BufferedWriteStreamSocket::GetSSLInfo(SSLInfo* ssl_info) { |
| 131 return wrapped_socket_->GetSSLInfo(ssl_info); |
| 132 } |
| 133 |
126 void BufferedWriteStreamSocket::DoDelayedWrite() { | 134 void BufferedWriteStreamSocket::DoDelayedWrite() { |
127 int result = wrapped_socket_->Write( | 135 int result = wrapped_socket_->Write( |
128 io_buffer_, io_buffer_->RemainingCapacity(), | 136 io_buffer_, io_buffer_->RemainingCapacity(), |
129 base::Bind(&BufferedWriteStreamSocket::OnIOComplete, | 137 base::Bind(&BufferedWriteStreamSocket::OnIOComplete, |
130 base::Unretained(this))); | 138 base::Unretained(this))); |
131 if (result == ERR_IO_PENDING) { | 139 if (result == ERR_IO_PENDING) { |
132 callback_pending_ = true; | 140 callback_pending_ = true; |
133 wrapped_write_in_progress_ = true; | 141 wrapped_write_in_progress_ = true; |
134 } else { | 142 } else { |
135 OnIOComplete(result); | 143 OnIOComplete(result); |
(...skipping 15 matching lines...) Expand all Loading... |
151 io_buffer_->set_offset(io_buffer_->offset() + result); | 159 io_buffer_->set_offset(io_buffer_->offset() + result); |
152 if (io_buffer_->RemainingCapacity()) { | 160 if (io_buffer_->RemainingCapacity()) { |
153 DoDelayedWrite(); | 161 DoDelayedWrite(); |
154 } else { | 162 } else { |
155 io_buffer_->SetCapacity(0); | 163 io_buffer_->SetCapacity(0); |
156 } | 164 } |
157 } | 165 } |
158 } | 166 } |
159 | 167 |
160 } // namespace net | 168 } // namespace net |
OLD | NEW |