| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/socket/tcp_socket.h" | 5 #include "extensions/browser/api/socket/tcp_socket.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "extensions/browser/api/api_resource.h" | 10 #include "extensions/browser/api/api_resource.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| 95 DCHECK(!server_socket_.get()); | 95 DCHECK(!server_socket_.get()); |
| 96 socket_mode_ = CLIENT; | 96 socket_mode_ = CLIENT; |
| 97 connect_callback_ = callback; | 97 connect_callback_ = callback; |
| 98 | 98 |
| 99 int result = net::ERR_CONNECTION_FAILED; | 99 int result = net::ERR_CONNECTION_FAILED; |
| 100 if (!is_connected_) { | 100 if (!is_connected_) { |
| 101 socket_.reset( | 101 socket_.reset( |
| 102 new net::TCPClientSocket(address, NULL, net::NetLog::Source())); | 102 new net::TCPClientSocket(address, NULL, NULL, net::NetLog::Source())); |
| 103 result = socket_->Connect( | 103 result = socket_->Connect( |
| 104 base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this))); | 104 base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this))); |
| 105 } | 105 } |
| 106 | 106 |
| 107 if (result != net::ERR_IO_PENDING) | 107 if (result != net::ERR_IO_PENDING) |
| 108 OnConnectComplete(result); | 108 OnConnectComplete(result); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void TCPSocket::Disconnect() { | 111 void TCPSocket::Disconnect() { |
| 112 is_connected_ = false; | 112 is_connected_ = false; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } | 355 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } |
| 356 | 356 |
| 357 ResumableTCPServerSocket::ResumableTCPServerSocket( | 357 ResumableTCPServerSocket::ResumableTCPServerSocket( |
| 358 const std::string& owner_extension_id) | 358 const std::string& owner_extension_id) |
| 359 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} | 359 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} |
| 360 | 360 |
| 361 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } | 361 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } |
| 362 | 362 |
| 363 } // namespace extensions | 363 } // namespace extensions |
| OLD | NEW |