Add rtc::make_ref_counted to api/ This cl adds a forwarding header, a build target, and migrates headers in api/ to use it. Moving actual implementation, will follow, in https://webrtc-review.googlesource.com/c/src/+/265390. Bug: webrtc:12701 Change-Id: Id950725d7d054de8a83b3800b9c9a6437344de86 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265660 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37200}
diff --git a/api/BUILD.gn b/api/BUILD.gn index 42a9436..e1aedd3 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn
@@ -89,10 +89,10 @@ ] deps = [ ":array_view", + ":make_ref_counted", ":refcountedbase", ":rtp_headers", ":scoped_refptr", - "../rtc_base:refcount", "../rtc_base/system:rtc_export", "units:timestamp", ] @@ -115,6 +115,7 @@ ] deps = [ ":audio_options_api", + ":make_ref_counted", ":rtp_parameters", ":scoped_refptr", ":sequence_checker", @@ -179,6 +180,7 @@ ":field_trials_view", ":frame_transformer_interface", ":libjingle_logging_api", + ":make_ref_counted", ":media_stream_interface", ":network_state_predictor_api", ":packet_socket_factory", @@ -244,6 +246,7 @@ visibility = [ "*" ] sources = [ "frame_transformer_interface.h" ] deps = [ + ":make_ref_counted", ":scoped_refptr", "../rtc_base:refcount", "video:encoded_frame", @@ -318,6 +321,12 @@ sources = [ "scoped_refptr.h" ] } +rtc_source_set("make_ref_counted") { + visibility = [ "*" ] + sources = [ "make_ref_counted.h" ] + deps = [ "../rtc_base:refcount" ] +} + rtc_source_set("video_quality_test_fixture_api") { visibility = [ "*" ] testonly = true @@ -623,6 +632,7 @@ ] deps = [ + ":make_ref_counted", ":scoped_refptr", "../api:refcountedbase", "../rtc_base:checks", @@ -767,6 +777,7 @@ ] deps = [ ":libjingle_peerconnection_api", + ":make_ref_counted", ":packet_socket_factory", ":scoped_refptr", "../p2p:rtc_p2p", @@ -990,6 +1001,7 @@ deps = [ ":array_view", ":libjingle_peerconnection_api", + ":make_ref_counted", ":rtp_parameters", "../rtc_base:checks", "../rtc_base:refcount", @@ -1007,9 +1019,9 @@ deps = [ ":array_view", ":libjingle_peerconnection_api", + ":make_ref_counted", ":rtp_parameters", "../rtc_base:checks", - "../rtc_base:refcount", "crypto:frame_decryptor_interface", ] }
diff --git a/api/DEPS b/api/DEPS index 9db91be..69d3a38 100644 --- a/api/DEPS +++ b/api/DEPS
@@ -143,7 +143,6 @@ "proxy\.h": [ "+rtc_base/event.h", "+rtc_base/message_handler.h", # Inherits from it. - "+rtc_base/ref_counted_object.h", "+rtc_base/thread.h", ], @@ -159,9 +158,6 @@ # For private member and constructor. "+rtc_base/system/file_wrapper.h", ], - "rtp_packet_infos\.h": [ - "+rtc_base/ref_counted_object.h", - ], "rtp_receiver_interface\.h": [ "+rtc_base/ref_count.h", ], @@ -206,10 +202,6 @@ "+rtc_base/ref_count.h", ], - "audio_decoder_factory_template\.h": [ - "+rtc_base/ref_counted_object.h", - ], - "audio_encoder\.h": [ "+rtc_base/buffer.h", ], @@ -218,10 +210,6 @@ "+rtc_base/ref_count.h", ], - "audio_encoder_factory_template\.h": [ - "+rtc_base/ref_counted_object.h", - ], - "frame_decryptor_interface\.h": [ "+rtc_base/ref_count.h", ], @@ -236,7 +224,6 @@ "rtc_stats_report\.h": [ "+rtc_base/ref_count.h", - "+rtc_base/ref_counted_object.h", ], "audioproc_float\.h": [ @@ -247,14 +234,6 @@ "+modules/audio_processing/include/audio_processing.h", ], - "fake_frame_decryptor\.h": [ - "+rtc_base/ref_counted_object.h", - ], - - "fake_frame_encryptor\.h": [ - "+rtc_base/ref_counted_object.h", - ], - "fake_metronome\.h": [ "+rtc_base/synchronization/mutex.h", "+rtc_base/task_queue.h", @@ -262,6 +241,10 @@ "+rtc_base/thread_annotations.h", ], + "make_ref_counted\.h": [ + "+rtc_base/ref_counted_object.h", + ], + "mock.*\.h": [ "+test/gmock.h", ],
diff --git a/api/audio/BUILD.gn b/api/audio/BUILD.gn index 7220106..4832751 100644 --- a/api/audio/BUILD.gn +++ b/api/audio/BUILD.gn
@@ -37,6 +37,7 @@ deps = [ ":audio_frame_api", + "..:make_ref_counted", "../../rtc_base:refcount", ] } @@ -102,9 +103,9 @@ "echo_detector_creator.h", ] deps = [ + "..:make_ref_counted", "../../api:scoped_refptr", "../../modules/audio_processing:api", "../../modules/audio_processing:residual_echo_detector", - "../../rtc_base:refcount", ] }
diff --git a/api/audio/echo_detector_creator.cc b/api/audio/echo_detector_creator.cc index 04215b0..15b7c51 100644 --- a/api/audio/echo_detector_creator.cc +++ b/api/audio/echo_detector_creator.cc
@@ -9,8 +9,8 @@ */ #include "api/audio/echo_detector_creator.h" +#include "api/make_ref_counted.h" #include "modules/audio_processing/residual_echo_detector.h" -#include "rtc_base/ref_counted_object.h" namespace webrtc {
diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn index ec358e1..5aa6ea4 100644 --- a/api/audio_codecs/BUILD.gn +++ b/api/audio_codecs/BUILD.gn
@@ -31,6 +31,7 @@ deps = [ "..:array_view", "..:bitrate_allocation", + "..:make_ref_counted", "..:scoped_refptr", "../../api:field_trials_view", "../../rtc_base:buffer",
diff --git a/api/audio_codecs/audio_decoder_factory_template.h b/api/audio_codecs/audio_decoder_factory_template.h index 4e39365..7ea0c91 100644 --- a/api/audio_codecs/audio_decoder_factory_template.h +++ b/api/audio_codecs/audio_decoder_factory_template.h
@@ -16,8 +16,8 @@ #include "api/audio_codecs/audio_decoder_factory.h" #include "api/field_trials_view.h" +#include "api/make_ref_counted.h" #include "api/scoped_refptr.h" -#include "rtc_base/ref_counted_object.h" namespace webrtc {
diff --git a/api/audio_codecs/audio_encoder_factory_template.h b/api/audio_codecs/audio_encoder_factory_template.h index 8490f46..8a70ba2 100644 --- a/api/audio_codecs/audio_encoder_factory_template.h +++ b/api/audio_codecs/audio_encoder_factory_template.h
@@ -16,8 +16,8 @@ #include "api/audio_codecs/audio_encoder_factory.h" #include "api/field_trials_view.h" +#include "api/make_ref_counted.h" #include "api/scoped_refptr.h" -#include "rtc_base/ref_counted_object.h" namespace webrtc {
diff --git a/api/ice_transport_factory.cc b/api/ice_transport_factory.cc index 9e7e629..e88ac18 100644 --- a/api/ice_transport_factory.cc +++ b/api/ice_transport_factory.cc
@@ -13,6 +13,7 @@ #include <memory> #include <utility> +#include "api/make_ref_counted.h" #include "p2p/base/ice_transport_internal.h" #include "p2p/base/p2p_constants.h" #include "p2p/base/p2p_transport_channel.h"
diff --git a/api/make_ref_counted.h b/api/make_ref_counted.h new file mode 100644 index 0000000..e6bdf52 --- /dev/null +++ b/api/make_ref_counted.h
@@ -0,0 +1,18 @@ +/* + * Copyright 2022 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ +#ifndef API_MAKE_REF_COUNTED_H_ +#define API_MAKE_REF_COUNTED_H_ + +#include "rtc_base/ref_counted_object.h" + +// TODO(bugs.webrtc.org/12701): Move implementation of make_ref_counted to this +// file. + +#endif // API_MAKE_REF_COUNTED_H_
diff --git a/api/rtp_packet_infos.h b/api/rtp_packet_infos.h index 031e333..7445729 100644 --- a/api/rtp_packet_infos.h +++ b/api/rtp_packet_infos.h
@@ -15,10 +15,10 @@ #include <utility> #include <vector> +#include "api/make_ref_counted.h" #include "api/ref_counted_base.h" #include "api/rtp_packet_info.h" #include "api/scoped_refptr.h" -#include "rtc_base/ref_counted_object.h" #include "rtc_base/system/rtc_export.h" namespace webrtc {
diff --git a/api/stats_types.cc b/api/stats_types.cc index 8f69e5f..61a0b84 100644 --- a/api/stats_types.cc +++ b/api/stats_types.cc
@@ -13,8 +13,8 @@ #include <string.h> #include "absl/algorithm/container.h" +#include "api/make_ref_counted.h" #include "rtc_base/checks.h" -#include "rtc_base/ref_counted_object.h" #include "rtc_base/string_encode.h" // TODO(tommi): Could we have a static map of value name -> expected type
diff --git a/api/test/fake_frame_decryptor.h b/api/test/fake_frame_decryptor.h index cb58dd6..783bc80 100644 --- a/api/test/fake_frame_decryptor.h +++ b/api/test/fake_frame_decryptor.h
@@ -19,7 +19,6 @@ #include "api/array_view.h" #include "api/crypto/frame_decryptor_interface.h" #include "api/media_types.h" -#include "rtc_base/ref_counted_object.h" namespace webrtc {
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn index 6057a73..fb7bfc6 100644 --- a/api/video/BUILD.gn +++ b/api/video/BUILD.gn
@@ -65,6 +65,7 @@ deps = [ ":video_rtp_headers", "..:array_view", + "..:make_ref_counted", "..:rtp_packet_info", "..:scoped_refptr", "..:video_track_source_constraints", @@ -93,6 +94,7 @@ deps = [ ":video_frame", ":video_rtp_headers", + "..:make_ref_counted", "..:scoped_refptr", "../../rtc_base", "../../rtc_base:checks", @@ -111,8 +113,8 @@ ":video_frame", ":video_rtp_headers", "..:array_view", + "..:make_ref_counted", "..:scoped_refptr", - "../../rtc_base:refcount", "../units:timestamp", ] }
diff --git a/api/video/encoded_image.cc b/api/video/encoded_image.cc index fc77b94..ff61994 100644 --- a/api/video/encoded_image.cc +++ b/api/video/encoded_image.cc
@@ -13,8 +13,6 @@ #include <stdlib.h> #include <string.h> -#include "rtc_base/ref_counted_object.h" - namespace webrtc { EncodedImageBuffer::EncodedImageBuffer(size_t size) : size_(size) {
diff --git a/api/video/i010_buffer.cc b/api/video/i010_buffer.cc index b98e586..32507fe 100644 --- a/api/video/i010_buffer.cc +++ b/api/video/i010_buffer.cc
@@ -11,9 +11,9 @@ #include <utility> +#include "api/make_ref_counted.h" #include "api/video/i420_buffer.h" #include "rtc_base/checks.h" -#include "rtc_base/ref_counted_object.h" #include "third_party/libyuv/include/libyuv/convert.h" #include "third_party/libyuv/include/libyuv/scale.h"
diff --git a/api/video/i420_buffer.cc b/api/video/i420_buffer.cc index deecf1d..bf7fc06 100644 --- a/api/video/i420_buffer.cc +++ b/api/video/i420_buffer.cc
@@ -14,8 +14,8 @@ #include <algorithm> #include <utility> +#include "api/make_ref_counted.h" #include "rtc_base/checks.h" -#include "rtc_base/ref_counted_object.h" #include "third_party/libyuv/include/libyuv/convert.h" #include "third_party/libyuv/include/libyuv/planar_functions.h" #include "third_party/libyuv/include/libyuv/scale.h"
diff --git a/api/video/i422_buffer.cc b/api/video/i422_buffer.cc index d6cf0d6..d387a4c 100644 --- a/api/video/i422_buffer.cc +++ b/api/video/i422_buffer.cc
@@ -14,9 +14,9 @@ #include <algorithm> #include <utility> +#include "api/make_ref_counted.h" #include "api/video/i420_buffer.h" #include "rtc_base/checks.h" -#include "rtc_base/ref_counted_object.h" #include "third_party/libyuv/include/libyuv/convert.h" #include "third_party/libyuv/include/libyuv/planar_functions.h" #include "third_party/libyuv/include/libyuv/scale.h"
diff --git a/api/video/i444_buffer.cc b/api/video/i444_buffer.cc index 8bf9f76..98e8923 100644 --- a/api/video/i444_buffer.cc +++ b/api/video/i444_buffer.cc
@@ -14,9 +14,9 @@ #include <algorithm> #include <utility> +#include "api/make_ref_counted.h" #include "api/video/i420_buffer.h" #include "rtc_base/checks.h" -#include "rtc_base/ref_counted_object.h" #include "third_party/libyuv/include/libyuv/convert.h" #include "third_party/libyuv/include/libyuv/planar_functions.h" #include "third_party/libyuv/include/libyuv/scale.h"
diff --git a/api/video/nv12_buffer.cc b/api/video/nv12_buffer.cc index 37d688b..ca9dcd8 100644 --- a/api/video/nv12_buffer.cc +++ b/api/video/nv12_buffer.cc
@@ -10,9 +10,9 @@ #include "api/video/nv12_buffer.h" +#include "api/make_ref_counted.h" #include "api/video/i420_buffer.h" #include "rtc_base/checks.h" -#include "rtc_base/ref_counted_object.h" #include "third_party/libyuv/include/libyuv/convert.h" #include "third_party/libyuv/include/libyuv/scale.h"
diff --git a/api/video/recordable_encoded_frame.h b/api/video/recordable_encoded_frame.h index b4ad83a..702f4d7 100644 --- a/api/video/recordable_encoded_frame.h +++ b/api/video/recordable_encoded_frame.h
@@ -17,7 +17,6 @@ #include "api/video/color_space.h" #include "api/video/encoded_image.h" #include "api/video/video_codec_type.h" -#include "rtc_base/ref_count.h" namespace webrtc {