Shorted "reference" to "ref".

pull/13357/head
Mark D. Roth 7 years ago
parent 240bad3d2d
commit bf816d325e
  1. 8
      BUILD
  2. 20
      CMakeLists.txt
  3. 60
      Makefile
  4. 12
      build.yaml
  5. 8
      gRPC-Core.podspec
  6. 4
      grpc.gemspec
  7. 4
      package.xml
  8. 31
      src/core/lib/support/ref_counted.h
  9. 28
      src/core/lib/support/ref_counted_ptr.h
  10. 14
      test/core/support/BUILD
  11. 92
      test/core/support/ref_counted_ptr_test.cc
  12. 14
      test/core/support/ref_counted_test.cc
  13. 4
      tools/doxygen/Doxyfile.c++.internal
  14. 4
      tools/doxygen/Doxyfile.core.internal
  15. 16
      tools/run_tests/generated/sources_and_headers.json
  16. 4
      tools/run_tests/generated/tests.json

@ -544,8 +544,8 @@ grpc_cc_library(
) )
grpc_cc_library( grpc_cc_library(
name = "reference_counted", name = "ref_counted",
public_hdrs = ["src/core/lib/support/reference_counted.h"], public_hdrs = ["src/core/lib/support/ref_counted.h"],
language = "c++", language = "c++",
deps = [ deps = [
"grpc_trace", "grpc_trace",
@ -554,8 +554,8 @@ grpc_cc_library(
) )
grpc_cc_library( grpc_cc_library(
name = "reference_counted_ptr", name = "ref_counted_ptr",
public_hdrs = ["src/core/lib/support/reference_counted_ptr.h"], public_hdrs = ["src/core/lib/support/ref_counted_ptr.h"],
language = "c++", language = "c++",
) )

@ -739,8 +739,8 @@ endif()
add_dependencies(buildtests_cxx qps_worker) add_dependencies(buildtests_cxx qps_worker)
add_dependencies(buildtests_cxx reconnect_interop_client) add_dependencies(buildtests_cxx reconnect_interop_client)
add_dependencies(buildtests_cxx reconnect_interop_server) add_dependencies(buildtests_cxx reconnect_interop_server)
add_dependencies(buildtests_cxx reference_counted_ptr_test) add_dependencies(buildtests_cxx ref_counted_ptr_test)
add_dependencies(buildtests_cxx reference_counted_test) add_dependencies(buildtests_cxx ref_counted_test)
add_dependencies(buildtests_cxx secure_auth_context_test) add_dependencies(buildtests_cxx secure_auth_context_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx secure_sync_unary_ping_pong_test) add_dependencies(buildtests_cxx secure_sync_unary_ping_pong_test)
@ -12262,14 +12262,14 @@ target_link_libraries(reconnect_interop_server
endif (gRPC_BUILD_TESTS) endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS)
add_executable(reference_counted_ptr_test add_executable(ref_counted_ptr_test
test/core/support/reference_counted_ptr_test.cc test/core/support/ref_counted_ptr_test.cc
third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc third_party/googletest/googlemock/src/gmock-all.cc
) )
target_include_directories(reference_counted_ptr_test target_include_directories(ref_counted_ptr_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include
@ -12288,7 +12288,7 @@ target_include_directories(reference_counted_ptr_test
PRIVATE ${_gRPC_PROTO_GENS_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR}
) )
target_link_libraries(reference_counted_ptr_test target_link_libraries(ref_counted_ptr_test
${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util grpc_test_util
@ -12302,14 +12302,14 @@ target_link_libraries(reference_counted_ptr_test
endif (gRPC_BUILD_TESTS) endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS)
add_executable(reference_counted_test add_executable(ref_counted_test
test/core/support/reference_counted_test.cc test/core/support/ref_counted_test.cc
third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc third_party/googletest/googlemock/src/gmock-all.cc
) )
target_include_directories(reference_counted_test target_include_directories(ref_counted_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include
@ -12328,7 +12328,7 @@ target_include_directories(reference_counted_test
PRIVATE ${_gRPC_PROTO_GENS_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR}
) )
target_link_libraries(reference_counted_test target_link_libraries(ref_counted_test
${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util grpc_test_util

@ -1165,8 +1165,8 @@ qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test
qps_worker: $(BINDIR)/$(CONFIG)/qps_worker qps_worker: $(BINDIR)/$(CONFIG)/qps_worker
reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client
reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server
reference_counted_ptr_test: $(BINDIR)/$(CONFIG)/reference_counted_ptr_test ref_counted_ptr_test: $(BINDIR)/$(CONFIG)/ref_counted_ptr_test
reference_counted_test: $(BINDIR)/$(CONFIG)/reference_counted_test ref_counted_test: $(BINDIR)/$(CONFIG)/ref_counted_test
secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test
secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test
server_builder_plugin_test: $(BINDIR)/$(CONFIG)/server_builder_plugin_test server_builder_plugin_test: $(BINDIR)/$(CONFIG)/server_builder_plugin_test
@ -1603,8 +1603,8 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/qps_worker \
$(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \
$(BINDIR)/$(CONFIG)/reconnect_interop_server \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \
$(BINDIR)/$(CONFIG)/reference_counted_ptr_test \ $(BINDIR)/$(CONFIG)/ref_counted_ptr_test \
$(BINDIR)/$(CONFIG)/reference_counted_test \ $(BINDIR)/$(CONFIG)/ref_counted_test \
$(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \
$(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \
$(BINDIR)/$(CONFIG)/server_builder_plugin_test \ $(BINDIR)/$(CONFIG)/server_builder_plugin_test \
@ -1731,8 +1731,8 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/qps_worker \
$(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \
$(BINDIR)/$(CONFIG)/reconnect_interop_server \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \
$(BINDIR)/$(CONFIG)/reference_counted_ptr_test \ $(BINDIR)/$(CONFIG)/ref_counted_ptr_test \
$(BINDIR)/$(CONFIG)/reference_counted_test \ $(BINDIR)/$(CONFIG)/ref_counted_test \
$(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \
$(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \
$(BINDIR)/$(CONFIG)/server_builder_plugin_test \ $(BINDIR)/$(CONFIG)/server_builder_plugin_test \
@ -2136,10 +2136,10 @@ test_cxx: buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/proto_utils_test || ( echo test proto_utils_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/proto_utils_test || ( echo test proto_utils_test failed ; exit 1 )
$(E) "[RUN] Testing qps_openloop_test" $(E) "[RUN] Testing qps_openloop_test"
$(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 )
$(E) "[RUN] Testing reference_counted_ptr_test" $(E) "[RUN] Testing ref_counted_ptr_test"
$(Q) $(BINDIR)/$(CONFIG)/reference_counted_ptr_test || ( echo test reference_counted_ptr_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/ref_counted_ptr_test || ( echo test ref_counted_ptr_test failed ; exit 1 )
$(E) "[RUN] Testing reference_counted_test" $(E) "[RUN] Testing ref_counted_test"
$(Q) $(BINDIR)/$(CONFIG)/reference_counted_test || ( echo test reference_counted_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/ref_counted_test || ( echo test ref_counted_test failed ; exit 1 )
$(E) "[RUN] Testing secure_auth_context_test" $(E) "[RUN] Testing secure_auth_context_test"
$(Q) $(BINDIR)/$(CONFIG)/secure_auth_context_test || ( echo test secure_auth_context_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/secure_auth_context_test || ( echo test secure_auth_context_test failed ; exit 1 )
$(E) "[RUN] Testing secure_sync_unary_ping_pong_test" $(E) "[RUN] Testing secure_sync_unary_ping_pong_test"
@ -16505,15 +16505,15 @@ endif
$(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc
REFERENCE_COUNTED_PTR_TEST_SRC = \ REF_COUNTED_PTR_TEST_SRC = \
test/core/support/reference_counted_ptr_test.cc \ test/core/support/ref_counted_ptr_test.cc \
REFERENCE_COUNTED_PTR_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFERENCE_COUNTED_PTR_TEST_SRC)))) REF_COUNTED_PTR_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REF_COUNTED_PTR_TEST_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL. # You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: openssl_dep_error $(BINDIR)/$(CONFIG)/ref_counted_ptr_test: openssl_dep_error
else else
@ -16524,39 +16524,39 @@ ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: protobuf_dep_error $(BINDIR)/$(CONFIG)/ref_counted_ptr_test: protobuf_dep_error
else else
$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: $(PROTOBUF_DEP) $(REFERENCE_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/ref_counted_ptr_test: $(PROTOBUF_DEP) $(REF_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(REFERENCE_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reference_counted_ptr_test $(Q) $(LDXX) $(LDFLAGS) $(REF_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/ref_counted_ptr_test
endif endif
endif endif
$(OBJDIR)/$(CONFIG)/test/core/support/reference_counted_ptr_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/support/ref_counted_ptr_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_reference_counted_ptr_test: $(REFERENCE_COUNTED_PTR_TEST_OBJS:.o=.dep) deps_ref_counted_ptr_test: $(REF_COUNTED_PTR_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true) ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true) ifneq ($(NO_DEPS),true)
-include $(REFERENCE_COUNTED_PTR_TEST_OBJS:.o=.dep) -include $(REF_COUNTED_PTR_TEST_OBJS:.o=.dep)
endif endif
endif endif
REFERENCE_COUNTED_TEST_SRC = \ REF_COUNTED_TEST_SRC = \
test/core/support/reference_counted_test.cc \ test/core/support/ref_counted_test.cc \
REFERENCE_COUNTED_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFERENCE_COUNTED_TEST_SRC)))) REF_COUNTED_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REF_COUNTED_TEST_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL. # You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/reference_counted_test: openssl_dep_error $(BINDIR)/$(CONFIG)/ref_counted_test: openssl_dep_error
else else
@ -16567,26 +16567,26 @@ ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
$(BINDIR)/$(CONFIG)/reference_counted_test: protobuf_dep_error $(BINDIR)/$(CONFIG)/ref_counted_test: protobuf_dep_error
else else
$(BINDIR)/$(CONFIG)/reference_counted_test: $(PROTOBUF_DEP) $(REFERENCE_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/ref_counted_test: $(PROTOBUF_DEP) $(REF_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(REFERENCE_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reference_counted_test $(Q) $(LDXX) $(LDFLAGS) $(REF_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/ref_counted_test
endif endif
endif endif
$(OBJDIR)/$(CONFIG)/test/core/support/reference_counted_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/support/ref_counted_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_reference_counted_test: $(REFERENCE_COUNTED_TEST_OBJS:.o=.dep) deps_ref_counted_test: $(REF_COUNTED_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true) ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true) ifneq ($(NO_DEPS),true)
-include $(REFERENCE_COUNTED_TEST_OBJS:.o=.dep) -include $(REF_COUNTED_TEST_OBJS:.o=.dep)
endif endif
endif endif

@ -394,8 +394,8 @@ filegroups:
- src/core/lib/slice/slice_internal.h - src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_string_helpers.h - src/core/lib/slice/slice_string_helpers.h
- src/core/lib/support/debug_location.h - src/core/lib/support/debug_location.h
- src/core/lib/support/reference_counted.h - src/core/lib/support/ref_counted.h
- src/core/lib/support/reference_counted_ptr.h - src/core/lib/support/ref_counted_ptr.h
- src/core/lib/support/vector.h - src/core/lib/support/vector.h
- src/core/lib/surface/alarm_internal.h - src/core/lib/surface/alarm_internal.h
- src/core/lib/surface/api_trace.h - src/core/lib/surface/api_trace.h
@ -4544,12 +4544,12 @@ targets:
- gpr_test_util - gpr_test_util
- gpr - gpr
- grpc++_test_config - grpc++_test_config
- name: reference_counted_ptr_test - name: ref_counted_ptr_test
gtest: true gtest: true
build: test build: test
language: c++ language: c++
src: src:
- test/core/support/reference_counted_ptr_test.cc - test/core/support/ref_counted_ptr_test.cc
deps: deps:
- grpc_test_util - grpc_test_util
- grpc++ - grpc++
@ -4558,12 +4558,12 @@ targets:
- gpr - gpr
uses: uses:
- grpc++_test - grpc++_test
- name: reference_counted_test - name: ref_counted_test
gtest: true gtest: true
build: test build: test
language: c++ language: c++
src: src:
- test/core/support/reference_counted_test.cc - test/core/support/ref_counted_test.cc
deps: deps:
- grpc_test_util - grpc_test_util
- grpc++ - grpc++

@ -414,8 +414,8 @@ Pod::Spec.new do |s|
'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_string_helpers.h', 'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/support/debug_location.h', 'src/core/lib/support/debug_location.h',
'src/core/lib/support/reference_counted.h', 'src/core/lib/support/ref_counted.h',
'src/core/lib/support/reference_counted_ptr.h', 'src/core/lib/support/ref_counted_ptr.h',
'src/core/lib/support/vector.h', 'src/core/lib/support/vector.h',
'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/alarm_internal.h',
'src/core/lib/surface/api_trace.h', 'src/core/lib/surface/api_trace.h',
@ -892,8 +892,8 @@ Pod::Spec.new do |s|
'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_string_helpers.h', 'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/support/debug_location.h', 'src/core/lib/support/debug_location.h',
'src/core/lib/support/reference_counted.h', 'src/core/lib/support/ref_counted.h',
'src/core/lib/support/reference_counted_ptr.h', 'src/core/lib/support/ref_counted_ptr.h',
'src/core/lib/support/vector.h', 'src/core/lib/support/vector.h',
'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/alarm_internal.h',
'src/core/lib/surface/api_trace.h', 'src/core/lib/surface/api_trace.h',

@ -345,8 +345,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/slice/slice_internal.h ) s.files += %w( src/core/lib/slice/slice_internal.h )
s.files += %w( src/core/lib/slice/slice_string_helpers.h ) s.files += %w( src/core/lib/slice/slice_string_helpers.h )
s.files += %w( src/core/lib/support/debug_location.h ) s.files += %w( src/core/lib/support/debug_location.h )
s.files += %w( src/core/lib/support/reference_counted.h ) s.files += %w( src/core/lib/support/ref_counted.h )
s.files += %w( src/core/lib/support/reference_counted_ptr.h ) s.files += %w( src/core/lib/support/ref_counted_ptr.h )
s.files += %w( src/core/lib/support/vector.h ) s.files += %w( src/core/lib/support/vector.h )
s.files += %w( src/core/lib/surface/alarm_internal.h ) s.files += %w( src/core/lib/surface/alarm_internal.h )
s.files += %w( src/core/lib/surface/api_trace.h ) s.files += %w( src/core/lib/surface/api_trace.h )

@ -357,8 +357,8 @@
<file baseinstalldir="/" name="src/core/lib/slice/slice_internal.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/slice/slice_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/debug_location.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/debug_location.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/reference_counted.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/ref_counted.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/reference_counted_ptr.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/ref_counted_ptr.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/vector.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/vector.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/alarm_internal.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/alarm_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/api_trace.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/api_trace.h" role="src" />

@ -16,8 +16,8 @@
* *
*/ */
#ifndef GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H #ifndef GRPC_CORE_LIB_SUPPORT_REF_COUNTED_H
#define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H #define GRPC_CORE_LIB_SUPPORT_REF_COUNTED_H
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
@ -31,7 +31,7 @@ namespace grpc_core {
// A base class for reference-counted objects. // A base class for reference-counted objects.
// New objects should be created via New() and start with a refcount of 1. // New objects should be created via New() and start with a refcount of 1.
// When the refcount reaches 0, the object will be deleted via Delete(). // When the refcount reaches 0, the object will be deleted via Delete().
class ReferenceCounted { class RefCounted {
public: public:
void Ref() { gpr_ref(&refs_); } void Ref() { gpr_ref(&refs_); }
@ -42,29 +42,29 @@ class ReferenceCounted {
} }
// Not copyable nor movable. // Not copyable nor movable.
ReferenceCounted(const ReferenceCounted&) = delete; RefCounted(const RefCounted&) = delete;
ReferenceCounted& operator=(const ReferenceCounted&) = delete; RefCounted& operator=(const RefCounted&) = delete;
protected: protected:
// Allow Delete() to access destructor. // Allow Delete() to access destructor.
template <typename T> template <typename T>
friend void Delete(T*); friend void Delete(T*);
ReferenceCounted() { gpr_ref_init(&refs_, 1); } RefCounted() { gpr_ref_init(&refs_, 1); }
virtual ~ReferenceCounted() {} virtual ~RefCounted() {}
private: private:
gpr_refcount refs_; gpr_refcount refs_;
}; };
// An alternative version of the ReferenceCounted base class that // An alternative version of the RefCounted base class that
// supports tracing. This is intended to be used in cases where the // supports tracing. This is intended to be used in cases where the
// object will be handled both by idiomatic C++ code using smart // object will be handled both by idiomatic C++ code using smart
// pointers and legacy code that is manually calling Ref() and Unref(). // pointers and legacy code that is manually calling Ref() and Unref().
// Once all of our code is converted to idiomatic C++, we may be able to // Once all of our code is converted to idiomatic C++, we may be able to
// eliminate this class. // eliminate this class.
class ReferenceCountedWithTracing { class RefCountedWithTracing {
public: public:
void Ref() { gpr_ref(&refs_); } void Ref() { gpr_ref(&refs_); }
@ -95,23 +95,22 @@ class ReferenceCountedWithTracing {
} }
// Not copyable nor movable. // Not copyable nor movable.
ReferenceCountedWithTracing(const ReferenceCountedWithTracing&) = delete; RefCountedWithTracing(const RefCountedWithTracing&) = delete;
ReferenceCountedWithTracing& operator=(const ReferenceCountedWithTracing&) = RefCountedWithTracing& operator=(const RefCountedWithTracing&) = delete;
delete;
protected: protected:
// Allow Delete() to access destructor. // Allow Delete() to access destructor.
template <typename T> template <typename T>
friend void Delete(T*); friend void Delete(T*);
ReferenceCountedWithTracing() : ReferenceCountedWithTracing(nullptr) {} RefCountedWithTracing() : RefCountedWithTracing(nullptr) {}
explicit ReferenceCountedWithTracing(TraceFlag* trace_flag) explicit RefCountedWithTracing(TraceFlag* trace_flag)
: trace_flag_(trace_flag) { : trace_flag_(trace_flag) {
gpr_ref_init(&refs_, 1); gpr_ref_init(&refs_, 1);
} }
virtual ~ReferenceCountedWithTracing() {} virtual ~RefCountedWithTracing() {}
private: private:
TraceFlag* trace_flag_ = nullptr; TraceFlag* trace_flag_ = nullptr;
@ -120,4 +119,4 @@ class ReferenceCountedWithTracing {
} // namespace grpc_core } // namespace grpc_core
#endif /* GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H */ #endif /* GRPC_CORE_LIB_SUPPORT_REF_COUNTED_H */

@ -16,8 +16,8 @@
* *
*/ */
#ifndef GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H #ifndef GRPC_CORE_LIB_SUPPORT_REF_COUNTED_PTR_H
#define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H #define GRPC_CORE_LIB_SUPPORT_REF_COUNTED_PTR_H
#include <utility> #include <utility>
@ -26,21 +26,21 @@
namespace grpc_core { namespace grpc_core {
// A smart pointer class for objects that provide Ref() and Unref() methods, // A smart pointer class for objects that provide Ref() and Unref() methods,
// such as those provided by the ReferenceCounted base class. // such as those provided by the RefCounted base class.
template <typename T> template <typename T>
class ReferenceCountedPtr { class RefCountedPtr {
public: public:
ReferenceCountedPtr() {} RefCountedPtr() {}
// If value is non-null, we take ownership of a ref to it. // If value is non-null, we take ownership of a ref to it.
explicit ReferenceCountedPtr(T* value) { value_ = value; } explicit RefCountedPtr(T* value) { value_ = value; }
// Move support. // Move support.
ReferenceCountedPtr(ReferenceCountedPtr&& other) { RefCountedPtr(RefCountedPtr&& other) {
value_ = other.value_; value_ = other.value_;
other.value_ = nullptr; other.value_ = nullptr;
} }
ReferenceCountedPtr& operator=(ReferenceCountedPtr&& other) { RefCountedPtr& operator=(RefCountedPtr&& other) {
if (value_ != nullptr) value_->Unref(); if (value_ != nullptr) value_->Unref();
value_ = other.value_; value_ = other.value_;
other.value_ = nullptr; other.value_ = nullptr;
@ -48,11 +48,11 @@ class ReferenceCountedPtr {
} }
// Copy support. // Copy support.
ReferenceCountedPtr(const ReferenceCountedPtr& other) { RefCountedPtr(const RefCountedPtr& other) {
if (other.value_ != nullptr) other.value_->Ref(); if (other.value_ != nullptr) other.value_->Ref();
value_ = other.value_; value_ = other.value_;
} }
ReferenceCountedPtr& operator=(const ReferenceCountedPtr& other) { RefCountedPtr& operator=(const RefCountedPtr& other) {
// Note: Order of reffing and unreffing is important here in case value_ // Note: Order of reffing and unreffing is important here in case value_
// and other.value_ are the same object. // and other.value_ are the same object.
if (other.value_ != nullptr) other.value_->Ref(); if (other.value_ != nullptr) other.value_->Ref();
@ -61,7 +61,7 @@ class ReferenceCountedPtr {
return *this; return *this;
} }
~ReferenceCountedPtr() { ~RefCountedPtr() {
if (value_ != nullptr) value_->Unref(); if (value_ != nullptr) value_->Unref();
} }
@ -81,10 +81,10 @@ class ReferenceCountedPtr {
}; };
template <typename T, typename... Args> template <typename T, typename... Args>
inline ReferenceCountedPtr<T> MakeReferenceCounted(Args&&... args) { inline RefCountedPtr<T> MakeRefCounted(Args&&... args) {
return ReferenceCountedPtr<T>(New<T>(std::forward<Args>(args)...)); return RefCountedPtr<T>(New<T>(std::forward<Args>(args)...));
} }
} // namespace grpc_core } // namespace grpc_core
#endif /* GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H */ #endif /* GRPC_CORE_LIB_SUPPORT_REF_COUNTED_PTR_H */

@ -235,11 +235,11 @@ grpc_cc_test(
) )
grpc_cc_test( grpc_cc_test(
name = "reference_counted_test", name = "ref_counted_test",
srcs = ["reference_counted_test.cc"], srcs = ["ref_counted_test.cc"],
language = "C++", language = "C++",
deps = [ deps = [
"//:reference_counted", "//:ref_counted",
"//test/core/util:gpr_test_util", "//test/core/util:gpr_test_util",
], ],
external_deps = [ external_deps = [
@ -248,12 +248,12 @@ grpc_cc_test(
) )
grpc_cc_test( grpc_cc_test(
name = "reference_counted_ptr_test", name = "ref_counted_ptr_test",
srcs = ["reference_counted_ptr_test.cc"], srcs = ["ref_counted_ptr_test.cc"],
language = "C++", language = "C++",
deps = [ deps = [
"//:reference_counted", "//:ref_counted",
"//:reference_counted_ptr", "//:ref_counted_ptr",
"//test/core/util:gpr_test_util", "//test/core/util:gpr_test_util",
], ],
external_deps = [ external_deps = [

@ -16,21 +16,21 @@
* *
*/ */
#include "src/core/lib/support/reference_counted_ptr.h" #include "src/core/lib/support/ref_counted_ptr.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/lib/support/memory.h" #include "src/core/lib/support/memory.h"
#include "src/core/lib/support/reference_counted.h" #include "src/core/lib/support/ref_counted.h"
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
namespace grpc_core { namespace grpc_core {
namespace testing { namespace testing {
namespace { namespace {
class Foo : public ReferenceCounted { class Foo : public RefCounted {
public: public:
Foo() : value_(0) {} Foo() : value_(0) {}
@ -42,76 +42,76 @@ class Foo : public ReferenceCounted {
int value_; int value_;
}; };
TEST(ReferenceCountedPtr, DefaultConstructor) { ReferenceCountedPtr<Foo> foo; } TEST(RefCountedPtr, DefaultConstructor) { RefCountedPtr<Foo> foo; }
TEST(ReferenceCountedPtr, ExplicitConstructorEmpty) { TEST(RefCountedPtr, ExplicitConstructorEmpty) {
ReferenceCountedPtr<Foo> foo(nullptr); RefCountedPtr<Foo> foo(nullptr);
} }
TEST(ReferenceCountedPtr, ExplicitConstructor) { TEST(RefCountedPtr, ExplicitConstructor) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
} }
TEST(ReferenceCountedPtr, MoveConstructor) { TEST(RefCountedPtr, MoveConstructor) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
ReferenceCountedPtr<Foo> foo2(std::move(foo)); RefCountedPtr<Foo> foo2(std::move(foo));
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
EXPECT_NE(nullptr, foo2.get()); EXPECT_NE(nullptr, foo2.get());
} }
TEST(ReferenceCountedPtr, MoveAssignment) { TEST(RefCountedPtr, MoveAssignment) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
ReferenceCountedPtr<Foo> foo2 = std::move(foo); RefCountedPtr<Foo> foo2 = std::move(foo);
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
EXPECT_NE(nullptr, foo2.get()); EXPECT_NE(nullptr, foo2.get());
} }
TEST(ReferenceCountedPtr, CopyConstructor) { TEST(RefCountedPtr, CopyConstructor) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
ReferenceCountedPtr<Foo> foo2(foo); RefCountedPtr<Foo> foo2(foo);
EXPECT_NE(nullptr, foo.get()); EXPECT_NE(nullptr, foo.get());
EXPECT_EQ(foo.get(), foo2.get()); EXPECT_EQ(foo.get(), foo2.get());
} }
TEST(ReferenceCountedPtr, CopyAssignment) { TEST(RefCountedPtr, CopyAssignment) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
ReferenceCountedPtr<Foo> foo2 = foo; RefCountedPtr<Foo> foo2 = foo;
EXPECT_NE(nullptr, foo.get()); EXPECT_NE(nullptr, foo.get());
EXPECT_EQ(foo.get(), foo2.get()); EXPECT_EQ(foo.get(), foo2.get());
} }
TEST(ReferenceCountedPtr, CopyAssignmentWhenEmpty) { TEST(RefCountedPtr, CopyAssignmentWhenEmpty) {
ReferenceCountedPtr<Foo> foo; RefCountedPtr<Foo> foo;
ReferenceCountedPtr<Foo> foo2; RefCountedPtr<Foo> foo2;
foo2 = foo; foo2 = foo;
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
EXPECT_EQ(nullptr, foo2.get()); EXPECT_EQ(nullptr, foo2.get());
} }
TEST(ReferenceCountedPtr, CopyAssignmentToSelf) { TEST(RefCountedPtr, CopyAssignmentToSelf) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
foo = foo; foo = foo;
} }
TEST(ReferenceCountedPtr, EnclosedScope) { TEST(RefCountedPtr, EnclosedScope) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
{ {
ReferenceCountedPtr<Foo> foo2(std::move(foo)); RefCountedPtr<Foo> foo2(std::move(foo));
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
EXPECT_NE(nullptr, foo2.get()); EXPECT_NE(nullptr, foo2.get());
} }
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
} }
TEST(ReferenceCountedPtr, ResetFromNullToNonNull) { TEST(RefCountedPtr, ResetFromNullToNonNull) {
ReferenceCountedPtr<Foo> foo; RefCountedPtr<Foo> foo;
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
foo.reset(New<Foo>()); foo.reset(New<Foo>());
EXPECT_NE(nullptr, foo.get()); EXPECT_NE(nullptr, foo.get());
} }
TEST(ReferenceCountedPtr, ResetFromNonNullToNonNull) { TEST(RefCountedPtr, ResetFromNonNullToNonNull) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
EXPECT_NE(nullptr, foo.get()); EXPECT_NE(nullptr, foo.get());
Foo* original = foo.get(); Foo* original = foo.get();
foo.reset(New<Foo>()); foo.reset(New<Foo>());
@ -119,46 +119,46 @@ TEST(ReferenceCountedPtr, ResetFromNonNullToNonNull) {
EXPECT_NE(original, foo.get()); EXPECT_NE(original, foo.get());
} }
TEST(ReferenceCountedPtr, ResetFromNonNullToNull) { TEST(RefCountedPtr, ResetFromNonNullToNull) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
EXPECT_NE(nullptr, foo.get()); EXPECT_NE(nullptr, foo.get());
foo.reset(); foo.reset();
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
} }
TEST(ReferenceCountedPtr, ResetFromNullToNull) { TEST(RefCountedPtr, ResetFromNullToNull) {
ReferenceCountedPtr<Foo> foo; RefCountedPtr<Foo> foo;
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
foo.reset(nullptr); foo.reset(nullptr);
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
} }
TEST(ReferenceCountedPtr, DerefernceOperators) { TEST(RefCountedPtr, DerefernceOperators) {
ReferenceCountedPtr<Foo> foo(New<Foo>()); RefCountedPtr<Foo> foo(New<Foo>());
foo->value(); foo->value();
Foo& foo_ref = *foo; Foo& foo_ref = *foo;
foo_ref.value(); foo_ref.value();
} }
TEST(MakeReferenceCounted, NoArgs) { TEST(MakeRefCounted, NoArgs) {
ReferenceCountedPtr<Foo> foo = MakeReferenceCounted<Foo>(); RefCountedPtr<Foo> foo = MakeRefCounted<Foo>();
EXPECT_EQ(0, foo->value()); EXPECT_EQ(0, foo->value());
} }
TEST(MakeReferenceCounted, Args) { TEST(MakeRefCounted, Args) {
ReferenceCountedPtr<Foo> foo = MakeReferenceCounted<Foo>(3); RefCountedPtr<Foo> foo = MakeRefCounted<Foo>(3);
EXPECT_EQ(3, foo->value()); EXPECT_EQ(3, foo->value());
} }
TraceFlag foo_tracer(true, "foo"); TraceFlag foo_tracer(true, "foo");
class FooWithTracing : public ReferenceCountedWithTracing { class FooWithTracing : public RefCountedWithTracing {
public: public:
FooWithTracing() : ReferenceCountedWithTracing(&foo_tracer) {} FooWithTracing() : RefCountedWithTracing(&foo_tracer) {}
}; };
TEST(ReferenceCountedPtr, ReferenceCountedWithTracing) { TEST(RefCountedPtr, RefCountedWithTracing) {
ReferenceCountedPtr<FooWithTracing> foo(New<FooWithTracing>()); RefCountedPtr<FooWithTracing> foo(New<FooWithTracing>());
foo->Ref(DEBUG_LOCATION, "foo"); foo->Ref(DEBUG_LOCATION, "foo");
foo->Unref(DEBUG_LOCATION, "foo"); foo->Unref(DEBUG_LOCATION, "foo");
} }

@ -16,7 +16,7 @@
* *
*/ */
#include "src/core/lib/support/reference_counted.h" #include "src/core/lib/support/ref_counted.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
@ -27,17 +27,17 @@ namespace grpc_core {
namespace testing { namespace testing {
namespace { namespace {
class Foo : public ReferenceCounted { class Foo : public RefCounted {
public: public:
Foo() {} Foo() {}
}; };
TEST(ReferenceCounted, Basic) { TEST(RefCounted, Basic) {
Foo* foo = New<Foo>(); Foo* foo = New<Foo>();
foo->Unref(); foo->Unref();
} }
TEST(ReferenceCounted, ExtraRef) { TEST(RefCounted, ExtraRef) {
Foo* foo = New<Foo>(); Foo* foo = New<Foo>();
foo->Ref(); foo->Ref();
foo->Unref(); foo->Unref();
@ -46,12 +46,12 @@ TEST(ReferenceCounted, ExtraRef) {
TraceFlag foo_tracer(true, "foo"); TraceFlag foo_tracer(true, "foo");
class FooWithTracing : public ReferenceCountedWithTracing { class FooWithTracing : public RefCountedWithTracing {
public: public:
FooWithTracing() : ReferenceCountedWithTracing(&foo_tracer) {} FooWithTracing() : RefCountedWithTracing(&foo_tracer) {}
}; };
TEST(ReferenceCountedWithTracing, Basic) { TEST(RefCountedWithTracing, Basic) {
FooWithTracing* foo = New<FooWithTracing>(); FooWithTracing* foo = New<FooWithTracing>();
foo->Ref(DEBUG_LOCATION, "extra_ref"); foo->Ref(DEBUG_LOCATION, "extra_ref");
foo->Unref(DEBUG_LOCATION, "extra_ref"); foo->Unref(DEBUG_LOCATION, "extra_ref");

@ -1037,8 +1037,8 @@ src/core/lib/support/manual_constructor.h \
src/core/lib/support/memory.h \ src/core/lib/support/memory.h \
src/core/lib/support/mpscq.h \ src/core/lib/support/mpscq.h \
src/core/lib/support/murmur_hash.h \ src/core/lib/support/murmur_hash.h \
src/core/lib/support/reference_counted.h \ src/core/lib/support/ref_counted.h \
src/core/lib/support/reference_counted_ptr.h \ src/core/lib/support/ref_counted_ptr.h \
src/core/lib/support/spinlock.h \ src/core/lib/support/spinlock.h \
src/core/lib/support/stack_lockfree.h \ src/core/lib/support/stack_lockfree.h \
src/core/lib/support/string.h \ src/core/lib/support/string.h \

@ -1299,8 +1299,8 @@ src/core/lib/support/mpscq.cc \
src/core/lib/support/mpscq.h \ src/core/lib/support/mpscq.h \
src/core/lib/support/murmur_hash.cc \ src/core/lib/support/murmur_hash.cc \
src/core/lib/support/murmur_hash.h \ src/core/lib/support/murmur_hash.h \
src/core/lib/support/reference_counted.h \ src/core/lib/support/ref_counted.h \
src/core/lib/support/reference_counted_ptr.h \ src/core/lib/support/ref_counted_ptr.h \
src/core/lib/support/spinlock.h \ src/core/lib/support/spinlock.h \
src/core/lib/support/stack_lockfree.cc \ src/core/lib/support/stack_lockfree.cc \
src/core/lib/support/stack_lockfree.h \ src/core/lib/support/stack_lockfree.h \

@ -3929,9 +3929,9 @@
"headers": [], "headers": [],
"is_filegroup": false, "is_filegroup": false,
"language": "c++", "language": "c++",
"name": "reference_counted_ptr_test", "name": "ref_counted_ptr_test",
"src": [ "src": [
"test/core/support/reference_counted_ptr_test.cc" "test/core/support/ref_counted_ptr_test.cc"
], ],
"third_party": false, "third_party": false,
"type": "target" "type": "target"
@ -3948,9 +3948,9 @@
"headers": [], "headers": [],
"is_filegroup": false, "is_filegroup": false,
"language": "c++", "language": "c++",
"name": "reference_counted_test", "name": "ref_counted_test",
"src": [ "src": [
"test/core/support/reference_counted_test.cc" "test/core/support/ref_counted_test.cc"
], ],
"third_party": false, "third_party": false,
"type": "target" "type": "target"
@ -8259,8 +8259,8 @@
"src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_internal.h",
"src/core/lib/slice/slice_string_helpers.h", "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/support/debug_location.h", "src/core/lib/support/debug_location.h",
"src/core/lib/support/reference_counted.h", "src/core/lib/support/ref_counted.h",
"src/core/lib/support/reference_counted_ptr.h", "src/core/lib/support/ref_counted_ptr.h",
"src/core/lib/support/vector.h", "src/core/lib/support/vector.h",
"src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/alarm_internal.h",
"src/core/lib/surface/api_trace.h", "src/core/lib/surface/api_trace.h",
@ -8398,8 +8398,8 @@
"src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_internal.h",
"src/core/lib/slice/slice_string_helpers.h", "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/support/debug_location.h", "src/core/lib/support/debug_location.h",
"src/core/lib/support/reference_counted.h", "src/core/lib/support/ref_counted.h",
"src/core/lib/support/reference_counted_ptr.h", "src/core/lib/support/ref_counted_ptr.h",
"src/core/lib/support/vector.h", "src/core/lib/support/vector.h",
"src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/alarm_internal.h",
"src/core/lib/surface/api_trace.h", "src/core/lib/surface/api_trace.h",

@ -4138,7 +4138,7 @@
"flaky": false, "flaky": false,
"gtest": true, "gtest": true,
"language": "c++", "language": "c++",
"name": "reference_counted_ptr_test", "name": "ref_counted_ptr_test",
"platforms": [ "platforms": [
"linux", "linux",
"mac", "mac",
@ -4162,7 +4162,7 @@
"flaky": false, "flaky": false,
"gtest": true, "gtest": true,
"language": "c++", "language": "c++",
"name": "reference_counted_test", "name": "ref_counted_test",
"platforms": [ "platforms": [
"linux", "linux",
"mac", "mac",

Loading…
Cancel
Save