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

Unified Diff: base/message_loop_unittest.cc

Issue 10065037: RefCounted types should not have public destructors, base/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Typo fix Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/ref_counted_unittest.cc ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop_unittest.cc
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index d1e921cc0029780a5cff49c55eb760cf350e350f..15f825b7ac992eb791ecc2332819e7a03b160896 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -397,6 +397,11 @@ class RecordDeletionProbe : public base::RefCounted<RecordDeletionProbe> {
RecordDeletionProbe(RecordDeletionProbe* post_on_delete, bool* was_deleted)
: post_on_delete_(post_on_delete), was_deleted_(was_deleted) {
}
+ void Run() {}
+
+ private:
+ friend class base::RefCounted<RecordDeletionProbe>;
+
~RecordDeletionProbe() {
*was_deleted_ = true;
if (post_on_delete_)
@@ -404,8 +409,7 @@ class RecordDeletionProbe : public base::RefCounted<RecordDeletionProbe> {
FROM_HERE,
base::Bind(&RecordDeletionProbe::Run, post_on_delete_.get()));
}
- void Run() {}
- private:
+
scoped_refptr<RecordDeletionProbe> post_on_delete_;
bool* was_deleted_;
};
@@ -1624,15 +1628,18 @@ class DestructionObserverProbe :
: task_destroyed_(task_destroyed),
destruction_observer_called_(destruction_observer_called) {
}
- virtual ~DestructionObserverProbe() {
- EXPECT_FALSE(*destruction_observer_called_);
- *task_destroyed_ = true;
- }
virtual void Run() {
// This task should never run.
ADD_FAILURE();
}
private:
+ friend class base::RefCounted<DestructionObserverProbe>;
+
+ virtual ~DestructionObserverProbe() {
+ EXPECT_FALSE(*destruction_observer_called_);
+ *task_destroyed_ = true;
+ }
+
bool* task_destroyed_;
bool* destruction_observer_called_;
};
« no previous file with comments | « base/memory/ref_counted_unittest.cc ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698