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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 DCHECK(!server_socket_.get()); | 89 DCHECK(!server_socket_.get()); |
90 socket_mode_ = CLIENT; | 90 socket_mode_ = CLIENT; |
91 connect_callback_ = callback; | 91 connect_callback_ = callback; |
92 | 92 |
93 int result = net::ERR_CONNECTION_FAILED; | 93 int result = net::ERR_CONNECTION_FAILED; |
94 do { | 94 do { |
95 if (is_connected_) | 95 if (is_connected_) |
96 break; | 96 break; |
97 | 97 |
98 socket_.reset( | 98 socket_.reset( |
99 new net::TCPClientSocket(address, NULL, net::NetLog::Source())); | 99 new net::TCPClientSocket(address, NULL, NULL, net::NetLog::Source())); |
100 | 100 |
101 connect_callback_ = callback; | 101 connect_callback_ = callback; |
102 result = socket_->Connect( | 102 result = socket_->Connect( |
103 base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this))); | 103 base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this))); |
104 } while (false); | 104 } while (false); |
105 | 105 |
106 if (result != net::ERR_IO_PENDING) | 106 if (result != net::ERR_IO_PENDING) |
107 OnConnectComplete(result); | 107 OnConnectComplete(result); |
108 } | 108 } |
109 | 109 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } | 348 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } |
349 | 349 |
350 ResumableTCPServerSocket::ResumableTCPServerSocket( | 350 ResumableTCPServerSocket::ResumableTCPServerSocket( |
351 const std::string& owner_extension_id) | 351 const std::string& owner_extension_id) |
352 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} | 352 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} |
353 | 353 |
354 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } | 354 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } |
355 | 355 |
356 } // namespace extensions | 356 } // namespace extensions |
OLD | NEW |