Permalink
Browse files

RefCounted types should not have public destructors, sql/ and jingle/…

… 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
rsleevi@chromium.org committed Apr 28, 2012
1 parent b8e8af7 commit 76e7db531ee9f4f3fea98029af56fb3d05e9ff88
@@ -26,7 +26,6 @@ class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify,
public base::RefCounted<Core> {
public:
Core(net::Socket* socket);
- virtual ~Core();
// Functions used to implement net::StreamSocket.
int Read(net::IOBuffer* buffer, int buffer_size,
@@ -57,6 +56,9 @@ class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify,
void DeleteSocket();
private:
+ friend class base::RefCounted<Core>;
+ virtual ~Core();
+
// These are invoked by the underlying Socket, and may trigger callbacks.
// They hold a reference to |this| while running, to protect from deletion.
void OnRead(int result);
@@ -181,8 +181,6 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
read_errors_(0) {
}
- virtual ~TCPChannelTester() { }
-
void Start() {
message_loop_->PostTask(
FROM_HERE, base::Bind(&TCPChannelTester::DoStart, this));
@@ -202,6 +200,8 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
}
protected:
+ virtual ~TCPChannelTester() {}
+
void Done() {
done_ = true;
message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
@@ -286,6 +286,8 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
}
private:
+ friend class base::RefCountedThreadSafe<TCPChannelTester>;
+
MessageLoop* message_loop_;
net::Socket* host_socket_;
net::Socket* client_socket_;
@@ -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
// found in the LICENSE file.
@@ -22,7 +22,7 @@ class StatementErrorHandler : public sql::ErrorDelegate {
StatementErrorHandler() : error_(SQLITE_OK) {}
virtual int OnError(int error, sql::Connection* connection,
- sql::Statement* stmt) {
+ sql::Statement* stmt) OVERRIDE {
error_ = error;
const char* sql_txt = stmt ? stmt->GetSQLStatement() : NULL;
sql_text_ = sql_txt ? sql_txt : "no statement available";
@@ -38,6 +38,9 @@ class StatementErrorHandler : public sql::ErrorDelegate {
const char* sql_statement() const { return sql_text_.c_str(); }
+ protected:
+ virtual ~StatementErrorHandler() {}
+
private:
int error_;
std::string sql_text_;
@@ -16,7 +16,7 @@ class StatementErrorHandler : public sql::ErrorDelegate {
StatementErrorHandler() : error_(SQLITE_OK) {}
virtual int OnError(int error, sql::Connection* connection,
- sql::Statement* stmt) {
+ sql::Statement* stmt) OVERRIDE {
error_ = error;
const char* sql_txt = stmt ? stmt->GetSQLStatement() : NULL;
sql_text_ = sql_txt ? sql_txt : "no statement available";
@@ -32,6 +32,9 @@ class StatementErrorHandler : public sql::ErrorDelegate {
const char* sql_statement() const { return sql_text_.c_str(); }
+ protected:
+ virtual ~StatementErrorHandler() {}
+
private:
int error_;
std::string sql_text_;

0 comments on commit 76e7db5

Please sign in to comment.