From 08d9f3df3038a88d7ae69aa9e65da29e296946d2 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 6 Feb 2018 07:58:17 -0800 Subject: Change Ref() methods to return a RefCountedPtr<>. --- test/core/gprpp/ref_counted_test.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'test/core/gprpp/ref_counted_test.cc') diff --git a/test/core/gprpp/ref_counted_test.cc b/test/core/gprpp/ref_counted_test.cc index b1b0fee5c0..f85a2e4675 100644 --- a/test/core/gprpp/ref_counted_test.cc +++ b/test/core/gprpp/ref_counted_test.cc @@ -27,7 +27,7 @@ namespace grpc_core { namespace testing { namespace { -class Foo : public RefCounted { +class Foo : public RefCounted { public: Foo() {} }; @@ -39,7 +39,8 @@ TEST(RefCounted, Basic) { TEST(RefCounted, ExtraRef) { Foo* foo = New(); - foo->Ref(); + RefCountedPtr foop = foo->Ref(); + foop.release(); foo->Unref(); foo->Unref(); } @@ -48,17 +49,19 @@ TEST(RefCounted, ExtraRef) { // things build properly in both debug and non-debug cases. DebugOnlyTraceFlag foo_tracer(true, "foo"); -class FooWithTracing : public RefCountedWithTracing { +class FooWithTracing : public RefCountedWithTracing { public: FooWithTracing() : RefCountedWithTracing(&foo_tracer) {} }; TEST(RefCountedWithTracing, Basic) { FooWithTracing* foo = New(); - foo->Ref(DEBUG_LOCATION, "extra_ref"); + RefCountedPtr foop = foo->Ref(DEBUG_LOCATION, "extra_ref"); + foop.release(); foo->Unref(DEBUG_LOCATION, "extra_ref"); // Can use the no-argument methods, too. - foo->Ref(); + foop = foo->Ref(); + foop.release(); foo->Unref(); foo->Unref(DEBUG_LOCATION, "original_ref"); } -- cgit v1.2.3