| OLD | NEW |
| 1 // Copyright (c) 2011 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_tcp_socket.h" | 5 #include "content/browser/renderer_host/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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 37 uint32 socket_id) | 37 uint32 socket_id) |
| 38 : manager_(manager), | 38 : manager_(manager), |
| 39 routing_id_(routing_id), | 39 routing_id_(routing_id), |
| 40 plugin_dispatcher_id_(plugin_dispatcher_id), | 40 plugin_dispatcher_id_(plugin_dispatcher_id), |
| 41 socket_id_(socket_id), | 41 socket_id_(socket_id), |
| 42 connection_state_(BEFORE_CONNECT), | 42 connection_state_(BEFORE_CONNECT), |
| 43 end_of_file_reached_(false) { | 43 end_of_file_reached_(false) { |
| 44 DCHECK(manager); | 44 DCHECK(manager); |
| 45 } | 45 } |
| 46 | 46 |
| 47 PepperTCPSocket::PepperTCPSocket( |
| 48 PepperMessageFilter* manager, |
| 49 int32 routing_id, |
| 50 uint32 plugin_dispatcher_id, |
| 51 uint32 socket_id, |
| 52 net::StreamSocket* socket) |
| 53 : manager_(manager), |
| 54 routing_id_(routing_id), |
| 55 plugin_dispatcher_id_(plugin_dispatcher_id), |
| 56 socket_id_(socket_id), |
| 57 connection_state_(CONNECTED), |
| 58 end_of_file_reached_(false), |
| 59 socket_(socket) { |
| 60 DCHECK(manager); |
| 61 } |
| 62 |
| 47 PepperTCPSocket::~PepperTCPSocket() { | 63 PepperTCPSocket::~PepperTCPSocket() { |
| 48 // Make sure no further callbacks from socket_. | 64 // Make sure no further callbacks from socket_. |
| 49 if (socket_.get()) | 65 if (socket_.get()) |
| 50 socket_->Disconnect(); | 66 socket_->Disconnect(); |
| 51 } | 67 } |
| 52 | 68 |
| 53 void PepperTCPSocket::Connect(const std::string& host, uint16_t port) { | 69 void PepperTCPSocket::Connect(const std::string& host, uint16_t port) { |
| 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 55 | 71 |
| 56 if (connection_state_ != BEFORE_CONNECT) { | 72 if (connection_state_ != BEFORE_CONNECT) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 routing_id_, plugin_dispatcher_id_, socket_id_, true, result)); | 293 routing_id_, plugin_dispatcher_id_, socket_id_, true, result)); |
| 278 } else { | 294 } else { |
| 279 SendWriteACKError(); | 295 SendWriteACKError(); |
| 280 } | 296 } |
| 281 write_buffer_ = NULL; | 297 write_buffer_ = NULL; |
| 282 } | 298 } |
| 283 | 299 |
| 284 bool PepperTCPSocket::IsConnected() const { | 300 bool PepperTCPSocket::IsConnected() const { |
| 285 return connection_state_ == CONNECTED || connection_state_ == SSL_CONNECTED; | 301 return connection_state_ == CONNECTED || connection_state_ == SSL_CONNECTED; |
| 286 } | 302 } |
| OLD | NEW |