| 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/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 351 |
| 352 ResumableTCPSocket::ResumableTCPSocket( | 352 ResumableTCPSocket::ResumableTCPSocket( |
| 353 std::unique_ptr<net::TCPClientSocket> tcp_client_socket, | 353 std::unique_ptr<net::TCPClientSocket> tcp_client_socket, |
| 354 const std::string& owner_extension_id, | 354 const std::string& owner_extension_id, |
| 355 bool is_connected) | 355 bool is_connected) |
| 356 : TCPSocket(std::move(tcp_client_socket), owner_extension_id, is_connected), | 356 : TCPSocket(std::move(tcp_client_socket), owner_extension_id, is_connected), |
| 357 persistent_(false), | 357 persistent_(false), |
| 358 buffer_size_(0), | 358 buffer_size_(0), |
| 359 paused_(false) {} | 359 paused_(false) {} |
| 360 | 360 |
| 361 ResumableTCPSocket::~ResumableTCPSocket() { |
| 362 // Despite ~TCPSocket doing basically the same, we need to disconnect |
| 363 // before ResumableTCPSocket is destroyed, because we have some extra |
| 364 // state that relies on the socket being ResumableTCPSocket, like |
| 365 // read_callback_. |
| 366 Disconnect(); |
| 367 } |
| 368 |
| 361 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } | 369 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } |
| 362 | 370 |
| 363 ResumableTCPServerSocket::ResumableTCPServerSocket( | 371 ResumableTCPServerSocket::ResumableTCPServerSocket( |
| 364 const std::string& owner_extension_id) | 372 const std::string& owner_extension_id) |
| 365 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} | 373 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} |
| 366 | 374 |
| 367 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } | 375 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } |
| 368 | 376 |
| 369 } // namespace extensions | 377 } // namespace extensions |
| OLD | NEW |