| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 do { | 100 do { |
| 101 if (is_connected_) | 101 if (is_connected_) |
| 102 break; | 102 break; |
| 103 | 103 |
| 104 socket_.reset( | 104 socket_.reset( |
| 105 new net::TCPClientSocket(address, NULL, net::NetLog::Source())); | 105 new net::TCPClientSocket(address, NULL, NULL, net::NetLog::Source())); |
| 106 | 106 |
| 107 connect_callback_ = callback; | 107 connect_callback_ = callback; |
| 108 result = socket_->Connect( | 108 result = socket_->Connect( |
| 109 base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this))); | 109 base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this))); |
| 110 } while (false); | 110 } while (false); |
| 111 | 111 |
| 112 if (result != net::ERR_IO_PENDING) | 112 if (result != net::ERR_IO_PENDING) |
| 113 OnConnectComplete(result); | 113 OnConnectComplete(result); |
| 114 } | 114 } |
| 115 | 115 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } | 360 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } |
| 361 | 361 |
| 362 ResumableTCPServerSocket::ResumableTCPServerSocket( | 362 ResumableTCPServerSocket::ResumableTCPServerSocket( |
| 363 const std::string& owner_extension_id) | 363 const std::string& owner_extension_id) |
| 364 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} | 364 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} |
| 365 | 365 |
| 366 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } | 366 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } |
| 367 | 367 |
| 368 } // namespace extensions | 368 } // namespace extensions |
| OLD | NEW |