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 NextProto BufferedWriteStreamSocket::GetNegotiatedProtocol() const { |
| 123 return wrapped_socket_->GetNegotiatedProtocol(); |
| 124 } |
| 125 |
122 void BufferedWriteStreamSocket::DoDelayedWrite() { | 126 void BufferedWriteStreamSocket::DoDelayedWrite() { |
123 int result = wrapped_socket_->Write( | 127 int result = wrapped_socket_->Write( |
124 io_buffer_, io_buffer_->RemainingCapacity(), | 128 io_buffer_, io_buffer_->RemainingCapacity(), |
125 base::Bind(&BufferedWriteStreamSocket::OnIOComplete, | 129 base::Bind(&BufferedWriteStreamSocket::OnIOComplete, |
126 base::Unretained(this))); | 130 base::Unretained(this))); |
127 if (result == ERR_IO_PENDING) { | 131 if (result == ERR_IO_PENDING) { |
128 callback_pending_ = true; | 132 callback_pending_ = true; |
129 wrapped_write_in_progress_ = true; | 133 wrapped_write_in_progress_ = true; |
130 } else { | 134 } else { |
131 OnIOComplete(result); | 135 OnIOComplete(result); |
(...skipping 15 matching lines...) Expand all Loading... |
147 io_buffer_->set_offset(io_buffer_->offset() + result); | 151 io_buffer_->set_offset(io_buffer_->offset() + result); |
148 if (io_buffer_->RemainingCapacity()) { | 152 if (io_buffer_->RemainingCapacity()) { |
149 DoDelayedWrite(); | 153 DoDelayedWrite(); |
150 } else { | 154 } else { |
151 io_buffer_->SetCapacity(0); | 155 io_buffer_->SetCapacity(0); |
152 } | 156 } |
153 } | 157 } |
154 } | 158 } |
155 | 159 |
156 } // namespace net | 160 } // namespace net |
OLD | NEW |