Navigation Menu

Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
RefCounted types should not have public destructors, sql/ and jingle/…
Browse files Browse the repository at this point in the history
… edition

BUG=123295
TEST=none


Review URL: http://codereview.chromium.org/10038045

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134456 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rsleevi@chromium.org committed Apr 28, 2012
1 parent b8e8af7 commit 76e7db5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion jingle/glue/pseudotcp_adapter.cc
Expand Up @@ -26,7 +26,6 @@ class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify,
public base::RefCounted<Core> { public base::RefCounted<Core> {
public: public:
Core(net::Socket* socket); Core(net::Socket* socket);
virtual ~Core();


// Functions used to implement net::StreamSocket. // Functions used to implement net::StreamSocket.
int Read(net::IOBuffer* buffer, int buffer_size, int Read(net::IOBuffer* buffer, int buffer_size,
Expand Down Expand Up @@ -57,6 +56,9 @@ class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify,
void DeleteSocket(); void DeleteSocket();


private: private:
friend class base::RefCounted<Core>;
virtual ~Core();

// These are invoked by the underlying Socket, and may trigger callbacks. // These are invoked by the underlying Socket, and may trigger callbacks.
// They hold a reference to |this| while running, to protect from deletion. // They hold a reference to |this| while running, to protect from deletion.
void OnRead(int result); void OnRead(int result);
Expand Down
6 changes: 4 additions & 2 deletions jingle/glue/pseudotcp_adapter_unittest.cc
Expand Up @@ -181,8 +181,6 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
read_errors_(0) { read_errors_(0) {
} }


virtual ~TCPChannelTester() { }

void Start() { void Start() {
message_loop_->PostTask( message_loop_->PostTask(
FROM_HERE, base::Bind(&TCPChannelTester::DoStart, this)); FROM_HERE, base::Bind(&TCPChannelTester::DoStart, this));
Expand All @@ -202,6 +200,8 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
} }


protected: protected:
virtual ~TCPChannelTester() {}

void Done() { void Done() {
done_ = true; done_ = true;
message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
Expand Down Expand Up @@ -286,6 +286,8 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
} }


private: private:
friend class base::RefCountedThreadSafe<TCPChannelTester>;

MessageLoop* message_loop_; MessageLoop* message_loop_;
net::Socket* host_socket_; net::Socket* host_socket_;
net::Socket* client_socket_; net::Socket* client_socket_;
Expand Down
7 changes: 5 additions & 2 deletions sql/sqlite_features_unittest.cc
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.


Expand All @@ -22,7 +22,7 @@ class StatementErrorHandler : public sql::ErrorDelegate {
StatementErrorHandler() : error_(SQLITE_OK) {} StatementErrorHandler() : error_(SQLITE_OK) {}


virtual int OnError(int error, sql::Connection* connection, virtual int OnError(int error, sql::Connection* connection,
sql::Statement* stmt) { sql::Statement* stmt) OVERRIDE {
error_ = error; error_ = error;
const char* sql_txt = stmt ? stmt->GetSQLStatement() : NULL; const char* sql_txt = stmt ? stmt->GetSQLStatement() : NULL;
sql_text_ = sql_txt ? sql_txt : "no statement available"; sql_text_ = sql_txt ? sql_txt : "no statement available";
Expand All @@ -38,6 +38,9 @@ class StatementErrorHandler : public sql::ErrorDelegate {


const char* sql_statement() const { return sql_text_.c_str(); } const char* sql_statement() const { return sql_text_.c_str(); }


protected:
virtual ~StatementErrorHandler() {}

private: private:
int error_; int error_;
std::string sql_text_; std::string sql_text_;
Expand Down
5 changes: 4 additions & 1 deletion sql/statement_unittest.cc
Expand Up @@ -16,7 +16,7 @@ class StatementErrorHandler : public sql::ErrorDelegate {
StatementErrorHandler() : error_(SQLITE_OK) {} StatementErrorHandler() : error_(SQLITE_OK) {}


virtual int OnError(int error, sql::Connection* connection, virtual int OnError(int error, sql::Connection* connection,
sql::Statement* stmt) { sql::Statement* stmt) OVERRIDE {
error_ = error; error_ = error;
const char* sql_txt = stmt ? stmt->GetSQLStatement() : NULL; const char* sql_txt = stmt ? stmt->GetSQLStatement() : NULL;
sql_text_ = sql_txt ? sql_txt : "no statement available"; sql_text_ = sql_txt ? sql_txt : "no statement available";
Expand All @@ -32,6 +32,9 @@ class StatementErrorHandler : public sql::ErrorDelegate {


const char* sql_statement() const { return sql_text_.c_str(); } const char* sql_statement() const { return sql_text_.c_str(); }


protected:
virtual ~StatementErrorHandler() {}

private: private:
int error_; int error_;
std::string sql_text_; std::string sql_text_;
Expand Down

0 comments on commit 76e7db5

Please sign in to comment.