Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: extensions/browser/api/socket/tcp_socket.cc

Issue 2034233002: Fix ResumableTCPSocket destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/api/socket/tcp_socket.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « extensions/browser/api/socket/tcp_socket.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698