webrtc/api
Mirko Bonadei 317a1f09ed Use std::make_unique instead of absl::make_unique.
WebRTC is now using C++14 so there is no need to use the Abseil version
of std::make_unique.

This CL has been created with the following steps:

git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt
git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt
git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt

diff --new-line-format="" --unchanged-line-format="" \
  /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \
  uniq > /tmp/only_make_unique.txt
diff --new-line-format="" --unchanged-line-format="" \
  /tmp/only_make_unique.txt /tmp/memory.txt | \
  xargs grep -l "absl/memory" > /tmp/add-memory.txt

git grep -l "\babsl::make_unique\b" | \
  xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g"

git checkout PRESUBMIT.py abseil-in-webrtc.md

cat /tmp/add-memory.txt | \
  xargs sed -i \
  's/#include "absl\/memory\/memory.h"/#include <memory>/g'
git cl format
# Manual fix order of the new inserted #include <memory>

cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \
  xargs sed -i '/#include "absl\/memory\/memory.h"/d'

git ls-files | grep BUILD.gn | \
  xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d'

python tools_webrtc/gn_check_autofix.py \
  -m tryserver.webrtc -b linux_rel

# Repead the gn_check_autofix step for other platforms

git ls-files | grep BUILD.gn | \
  xargs sed -i 's/absl\/memory:memory/absl\/memory/g'
git cl format

Bug: webrtc:10945
Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 15:47:29 +00:00
..
audio Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
audio_codecs Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
call Wire the stable target bitrate from GoogCC to the BitrateAllocator 2019-08-22 15:25:15 +00:00
crypto Introduce api/crypto/BUILD.gn. 2019-09-13 17:21:47 +00:00
rtc_event_log Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
stats Add qualityLimitationResolutionChanges stat 2019-09-09 15:22:57 +00:00
task_queue Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
test Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
transport Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
units Format almost everything. 2019-07-08 13:45:15 +00:00
video Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
video_codecs Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
array_view.h Adding reinterpret to ArrayView to allow data manipulation. 2019-03-22 18:15:22 +00:00
array_view_unittest.cc Format almost everything. 2019-07-08 13:45:15 +00:00
async_resolver_factory.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
audio_options.cc Remove deprecated code related to AEC2 2019-08-07 10:09:36 +00:00
audio_options.h Remove deprecated code related to AEC2 2019-08-07 10:09:36 +00:00
bitrate_constraints.h Convert video quality test from a TEST_F to a TEST fixture. 2018-06-21 15:49:43 +00:00
BUILD.gn Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
candidate.cc (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
candidate.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
congestion_control_interface.h Move MediaTransportInterface out of the libjingle_peerconnection_api target 2019-09-13 10:49:56 +00:00
create_peerconnection_factory.cc Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
create_peerconnection_factory.h Force DefaultTaskQueueFactory in legacy CreatePeerConnectionFactory 2019-06-19 17:11:04 +00:00
crypto_params.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
data_channel_interface.cc Datachannel: Use absl::optional for maxRetransmits and maxRetransmitTime. 2019-04-09 08:32:43 +00:00
data_channel_interface.h Format almost everything. 2019-07-08 13:45:15 +00:00
data_channel_transport_interface.h Move MediaTransportInterface out of the libjingle_peerconnection_api target 2019-09-13 10:49:56 +00:00
datagram_transport_interface.h Move MediaTransportInterface out of the libjingle_peerconnection_api target 2019-09-13 10:49:56 +00:00
DEPS Prepare to move packet_socket_factory to api/. 2019-09-06 09:09:02 +00:00
DESIGN.md A threading explanation 2019-06-03 08:15:09 +00:00
dtls_transport_interface.cc Expose SSL ciphersuite on the webrtc::DtlsTransport interface 2019-04-12 08:29:59 +00:00
dtls_transport_interface.h Expose SSL ciphersuite on the webrtc::DtlsTransport interface 2019-04-12 08:29:59 +00:00
dtmf_sender_interface.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
fec_controller.h Make VideoFrameType an enum class, and move to separate file and target 2019-03-22 12:44:51 +00:00
fec_controller_override.h Define FecControllerOverride and plumb it down to VideoEncoder 2019-06-28 15:57:22 +00:00
function_view.h Move rtc::FunctionView to the public API 2019-03-21 15:23:05 +00:00
function_view_unittest.cc Format almost everything. 2019-07-08 13:45:15 +00:00
ice_transport_factory.cc Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
ice_transport_factory.h Add overload to CreateIceTransport that takes additional dependencies 2019-07-01 21:37:54 +00:00
ice_transport_interface.h Add IceTransportInterface object 2019-01-30 16:16:51 +00:00
jsep.cc Move SdpType from/to string definition close to declaration. 2018-10-12 09:59:40 +00:00
jsep.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
jsep_ice_candidate.cc Use unique_ptr in JsepCandidateCollection 2019-07-31 01:48:07 +00:00
jsep_ice_candidate.h Use unique_ptr in JsepCandidateCollection 2019-07-31 01:48:07 +00:00
jsep_session_description.h Remove deprecated JsepSession initializer 2019-06-11 17:35:30 +00:00
media_stream_interface.cc New target for api/rtp_parameters.h and api/media_types.h. 2019-08-29 09:04:32 +00:00
media_stream_interface.h New target for api/rtp_parameters.h and api/media_types.h. 2019-08-29 09:04:32 +00:00
media_stream_proxy.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
media_stream_track_proxy.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
media_transport_config.h Move MediaTransportInterface out of the libjingle_peerconnection_api target 2019-09-13 10:49:56 +00:00
media_transport_interface.h Move MediaTransportInterface out of the libjingle_peerconnection_api target 2019-09-13 10:49:56 +00:00
media_types.cc New target for api/rtp_parameters.h and api/media_types.h. 2019-08-29 09:04:32 +00:00
media_types.h New target for api/rtp_parameters.h and api/media_types.h. 2019-08-29 09:04:32 +00:00
network_state_predictor.h Add base class NetworkPredictor and NetworkPredictorFactory and wire up. 2019-04-10 12:38:58 +00:00
notifier.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
OWNERS Remove myself from OWNERS in a few places. 2019-06-10 07:57:46 +00:00
packet_socket_factory.h Prepare to move packet_socket_factory to api/. 2019-09-06 09:09:02 +00:00
peer_connection_factory_proxy.h Delete deprecated version of PeerConnectionFactoryInterface::StartAecDump 2019-06-27 07:33:59 +00:00
peer_connection_interface.cc Delete old version of PeerConnection::SetConfiguration 2019-09-04 08:23:18 +00:00
peer_connection_interface.h Delete forward declarations from peer_connection_interface.h 2019-09-16 09:59:56 +00:00
peer_connection_proxy.h Delete old version of PeerConnection::SetConfiguration 2019-09-04 08:23:18 +00:00
proxy.cc Make member internal::SynchronousMethodCall::e_ a non-pointer. 2018-11-15 10:42:36 +00:00
proxy.h Remove rtc_base/scoped_ref_ptr.h. 2019-01-25 20:29:58 +00:00
README.md Add a small README file for api/ 2019-02-01 13:24:47 +00:00
ref_counted_base.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
rtc_error.cc Using absl::string_view to stringify an RTCErrorType. 2019-01-16 11:49:00 +00:00
rtc_error.h Export symbols needed by the Chromium component build (part 8). 2019-04-02 10:13:36 +00:00
rtc_error_unittest.cc Format almost everything. 2019-07-08 13:45:15 +00:00
rtc_event_log_output.h Adds functionality to write logs to memory. 2019-01-16 17:36:31 +00:00
rtc_event_log_output_file.cc Format almost everything. 2019-07-08 13:45:15 +00:00
rtc_event_log_output_file.h Format almost everything. 2019-07-08 13:45:15 +00:00
rtc_event_log_output_file_unittest.cc Use std::make_unique instead of absl::make_unique. 2019-09-17 15:47:29 +00:00
rtp_headers.cc Reland "[cleanup] Remove useless includes." 2018-10-08 07:44:19 +00:00
rtp_headers.h Make NetworkStateEstimator injectable in RemoteBitrateEstimator 2019-09-10 18:47:36 +00:00
rtp_packet_info.cc Add AbsoluteCaptureTime to RtpPacketInfo. 2019-08-07 10:12:56 +00:00
rtp_packet_info.h Add AbsoluteCaptureTime to RtpPacketInfo. 2019-08-07 10:12:56 +00:00
rtp_packet_info_unittest.cc Add AbsoluteCaptureTime to RtpPacketInfo. 2019-08-07 10:12:56 +00:00
rtp_packet_infos.h Avoid copying of vectors in RtpPacketInfos. 2019-08-14 15:46:02 +00:00
rtp_packet_infos_unittest.cc Add AbsoluteCaptureTime to RtpPacketInfo. 2019-08-07 10:12:56 +00:00
rtp_parameters.cc Allow AbsSendTime extension to be used for audio streams. 2019-07-24 10:58:37 +00:00
rtp_parameters.h Format almost everything. 2019-07-08 13:45:15 +00:00
rtp_parameters_unittest.cc Format almost everything. 2019-07-08 13:45:15 +00:00
rtp_receiver_interface.cc Split out RtpSource from libjingle_peerconnection_api 2019-09-02 14:04:47 +00:00
rtp_receiver_interface.h Split out RtpSource from libjingle_peerconnection_api 2019-09-02 14:04:47 +00:00
rtp_sender_interface.cc Removing non-const RtpSenderInterface::GetParameters(). 2019-02-23 00:51:30 +00:00
rtp_sender_interface.h Add RtpSenderInterface.SetStreams 2019-05-20 18:38:06 +00:00
rtp_transceiver_interface.cc Implement RTCRtpTransceiver.setCodecPreferences 2019-05-01 20:14:59 +00:00
rtp_transceiver_interface.h Implement RTCRtpTransceiver.setCodecPreferences 2019-05-01 20:14:59 +00:00
scoped_refptr.h Add element_type typedef to rtc::scoped_refptr 2018-12-20 19:11:22 +00:00
sctp_transport_interface.cc Format almost everything. 2019-07-08 13:45:15 +00:00
sctp_transport_interface.h Export symbols needed by the Chromium component build (part 8). 2019-04-02 10:13:36 +00:00
set_remote_description_observer_interface.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
stats_types.cc Reporting audio device underrun counter 2019-08-16 11:49:55 +00:00
stats_types.h Reporting audio device underrun counter 2019-08-16 11:49:55 +00:00
turn_customizer.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
uma_metrics.h Remove backwards compatibility names from api/uma_metrics.h. 2019-08-29 13:35:56 +00:00
video_track_source_proxy.h Remove SetLatency/GetLatency from MediaSourceInterface API level 2019-04-18 19:11:31 +00:00

How to write code in the api/ directory

Mostly, just follow the regular style guide, but:

  • Note that api/ code is not exempt from the “.h and .cc files come in pairs” rule, so if you declare something in api/path/to/foo.h, it should be defined in api/path/to/foo.cc.
  • Headers in api/ should, if possible, not #include headers outside api/. Its not always possible to avoid this, but be aware that it adds to a small mountain of technical debt that were trying to shrink.
  • .cc files in api/, on the other hand, are free to #include headers outside api/.

That is, the preferred way for api/ code to access non-api/ code is to call it from a .cc file, so that users of our API headers wont transitively #include non-public headers.

For headers in api/ that need to refer to non-public types, forward declarations are often a lesser evil than including non-public header files. The usual rules still apply, though.

.cc files in api/ should preferably be kept reasonably small. If a substantial implementation is needed, consider putting it with our non-public code, and just call it from the api/ .cc file.