summaryrefslogtreecommitdiffstats
path: root/jingle
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-11 22:27:54 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-11 22:27:54 +0000
commit870bcb302d6597636fee73cd7bac110664b5a51d (patch)
treeba441b6275c472d77b3b4e9f0d64d8a9ab2017a6 /jingle
parent00cee28d45333558a3b7d842923d8e2eb07d7696 (diff)
downloadchromium_src-870bcb302d6597636fee73cd7bac110664b5a51d.zip
chromium_src-870bcb302d6597636fee73cd7bac110664b5a51d.tar.gz
chromium_src-870bcb302d6597636fee73cd7bac110664b5a51d.tar.bz2
RefCounted types should not have public destructors - sync and jingle
In the process of ensuring no base classes for RefCounted classes have public destructors, base::NonThreadSafe shows up frequently due to having a public destructor. Begin migrating all the code that has a base::NonThreadSafe member to directly inheriting from base::NonThreadSafe, so that base::NonThreadSafe's destructor can be made private. BUG=123295 TEST=existing Review URL: https://chromiumcodereview.appspot.com/10411046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r--jingle/notifier/base/task_pump.cc10
-rw-r--r--jingle/notifier/base/task_pump.h5
-rw-r--r--jingle/notifier/base/weak_xmpp_client.cc10
-rw-r--r--jingle/notifier/base/weak_xmpp_client.h5
-rw-r--r--jingle/notifier/base/xmpp_connection.cc8
-rw-r--r--jingle/notifier/base/xmpp_connection.h5
-rw-r--r--jingle/notifier/communicator/login.h5
-rw-r--r--jingle/notifier/listener/push_notifications_listen_task.h9
8 files changed, 29 insertions, 28 deletions
diff --git a/jingle/notifier/base/task_pump.cc b/jingle/notifier/base/task_pump.cc
index 001f1ab..a282478 100644
--- a/jingle/notifier/base/task_pump.cc
+++ b/jingle/notifier/base/task_pump.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
// found in the LICENSE file.
@@ -14,11 +14,11 @@ TaskPump::TaskPump()
stopped_(false) {}
TaskPump::~TaskPump() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
}
void TaskPump::WakeTasks() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
if (!stopped_ && !posted_wake_) {
MessageLoop* current_message_loop = MessageLoop::current();
CHECK(current_message_loop);
@@ -31,7 +31,7 @@ void TaskPump::WakeTasks() {
}
int64 TaskPump::CurrentTime() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
// Only timeout tasks rely on this function. Since we're not using
// libjingle tasks for timeout, it's safe to return 0 here.
return 0;
@@ -42,7 +42,7 @@ void TaskPump::Stop() {
}
void TaskPump::CheckAndRunTasks() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
if (stopped_) {
return;
}
diff --git a/jingle/notifier/base/task_pump.h b/jingle/notifier/base/task_pump.h
index 08f67f7..ee18fbe 100644
--- a/jingle/notifier/base/task_pump.h
+++ b/jingle/notifier/base/task_pump.h
@@ -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.
@@ -12,7 +12,7 @@
namespace notifier {
-class TaskPump : public talk_base::TaskRunner {
+class TaskPump : public talk_base::TaskRunner, public base::NonThreadSafe {
public:
TaskPump();
@@ -29,7 +29,6 @@ class TaskPump : public talk_base::TaskRunner {
private:
void CheckAndRunTasks();
- base::NonThreadSafe non_thread_safe_;
base::WeakPtrFactory<TaskPump> weak_factory_;
bool posted_wake_;
bool stopped_;
diff --git a/jingle/notifier/base/weak_xmpp_client.cc b/jingle/notifier/base/weak_xmpp_client.cc
index 4eedd9f..9a6e382 100644
--- a/jingle/notifier/base/weak_xmpp_client.cc
+++ b/jingle/notifier/base/weak_xmpp_client.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 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.
@@ -13,12 +13,12 @@ WeakXmppClient::WeakXmppClient(talk_base::TaskParent* parent)
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {}
WeakXmppClient::~WeakXmppClient() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
Invalidate();
}
void WeakXmppClient::Invalidate() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
// We don't want XmppClient raising any signals once its invalidated.
SignalStateChange.disconnect_all();
SignalLogInput.disconnect_all();
@@ -27,12 +27,12 @@ void WeakXmppClient::Invalidate() {
}
base::WeakPtr<WeakXmppClient> WeakXmppClient::AsWeakPtr() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
return weak_ptr_factory_.GetWeakPtr();
}
void WeakXmppClient::Stop() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
// We don't want XmppClient used after it has been stopped.
Invalidate();
buzz::XmppClient::Stop();
diff --git a/jingle/notifier/base/weak_xmpp_client.h b/jingle/notifier/base/weak_xmpp_client.h
index 491d3d7..4549688 100644
--- a/jingle/notifier/base/weak_xmpp_client.h
+++ b/jingle/notifier/base/weak_xmpp_client.h
@@ -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.
//
@@ -25,7 +25,7 @@ namespace notifier {
// buzz::XmppClient's destructor isn't marked virtual, but it inherits
// from talk_base::Task, whose destructor *is* marked virtual, so we
// can safely inherit from it.
-class WeakXmppClient : public buzz::XmppClient {
+class WeakXmppClient : public buzz::XmppClient, public base::NonThreadSafe {
public:
explicit WeakXmppClient(talk_base::TaskParent* parent);
@@ -44,7 +44,6 @@ class WeakXmppClient : public buzz::XmppClient {
virtual void Stop() OVERRIDE;
private:
- base::NonThreadSafe non_thread_safe_;
// We use our own WeakPtrFactory instead of inheriting from
// SupportsWeakPtr since we want to invalidate in other places
// besides the destructor.
diff --git a/jingle/notifier/base/xmpp_connection.cc b/jingle/notifier/base/xmpp_connection.cc
index 6df0de8..8ecdd9b 100644
--- a/jingle/notifier/base/xmpp_connection.cc
+++ b/jingle/notifier/base/xmpp_connection.cc
@@ -77,7 +77,7 @@ XmppConnection::XmppConnection(
}
XmppConnection::~XmppConnection() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
ClearClient();
task_pump_->Stop();
MessageLoop* current_message_loop = MessageLoop::current();
@@ -90,7 +90,7 @@ XmppConnection::~XmppConnection() {
}
void XmppConnection::OnStateChange(buzz::XmppEngine::State state) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
VLOG(1) << "XmppClient state changed to " << state;
if (!weak_xmpp_client_.get()) {
LOG(DFATAL) << "weak_xmpp_client_ unexpectedly NULL";
@@ -128,12 +128,12 @@ void XmppConnection::OnStateChange(buzz::XmppEngine::State state) {
}
void XmppConnection::OnInputLog(const char* data, int len) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
VLOG(2) << "XMPP Input: " << base::StringPiece(data, len);
}
void XmppConnection::OnOutputLog(const char* data, int len) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
VLOG(2) << "XMPP Output: " << base::StringPiece(data, len);
}
diff --git a/jingle/notifier/base/xmpp_connection.h b/jingle/notifier/base/xmpp_connection.h
index 9baea68..da07e43 100644
--- a/jingle/notifier/base/xmpp_connection.h
+++ b/jingle/notifier/base/xmpp_connection.h
@@ -30,7 +30,9 @@ namespace notifier {
class TaskPump;
class WeakXmppClient;
-class XmppConnection : public sigslot::has_slots<> {
+class XmppConnection
+ : public sigslot::has_slots<>,
+ public base::NonThreadSafe {
public:
class Delegate {
public:
@@ -82,7 +84,6 @@ class XmppConnection : public sigslot::has_slots<> {
void ClearClient();
- base::NonThreadSafe non_thread_safe_;
scoped_ptr<TaskPump> task_pump_;
base::WeakPtr<WeakXmppClient> weak_xmpp_client_;
bool on_connect_called_;
diff --git a/jingle/notifier/communicator/login.h b/jingle/notifier/communicator/login.h
index d0667b1..d089cb6d6 100644
--- a/jingle/notifier/communicator/login.h
+++ b/jingle/notifier/communicator/login.h
@@ -45,11 +45,12 @@ class Login : public net::NetworkChangeNotifier::IPAddressObserver,
public:
class Delegate {
public:
- virtual ~Delegate() {}
-
virtual void OnConnect(
base::WeakPtr<buzz::XmppTaskParentInterface> base_task) = 0;
virtual void OnDisconnect() = 0;
+
+ protected:
+ virtual ~Delegate() {}
};
// Does not take ownership of |delegate|, which must not be NULL.
diff --git a/jingle/notifier/listener/push_notifications_listen_task.h b/jingle/notifier/listener/push_notifications_listen_task.h
index 7d41a8b..daf48d9 100644
--- a/jingle/notifier/listener/push_notifications_listen_task.h
+++ b/jingle/notifier/listener/push_notifications_listen_task.h
@@ -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.
//
@@ -28,9 +28,10 @@ class PushNotificationsListenTask : public buzz::XmppTask {
public:
class Delegate {
public:
- virtual ~Delegate() {}
- virtual void OnNotificationReceived(
- const Notification& notification) = 0;
+ virtual void OnNotificationReceived(const Notification& notification) = 0;
+
+ protected:
+ virtual ~Delegate() {}
};
PushNotificationsListenTask(buzz::XmppTaskParentInterface* parent,