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 "content/browser/renderer_host/pepper/pepper_tcp_socket.h" | 5 #include "content/browser/renderer_host/pepper/pepper_tcp_socket.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return; | 212 return; |
213 } | 213 } |
214 | 214 |
215 write_buffer_base_ = new net::IOBuffer(data_size); | 215 write_buffer_base_ = new net::IOBuffer(data_size); |
216 memcpy(write_buffer_base_->data(), data.data(), data_size); | 216 memcpy(write_buffer_base_->data(), data.data(), data_size); |
217 write_buffer_ = | 217 write_buffer_ = |
218 new net::DrainableIOBuffer(write_buffer_base_.get(), data_size); | 218 new net::DrainableIOBuffer(write_buffer_base_.get(), data_size); |
219 DoWrite(); | 219 DoWrite(); |
220 } | 220 } |
221 | 221 |
222 void PepperTCPSocket::SetOption(PP_TCPSocket_Option_Dev name, | 222 void PepperTCPSocket::SetOption(PP_TCPSocket_Option name, |
223 const ppapi::SocketOptionData& value) { | 223 const ppapi::SocketOptionData& value) { |
224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
225 | 225 |
226 if (!IsConnected() || IsSsl()) { | 226 if (!IsConnected() || IsSsl()) { |
227 SendSetOptionACK(PP_ERROR_FAILED); | 227 SendSetOptionACK(PP_ERROR_FAILED); |
228 return; | 228 return; |
229 } | 229 } |
230 | 230 |
231 net::TCPClientSocket* tcp_socket = | 231 net::TCPClientSocket* tcp_socket = |
232 static_cast<net::TCPClientSocket*>(socket_.get()); | 232 static_cast<net::TCPClientSocket*>(socket_.get()); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 516 |
517 int net_result = socket_->Write( | 517 int net_result = socket_->Write( |
518 write_buffer_.get(), | 518 write_buffer_.get(), |
519 write_buffer_->BytesRemaining(), | 519 write_buffer_->BytesRemaining(), |
520 base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this))); | 520 base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this))); |
521 if (net_result != net::ERR_IO_PENDING) | 521 if (net_result != net::ERR_IO_PENDING) |
522 OnWriteCompleted(net_result); | 522 OnWriteCompleted(net_result); |
523 } | 523 } |
524 | 524 |
525 } // namespace content | 525 } // namespace content |
OLD | NEW |