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}
This commit is contained in:
Niels Möller 2022-06-13 10:36:38 +02:00 committed by WebRTC LUCI CQ
parent 3fa9a66f22
commit 7c8c4db8ea
20 changed files with 53 additions and 39 deletions

View file

@ -89,10 +89,10 @@ rtc_library("rtp_packet_info") {
]
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 @@ rtc_library("media_stream_interface") {
]
deps = [
":audio_options_api",
":make_ref_counted",
":rtp_parameters",
":scoped_refptr",
":sequence_checker",
@ -179,6 +180,7 @@ rtc_library("libjingle_peerconnection_api") {
":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 @@ rtc_source_set("frame_transformer_interface") {
visibility = [ "*" ]
sources = [ "frame_transformer_interface.h" ]
deps = [
":make_ref_counted",
":scoped_refptr",
"../rtc_base:refcount",
"video:encoded_frame",
@ -318,6 +321,12 @@ rtc_source_set("scoped_refptr") {
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 @@ rtc_source_set("rtc_stats_api") {
]
deps = [
":make_ref_counted",
":scoped_refptr",
"../api:refcountedbase",
"../rtc_base:checks",
@ -767,6 +777,7 @@ rtc_library("ice_transport_factory") {
]
deps = [
":libjingle_peerconnection_api",
":make_ref_counted",
":packet_socket_factory",
":scoped_refptr",
"../p2p:rtc_p2p",
@ -990,6 +1001,7 @@ if (rtc_include_tests) {
deps = [
":array_view",
":libjingle_peerconnection_api",
":make_ref_counted",
":rtp_parameters",
"../rtc_base:checks",
"../rtc_base:refcount",
@ -1007,9 +1019,9 @@ if (rtc_include_tests) {
deps = [
":array_view",
":libjingle_peerconnection_api",
":make_ref_counted",
":rtp_parameters",
"../rtc_base:checks",
"../rtc_base:refcount",
"crypto:frame_decryptor_interface",
]
}

View file

@ -143,7 +143,6 @@ specific_include_rules = {
"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 @@ specific_include_rules = {
# 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 @@ specific_include_rules = {
"+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 @@ specific_include_rules = {
"+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 @@ specific_include_rules = {
"rtc_stats_report\.h": [
"+rtc_base/ref_count.h",
"+rtc_base/ref_counted_object.h",
],
"audioproc_float\.h": [
@ -247,14 +234,6 @@ specific_include_rules = {
"+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 @@ specific_include_rules = {
"+rtc_base/thread_annotations.h",
],
"make_ref_counted\.h": [
"+rtc_base/ref_counted_object.h",
],
"mock.*\.h": [
"+test/gmock.h",
],

View file

@ -37,6 +37,7 @@ rtc_source_set("audio_mixer_api") {
deps = [
":audio_frame_api",
"..:make_ref_counted",
"../../rtc_base:refcount",
]
}
@ -102,9 +103,9 @@ rtc_source_set("echo_detector_creator") {
"echo_detector_creator.h",
]
deps = [
"..:make_ref_counted",
"../../api:scoped_refptr",
"../../modules/audio_processing:api",
"../../modules/audio_processing:residual_echo_detector",
"../../rtc_base:refcount",
]
}

View file

@ -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 {

View file

@ -31,6 +31,7 @@ rtc_library("audio_codecs_api") {
deps = [
"..:array_view",
"..:bitrate_allocation",
"..:make_ref_counted",
"..:scoped_refptr",
"../../api:field_trials_view",
"../../rtc_base:buffer",

View file

@ -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 {

View file

@ -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 {

View file

@ -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"

18
api/make_ref_counted.h Normal file
View file

@ -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_

View file

@ -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 {

View file

@ -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

View file

@ -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 {

View file

@ -65,6 +65,7 @@ rtc_library("video_frame") {
deps = [
":video_rtp_headers",
"..:array_view",
"..:make_ref_counted",
"..:rtp_packet_info",
"..:scoped_refptr",
"..:video_track_source_constraints",
@ -93,6 +94,7 @@ rtc_library("video_frame_i010") {
deps = [
":video_frame",
":video_rtp_headers",
"..:make_ref_counted",
"..:scoped_refptr",
"../../rtc_base",
"../../rtc_base:checks",
@ -111,8 +113,8 @@ rtc_source_set("recordable_encoded_frame") {
":video_frame",
":video_rtp_headers",
"..:array_view",
"..:make_ref_counted",
"..:scoped_refptr",
"../../rtc_base:refcount",
"../units:timestamp",
]
}

View file

@ -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) {

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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 {