diff --git a/rtc_base/async_invoker.cc b/rtc_base/async_invoker.cc index 87d039373d..9d9dfd8016 100644 --- a/rtc_base/async_invoker.cc +++ b/rtc_base/async_invoker.cc @@ -53,7 +53,7 @@ void DEPRECATED_AsyncInvoker::Flush(Thread* thread, if (destroying_.load(std::memory_order_relaxed)) return; - // Run this on |thread| to reduce the number of context switches. + // Run this on `thread` to reduce the number of context switches. if (Thread::Current() != thread) { thread->Invoke(RTC_FROM_HERE, [this, thread, id] { Flush(thread, id); }); @@ -113,8 +113,8 @@ AsyncClosure::~AsyncClosure() { // destructor. invoker_->pending_invocations_.fetch_sub(1, std::memory_order_release); - // After |pending_invocations_| is decremented, we may need to signal - // |invocation_complete_| in case the AsyncInvoker is being destroyed and + // After `pending_invocations_` is decremented, we may need to signal + // `invocation_complete_` in case the AsyncInvoker is being destroyed and // waiting for pending tasks to complete. // // It's also possible that the destructor finishes before "Set()" is called, diff --git a/rtc_base/async_invoker.h b/rtc_base/async_invoker.h index fd42ca76de..20b24f3314 100644 --- a/rtc_base/async_invoker.h +++ b/rtc_base/async_invoker.h @@ -92,7 +92,7 @@ class DEPRECATED_AsyncInvoker : public MessageHandlerAutoCleanup { DEPRECATED_AsyncInvoker(); ~DEPRECATED_AsyncInvoker() override; - // Call |functor| asynchronously on |thread|, with no callback upon + // Call `functor` asynchronously on `thread`, with no callback upon // completion. Returns immediately. template void AsyncInvoke(const Location& posted_from, @@ -105,7 +105,7 @@ class DEPRECATED_AsyncInvoker : public MessageHandlerAutoCleanup { DoInvoke(posted_from, thread, std::move(closure), id); } - // Call |functor| asynchronously on |thread| with |delay_ms|, with no callback + // Call `functor` asynchronously on `thread` with `delay_ms`, with no callback // upon completion. Returns immediately. template void AsyncInvokeDelayed(const Location& posted_from, @@ -119,8 +119,8 @@ class DEPRECATED_AsyncInvoker : public MessageHandlerAutoCleanup { DoInvokeDelayed(posted_from, thread, std::move(closure), delay_ms, id); } - // Synchronously execute on |thread| all outstanding calls we own - // that are pending on |thread|, and wait for calls to complete + // Synchronously execute on `thread` all outstanding calls we own + // that are pending on `thread`, and wait for calls to complete // before returning. Optionally filter by message id. // The destructor will not wait for outstanding calls, so if that // behavior is desired, call Flush() before destroying this object. diff --git a/rtc_base/async_resolver.cc b/rtc_base/async_resolver.cc index d482b4e681..75efce5edd 100644 --- a/rtc_base/async_resolver.cc +++ b/rtc_base/async_resolver.cc @@ -57,7 +57,7 @@ int ResolveHostname(const std::string& hostname, struct addrinfo* result = nullptr; struct addrinfo hints = {0}; hints.ai_family = family; - // |family| here will almost always be AF_UNSPEC, because |family| comes from + // `family` here will almost always be AF_UNSPEC, because `family` comes from // AsyncResolver::addr_.family(), which comes from a SocketAddress constructed // with a hostname. When a SocketAddress is constructed with a hostname, its // family is AF_UNSPEC. However, if someday in the future we construct @@ -174,7 +174,7 @@ int AsyncResolver::GetError() const { void AsyncResolver::Destroy(bool wait) { // Some callers have trouble guaranteeing that Destroy is called on the - // sequence guarded by |sequence_checker_|. + // sequence guarded by `sequence_checker_`. // RTC_DCHECK_RUN_ON(&sequence_checker_); RTC_DCHECK(!destroy_called_); destroy_called_ = true; diff --git a/rtc_base/async_resolver_interface.h b/rtc_base/async_resolver_interface.h index 0d0bb7ce95..6916ea4860 100644 --- a/rtc_base/async_resolver_interface.h +++ b/rtc_base/async_resolver_interface.h @@ -23,12 +23,12 @@ class RTC_EXPORT AsyncResolverInterface { AsyncResolverInterface(); virtual ~AsyncResolverInterface(); - // Start address resolution of the hostname in |addr|. + // Start address resolution of the hostname in `addr`. virtual void Start(const SocketAddress& addr) = 0; - // Returns true iff the address from |Start| was successfully resolved. - // If the address was successfully resolved, sets |addr| to a copy of the - // address from |Start| with the IP address set to the top most resolved - // address of |family| (|addr| will have both hostname and the resolved ip). + // Returns true iff the address from `Start` was successfully resolved. + // If the address was successfully resolved, sets `addr` to a copy of the + // address from `Start` with the IP address set to the top most resolved + // address of `family` (`addr` will have both hostname and the resolved ip). virtual bool GetResolvedAddress(int family, SocketAddress* addr) const = 0; // Returns error from resolver. virtual int GetError() const = 0; diff --git a/rtc_base/async_tcp_socket.cc b/rtc_base/async_tcp_socket.cc index 35401d7c0a..3d8b23d2fa 100644 --- a/rtc_base/async_tcp_socket.cc +++ b/rtc_base/async_tcp_socket.cc @@ -44,7 +44,7 @@ static const size_t kMinimumRecvSize = 128; static const int kListenBacklog = 5; -// Binds and connects |socket| +// Binds and connects `socket` AsyncSocket* AsyncTCPSocketBase::ConnectSocket( rtc::AsyncSocket* socket, const rtc::SocketAddress& bind_address, @@ -276,9 +276,9 @@ void AsyncTCPSocketBase::OnCloseEvent(AsyncSocket* socket, int error) { } // AsyncTCPSocket -// Binds and connects |socket| and creates AsyncTCPSocket for -// it. Takes ownership of |socket|. Returns null if bind() or -// connect() fail (|socket| is destroyed in that case). +// Binds and connects `socket` and creates AsyncTCPSocket for +// it. Takes ownership of `socket`. Returns null if bind() or +// connect() fail (`socket` is destroyed in that case). AsyncTCPSocket* AsyncTCPSocket::Create(AsyncSocket* socket, const SocketAddress& bind_address, const SocketAddress& remote_address) { diff --git a/rtc_base/async_tcp_socket.h b/rtc_base/async_tcp_socket.h index e05cce1ec9..610d17d7fa 100644 --- a/rtc_base/async_tcp_socket.h +++ b/rtc_base/async_tcp_socket.h @@ -55,17 +55,17 @@ class AsyncTCPSocketBase : public AsyncPacketSocket { void SetError(int error) override; protected: - // Binds and connects |socket| and creates AsyncTCPSocket for - // it. Takes ownership of |socket|. Returns null if bind() or - // connect() fail (|socket| is destroyed in that case). + // Binds and connects `socket` and creates AsyncTCPSocket for + // it. Takes ownership of `socket`. Returns null if bind() or + // connect() fail (`socket` is destroyed in that case). static AsyncSocket* ConnectSocket(AsyncSocket* socket, const SocketAddress& bind_address, const SocketAddress& remote_address); int FlushOutBuffer(); - // Add data to |outbuf_|. + // Add data to `outbuf_`. void AppendToOutBuffer(const void* pv, size_t cb); - // Helper methods for |outpos_|. + // Helper methods for `outpos_`. bool IsOutBufferEmpty() const { return outbuf_.size() == 0; } void ClearOutBuffer() { outbuf_.Clear(); } @@ -88,9 +88,9 @@ class AsyncTCPSocketBase : public AsyncPacketSocket { class AsyncTCPSocket : public AsyncTCPSocketBase { public: - // Binds and connects |socket| and creates AsyncTCPSocket for - // it. Takes ownership of |socket|. Returns null if bind() or - // connect() fail (|socket| is destroyed in that case). + // Binds and connects `socket` and creates AsyncTCPSocket for + // it. Takes ownership of `socket`. Returns null if bind() or + // connect() fail (`socket` is destroyed in that case). static AsyncTCPSocket* Create(AsyncSocket* socket, const SocketAddress& bind_address, const SocketAddress& remote_address); diff --git a/rtc_base/async_udp_socket.h b/rtc_base/async_udp_socket.h index d1f0660943..ce7f4767ee 100644 --- a/rtc_base/async_udp_socket.h +++ b/rtc_base/async_udp_socket.h @@ -27,8 +27,8 @@ namespace rtc { // buffered since it is acceptable to drop packets under high load. class AsyncUDPSocket : public AsyncPacketSocket { public: - // Binds |socket| and creates AsyncUDPSocket for it. Takes ownership - // of |socket|. Returns null if bind() fails (|socket| is destroyed + // Binds `socket` and creates AsyncUDPSocket for it. Takes ownership + // of `socket`. Returns null if bind() fails (`socket` is destroyed // in that case). static AsyncUDPSocket* Create(AsyncSocket* socket, const SocketAddress& bind_address); diff --git a/rtc_base/bit_buffer.cc b/rtc_base/bit_buffer.cc index d212ef5637..4bb32fe008 100644 --- a/rtc_base/bit_buffer.cc +++ b/rtc_base/bit_buffer.cc @@ -17,13 +17,13 @@ namespace { -// Returns the lowest (right-most) |bit_count| bits in |byte|. +// Returns the lowest (right-most) `bit_count` bits in `byte`. uint8_t LowestBits(uint8_t byte, size_t bit_count) { RTC_DCHECK_LE(bit_count, 8); return byte & ((1 << bit_count) - 1); } -// Returns the highest (left-most) |bit_count| bits in |byte|, shifted to the +// Returns the highest (left-most) `bit_count` bits in `byte`, shifted to the // lowest bits (to the right). uint8_t HighestBits(uint8_t byte, size_t bit_count) { RTC_DCHECK_LE(bit_count, 8); @@ -32,14 +32,14 @@ uint8_t HighestBits(uint8_t byte, size_t bit_count) { return (byte & mask) >> shift; } -// Returns the highest byte of |val| in a uint8_t. +// Returns the highest byte of `val` in a uint8_t. uint8_t HighestByte(uint64_t val) { return static_cast(val >> 56); } -// Returns the result of writing partial data from |source|, of -// |source_bit_count| size in the highest bits, to |target| at -// |target_bit_offset| from the highest bit. +// Returns the result of writing partial data from `source`, of +// `source_bit_count` size in the highest bits, to `target` at +// `target_bit_offset` from the highest bit. uint8_t WritePartialByte(uint8_t source, size_t source_bit_count, uint8_t target, diff --git a/rtc_base/bit_buffer.h b/rtc_base/bit_buffer.h index 388218e698..57366161c9 100644 --- a/rtc_base/bit_buffer.h +++ b/rtc_base/bit_buffer.h @@ -106,10 +106,10 @@ class BitBuffer { return val ? ReadSignedExponentialGolomb(*val) : false; } - // Moves current position |byte_count| bytes forward. Returns false if + // Moves current position `byte_count` bytes forward. Returns false if // there aren't enough bytes left in the buffer. bool ConsumeBytes(size_t byte_count); - // Moves current position |bit_count| bits forward. Returns false if + // Moves current position `bit_count` bits forward. Returns false if // there aren't enough bits left in the buffer. bool ConsumeBits(size_t bit_count); @@ -119,9 +119,9 @@ class BitBuffer { protected: const uint8_t* const bytes_; - // The total size of |bytes_|. + // The total size of `bytes_`. size_t byte_count_; - // The current offset, in bytes, from the start of |bytes_|. + // The current offset, in bytes, from the start of `bytes_`. size_t byte_offset_; // The current offset, in bits, into the current byte. size_t bit_offset_; @@ -134,7 +134,7 @@ class BitBuffer { // BitBuffer API, so both reading and writing will consume bytes/bits. class BitBufferWriter : public BitBuffer { public: - // Constructs a bit buffer for the writable buffer of |bytes|. + // Constructs a bit buffer for the writable buffer of `bytes`. BitBufferWriter(uint8_t* bytes, size_t byte_count); // Writes byte-sized values from the buffer. Returns false if there isn't @@ -152,7 +152,7 @@ class BitBufferWriter : public BitBuffer { // Call SizeNonSymmetricBits to get number of bits needed to store the value. // Returns false if there isn't enough room left for the value. bool WriteNonSymmetric(uint32_t val, uint32_t num_values); - // Returns number of bits required to store |val| with NonSymmetric encoding. + // Returns number of bits required to store `val` with NonSymmetric encoding. static size_t SizeNonSymmetricBits(uint32_t val, uint32_t num_values); // Writes the exponential golomb encoded version of the supplied value. diff --git a/rtc_base/boringssl_certificate.cc b/rtc_base/boringssl_certificate.cc index bb14036a3e..e1bcd61070 100644 --- a/rtc_base/boringssl_certificate.cc +++ b/rtc_base/boringssl_certificate.cc @@ -115,7 +115,7 @@ bool AddSHA256SignatureAlgorithm(CBB* cbb, KeyType key_type) { return true; } -// Adds an X.509 Common Name to |cbb|. +// Adds an X.509 Common Name to `cbb`. bool AddCommonName(CBB* cbb, const std::string& common_name) { // See RFC 4519. static const uint8_t kCommonName[] = {0x55, 0x04, 0x03}; diff --git a/rtc_base/boringssl_certificate.h b/rtc_base/boringssl_certificate.h index 740763dc69..40a4bd8f38 100644 --- a/rtc_base/boringssl_certificate.h +++ b/rtc_base/boringssl_certificate.h @@ -52,7 +52,7 @@ class BoringSSLCertificate final : public SSLCertificate { bool operator==(const BoringSSLCertificate& other) const; bool operator!=(const BoringSSLCertificate& other) const; - // Compute the digest of the certificate given |algorithm|. + // Compute the digest of the certificate given `algorithm`. bool ComputeDigest(const std::string& algorithm, unsigned char* digest, size_t size, diff --git a/rtc_base/buffer.h b/rtc_base/buffer.h index d1639e2f71..c9bf2ccebf 100644 --- a/rtc_base/buffer.h +++ b/rtc_base/buffer.h @@ -229,13 +229,13 @@ class BufferT { SetData(w.data(), w.size()); } - // Replaces the data in the buffer with at most |max_elements| of data, using - // the function |setter|, which should have the following signature: + // Replaces the data in the buffer with at most `max_elements` of data, using + // the function `setter`, which should have the following signature: // // size_t setter(ArrayView view) // - // |setter| is given an appropriately typed ArrayView of length exactly - // |max_elements| that describes the area where it should write the data; it + // `setter` is given an appropriately typed ArrayView of length exactly + // `max_elements` that describes the area where it should write the data; it // should return the number of elements actually written. (If it doesn't fill // the whole ArrayView, it should leave the unused space at the end.) template view) // - // |setter| is given an appropriately typed ArrayView of length exactly - // |max_elements| that describes the area where it should write the data; it + // `setter` is given an appropriately typed ArrayView of length exactly + // `max_elements` that describes the area where it should write the data; it // should return the number of elements actually written. (If it doesn't fill // the whole ArrayView, it should leave the unused space at the end.) template () // Call RTC_EAT_STREAM_PARAMETERS with an argument that fails to compile if -// values of the same types as |a| and |b| can't be compared with the given -// operation, and that would evaluate |a| and |b| if evaluated. +// values of the same types as `a` and `b` can't be compared with the given +// operation, and that would evaluate `a` and `b` if evaluated. #define RTC_EAT_STREAM_PARAMETERS_OP(op, a, b) \ RTC_EAT_STREAM_PARAMETERS(((void)::rtc::Safe##op(a, b))) @@ -377,7 +377,7 @@ RTC_NORETURN RTC_EXPORT void UnreachableCodeReached(); // controlled by NDEBUG or anything else, so the check will be executed // regardless of compilation mode. // -// We make sure RTC_CHECK et al. always evaluates |condition|, as +// We make sure RTC_CHECK et al. always evaluates `condition`, as // doing RTC_CHECK(FunctionWithSideEffect()) is a common idiom. // // RTC_CHECK_OP is a helper macro for binary operators. diff --git a/rtc_base/containers/flat_map_unittest.cc b/rtc_base/containers/flat_map_unittest.cc index 8f0b77fc30..8317f6a340 100644 --- a/rtc_base/containers/flat_map_unittest.cc +++ b/rtc_base/containers/flat_map_unittest.cc @@ -242,7 +242,7 @@ TEST(FlatMap, InsertOrAssignMoveOnlyKey) { flat_map m; // Initial insertion should return an iterator to the element and set the - // second pair member to |true|. The inserted key and value should be moved + // second pair member to `true`. The inserted key and value should be moved // from. MoveOnlyInt key(1); MoveOnlyInt val(22); @@ -256,7 +256,7 @@ TEST(FlatMap, InsertOrAssignMoveOnlyKey) { // Second call with same key should result in an assignment, overwriting the // old value. Assignment should be indicated by setting the second pair member - // to |false|. Only the inserted value should be moved from, the key should be + // to `false`. Only the inserted value should be moved from, the key should be // left intact. key = MoveOnlyInt(1); val = MoveOnlyInt(44); @@ -316,7 +316,7 @@ TEST(FlatMap, TryEmplaceMoveOnlyKey) { flat_map> m; // Trying to emplace into an empty map should succeed. Insertion should return - // an iterator to the element and set the second pair member to |true|. The + // an iterator to the element and set the second pair member to `true`. The // inserted key and value should be moved from. MoveOnlyInt key(1); MoveOnlyInt val1(22); diff --git a/rtc_base/containers/flat_tree.h b/rtc_base/containers/flat_tree.h index 1b02cce1b4..c79b62b16f 100644 --- a/rtc_base/containers/flat_tree.h +++ b/rtc_base/containers/flat_tree.h @@ -432,14 +432,14 @@ class flat_tree { template iterator unsafe_emplace(const_iterator position, Args&&... args); - // Attempts to emplace a new element with key |key|. Only if |key| is not yet - // present, construct value_type from |args| and insert it. Returns an - // iterator to the element with key |key| and a bool indicating whether an + // Attempts to emplace a new element with key `key`. Only if `key` is not yet + // present, construct value_type from `args` and insert it. Returns an + // iterator to the element with key `key` and a bool indicating whether an // insertion happened. template std::pair emplace_key_args(const K& key, Args&&... args); - // Similar to |emplace_key_args|, but checks |hint| first as a possible + // Similar to `emplace_key_args`, but checks `hint` first as a possible // insertion position. template std::pair emplace_hint_key_args(const_iterator hint, @@ -553,7 +553,7 @@ class flat_tree { // have to store an instance of Compare. Since Compare commonly is stateless, // we use the RTC_NO_UNIQUE_ADDRESS attribute to save space. RTC_NO_UNIQUE_ADDRESS key_compare comp_; - // Declare after |key_compare_comp_| to workaround GCC ICE. For details + // Declare after `key_compare_comp_` to workaround GCC ICE. For details // see https://crbug.com/1156268 container_type body_; diff --git a/rtc_base/crc32.h b/rtc_base/crc32.h index 79c765f64f..ca8578d69c 100644 --- a/rtc_base/crc32.h +++ b/rtc_base/crc32.h @@ -18,11 +18,11 @@ namespace rtc { -// Updates a CRC32 checksum with |len| bytes from |buf|. |initial| holds the +// Updates a CRC32 checksum with `len` bytes from `buf`. `initial` holds the // checksum result from the previous update; for the first call, it should be 0. uint32_t UpdateCrc32(uint32_t initial, const void* buf, size_t len); -// Computes a CRC32 checksum using |len| bytes from |buf|. +// Computes a CRC32 checksum using `len` bytes from `buf`. inline uint32_t ComputeCrc32(const void* buf, size_t len) { return UpdateCrc32(0, buf, len); } diff --git a/rtc_base/deprecated/recursive_critical_section.h b/rtc_base/deprecated/recursive_critical_section.h index c044c732b9..15b1f97e9f 100644 --- a/rtc_base/deprecated/recursive_critical_section.h +++ b/rtc_base/deprecated/recursive_critical_section.h @@ -70,7 +70,7 @@ class RTC_LOCKABLE RecursiveCriticalSection { // TODO(tommi): We could use this number and subtract the recursion count // to find places where we have multiple threads contending on the same lock. mutable volatile int lock_queue_; - // |recursion_| represents the recursion count + 1 for the thread that owns + // `recursion_` represents the recursion count + 1 for the thread that owns // the lock. Only modified by the thread that owns the lock. mutable int recursion_; // Used to signal a single waiting thread when the lock becomes available. diff --git a/rtc_base/experiments/balanced_degradation_settings.h b/rtc_base/experiments/balanced_degradation_settings.h index 788893af94..0b2f2f5993 100644 --- a/rtc_base/experiments/balanced_degradation_settings.h +++ b/rtc_base/experiments/balanced_degradation_settings.h @@ -48,9 +48,9 @@ class BalancedDegradationSettings { // Optional settings. int qp_low = 0; int qp_high = 0; - int fps = 0; // If unset, defaults to |fps| in Config. - int kbps = 0; // If unset, defaults to |kbps| in Config. - int kbps_res = 0; // If unset, defaults to |kbps_res| in Config. + int fps = 0; // If unset, defaults to `fps` in Config. + int kbps = 0; // If unset, defaults to `kbps` in Config. + int kbps_res = 0; // If unset, defaults to `kbps_res` in Config. }; struct Config { @@ -94,11 +94,11 @@ class BalancedDegradationSettings { // optional optional int pixels = 0; // Video frame size. - // If the frame size is less than or equal to |pixels|: + // If the frame size is less than or equal to `pixels`: int fps = 0; // Min framerate to be used. int kbps = 0; // Min bitrate needed to adapt up (resolution/fps). int kbps_res = 0; // Min bitrate needed to adapt up in resolution. - int fps_diff = kNoFpsDiff; // Min fps reduction needed (input fps - |fps|) + int fps_diff = kNoFpsDiff; // Min fps reduction needed (input fps - `fps`) // w/o triggering a new subsequent downgrade // check. CodecTypeSpecific vp8; @@ -111,20 +111,20 @@ class BalancedDegradationSettings { // Returns configurations from field trial on success (default on failure). std::vector GetConfigs() const; - // Gets the min/max framerate from |configs_| based on |pixels|. + // Gets the min/max framerate from `configs_` based on `pixels`. int MinFps(VideoCodecType type, int pixels) const; int MaxFps(VideoCodecType type, int pixels) const; - // Checks if quality can be increased based on |pixels| and |bitrate_bps|. + // Checks if quality can be increased based on `pixels` and `bitrate_bps`. bool CanAdaptUp(VideoCodecType type, int pixels, uint32_t bitrate_bps) const; bool CanAdaptUpResolution(VideoCodecType type, int pixels, uint32_t bitrate_bps) const; - // Gets the min framerate diff from |configs_| based on |pixels|. + // Gets the min framerate diff from `configs_` based on `pixels`. absl::optional MinFpsDiff(int pixels) const; - // Gets QpThresholds for the codec |type| based on |pixels|. + // Gets QpThresholds for the codec `type` based on `pixels`. absl::optional GetQpThresholds( VideoCodecType type, int pixels) const; diff --git a/rtc_base/experiments/cpu_speed_experiment.h b/rtc_base/experiments/cpu_speed_experiment.h index 7c7268c559..025c1ea8c9 100644 --- a/rtc_base/experiments/cpu_speed_experiment.h +++ b/rtc_base/experiments/cpu_speed_experiment.h @@ -32,7 +32,7 @@ class CpuSpeedExperiment { // WebRTC-VP8-CpuSpeed-Arm/pixels:100|200|300,cpu_speed:-1|-2|-3/, // cpu_speed_le_cores:-4|-5|-6,cores:3/ - // If |num_cores| > 3 + // If `num_cores` > 3 // pixels <= 100 -> cpu speed: -1 // pixels <= 200 -> cpu speed: -2 // pixels <= 300 -> cpu speed: -3 @@ -43,20 +43,20 @@ class CpuSpeedExperiment { struct Config { int pixels = 0; // The video frame size. - int cpu_speed = 0; // The |cpu_speed| to be used if the frame size is less - // than or equal to |pixels|. + int cpu_speed = 0; // The `cpu_speed` to be used if the frame size is less + // than or equal to `pixels`. // Optional. - int cpu_speed_le_cores = 0; // Same as |cpu_speed| above but only used if - // |num_cores| <= |cores_|. + int cpu_speed_le_cores = 0; // Same as `cpu_speed` above but only used if + // `num_cores` <= `cores_`. }; - // Gets the cpu speed based on |pixels| and |num_cores|. + // Gets the cpu speed based on `pixels` and `num_cores`. absl::optional GetValue(int pixels, int num_cores) const; private: std::vector configs_; - // Threshold for when to use |cpu_speed_le_cores|. + // Threshold for when to use `cpu_speed_le_cores`. FieldTrialOptional cores_; }; diff --git a/rtc_base/experiments/quality_rampup_experiment.h b/rtc_base/experiments/quality_rampup_experiment.h index 9d46901104..78556ebda9 100644 --- a/rtc_base/experiments/quality_rampup_experiment.h +++ b/rtc_base/experiments/quality_rampup_experiment.h @@ -26,11 +26,11 @@ class QualityRampupExperiment final { absl::optional MaxBitrateFactor() const; // Sets the max bitrate and the frame size. - // The call has no effect if the frame size is less than |min_pixels_|. + // The call has no effect if the frame size is less than `min_pixels_`. void SetMaxBitrate(int pixels, uint32_t max_bitrate_kbps); // Returns true if the available bandwidth is a certain percentage - // (max_bitrate_factor_) above |max_bitrate_kbps_| for |min_duration_ms_|. + // (max_bitrate_factor_) above `max_bitrate_kbps_` for `min_duration_ms_`. bool BwHigh(int64_t now_ms, uint32_t available_bw_kbps); bool Enabled() const; diff --git a/rtc_base/experiments/quality_scaling_experiment.h b/rtc_base/experiments/quality_scaling_experiment.h index 14833c00b1..31d8292b5c 100644 --- a/rtc_base/experiments/quality_scaling_experiment.h +++ b/rtc_base/experiments/quality_scaling_experiment.h @@ -25,9 +25,9 @@ class QualityScalingExperiment { int h264_high; // H264: high QP threshold. int generic_low; // Generic: low QP threshold. int generic_high; // Generic: high QP threshold. - float alpha_high; // |alpha_| for ExpFilter used when checking high QP. - float alpha_low; // |alpha_| for ExpFilter used when checking low QP. - int drop; // >0 sets |use_all_drop_reasons| to true. + float alpha_high; // `alpha_` for ExpFilter used when checking high QP. + float alpha_low; // `alpha_` for ExpFilter used when checking low QP. + int drop; // >0 sets `use_all_drop_reasons` to true. }; // Used by QualityScaler. @@ -45,7 +45,7 @@ class QualityScalingExperiment { // Returns settings from field trial. static absl::optional ParseSettings(); - // Returns QpThresholds for the |codec_type|. + // Returns QpThresholds for the `codec_type`. static absl::optional GetQpThresholds( VideoCodecType codec_type); diff --git a/rtc_base/file_rotating_stream.cc b/rtc_base/file_rotating_stream.cc index b7d64ba92d..5a004a937b 100644 --- a/rtc_base/file_rotating_stream.cc +++ b/rtc_base/file_rotating_stream.cc @@ -41,7 +41,7 @@ const char kCallSessionLogPrefix[] = "webrtc_log"; std::string AddTrailingPathDelimiterIfNeeded(std::string directory); -// |dir| must have a trailing delimiter. |prefix| must not include wild card +// `dir` must have a trailing delimiter. `prefix` must not include wild card // characters. std::vector GetFilesWithPrefix(const std::string& directory, const std::string& prefix); @@ -291,7 +291,7 @@ void FileRotatingStream::CloseCurrentFile() { void FileRotatingStream::RotateFiles() { CloseCurrentFile(); - // Rotates the files by deleting the file at |rotation_index_|, which is the + // Rotates the files by deleting the file at `rotation_index_`, which is the // oldest file and then renaming the newer files to have an incremented index. // See header file comments for example. RTC_DCHECK_LT(rotation_index_, file_names_.size()); diff --git a/rtc_base/file_rotating_stream.h b/rtc_base/file_rotating_stream.h index 88461e344f..beb47c83da 100644 --- a/rtc_base/file_rotating_stream.h +++ b/rtc_base/file_rotating_stream.h @@ -112,7 +112,7 @@ class FileRotatingStream { // logs are most useful for call diagnostics. // // This implementation simply writes to a single file until -// |max_total_log_size| / 2 bytes are written to it, and subsequently writes to +// `max_total_log_size` / 2 bytes are written to it, and subsequently writes to // a set of rotating files. We do this by inheriting FileRotatingStream and // setting the appropriate internal variables so that we don't delete the last // (earliest) file on rotate, and that that file's size is bigger. @@ -124,7 +124,7 @@ class FileRotatingStream { class CallSessionFileRotatingStream : public FileRotatingStream { public: // Use this constructor for writing to a directory. Files in the directory - // matching what's used by the stream will be deleted. |max_total_log_size| + // matching what's used by the stream will be deleted. `max_total_log_size` // must be at least 4. CallSessionFileRotatingStream(const std::string& dir_path, size_t max_total_log_size); diff --git a/rtc_base/java/src/org/webrtc/Logging.java b/rtc_base/java/src/org/webrtc/Logging.java index 5dac688fca..788a3bbe6c 100644 --- a/rtc_base/java/src/org/webrtc/Logging.java +++ b/rtc_base/java/src/org/webrtc/Logging.java @@ -102,7 +102,7 @@ public class Logging { @Deprecated public static void enableTracing(String path, EnumSet levels) {} - // Enable diagnostic logging for messages of |severity| to the platform debug + // Enable diagnostic logging for messages of `severity` to the platform debug // output. On Android, the output will be directed to Logcat. // Note: this function starts collecting the output of the RTC_LOG() macros. // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. diff --git a/rtc_base/java/src/org/webrtc/ThreadUtils.java b/rtc_base/java/src/org/webrtc/ThreadUtils.java index d60230a8ad..e2445a9cb3 100644 --- a/rtc_base/java/src/org/webrtc/ThreadUtils.java +++ b/rtc_base/java/src/org/webrtc/ThreadUtils.java @@ -145,7 +145,7 @@ public class ThreadUtils { } /** - * Post |callable| to |handler| and wait for the result. + * Post `callable` to `handler` and wait for the result. */ public static V invokeAtFrontUninterruptibly( final Handler handler, final Callable callable) { @@ -190,7 +190,7 @@ public class ThreadUtils { } /** - * Post |runner| to |handler|, at the front, and wait for completion. + * Post `runner` to `handler`, at the front, and wait for completion. */ public static void invokeAtFrontUninterruptibly(final Handler handler, final Runnable runner) { invokeAtFrontUninterruptibly(handler, new Callable() { diff --git a/rtc_base/location.h b/rtc_base/location.h index ff1eea95a9..c7335c2cb5 100644 --- a/rtc_base/location.h +++ b/rtc_base/location.h @@ -36,7 +36,7 @@ class RTC_EXPORT Location { const char* file_name() const { return file_name_; } int line_number() const { return line_number_; } // TODO(steveanton): Remove once all downstream users have been updated to use - // |file_name()| and/or |line_number()|. + // `file_name()` and/or `line_number()`. const char* file_and_line() const { return file_name_; } std::string ToString() const; diff --git a/rtc_base/log_sinks.h b/rtc_base/log_sinks.h index 70d0299f0a..87bec6dba8 100644 --- a/rtc_base/log_sinks.h +++ b/rtc_base/log_sinks.h @@ -26,7 +26,7 @@ namespace rtc { // Init() must be called before adding this sink. class FileRotatingLogSink : public LogSink { public: - // |num_log_files| must be greater than 1 and |max_log_size| must be greater + // `num_log_files` must be greater than 1 and `max_log_size` must be greater // than 0. FileRotatingLogSink(const std::string& log_dir_path, const std::string& log_prefix, diff --git a/rtc_base/logging.h b/rtc_base/logging.h index e21c30e21a..4fbbb5c6fc 100644 --- a/rtc_base/logging.h +++ b/rtc_base/logging.h @@ -449,7 +449,7 @@ class LogMessage { // which case the logging start time will be the time of the first LogMessage // instance is created. static int64_t LogStartTime(); - // Returns the wall clock equivalent of |LogStartTime|, in seconds from the + // Returns the wall clock equivalent of `LogStartTime`, in seconds from the // epoch. static uint32_t WallClockStartTime(); // LogThreads: Display the thread identifier of the current thread @@ -463,14 +463,14 @@ class LogMessage { // Sets whether logs will be directed to stderr in debug mode. static void SetLogToStderr(bool log_to_stderr); // Stream: Any non-blocking stream interface. - // Installs the |stream| to collect logs with severtiy |min_sev| or higher. - // |stream| must live until deinstalled by RemoveLogToStream. - // If |stream| is the first stream added to the system, we might miss some + // Installs the `stream` to collect logs with severtiy `min_sev` or higher. + // `stream` must live until deinstalled by RemoveLogToStream. + // If `stream` is the first stream added to the system, we might miss some // early concurrent log statement happening from another thread happening near // this instant. static void AddLogToStream(LogSink* stream, LoggingSeverity min_sev); // Removes the specified stream, without destroying it. When the method - // has completed, it's guaranteed that |stream| will receive no more logging + // has completed, it's guaranteed that `stream` will receive no more logging // calls. static void RemoveLogToStream(LogSink* stream); // Returns the severity for the specified stream, of if none is specified, @@ -482,9 +482,9 @@ class LogMessage { // Parses the provided parameter stream to configure the options above. // Useful for configuring logging from the command line. static void ConfigureLogging(const char* params); - // Checks the current global debug severity and if the |streams_| collection - // is empty. If |severity| is smaller than the global severity and if the - // |streams_| collection is empty, the LogMessage will be considered a noop + // Checks the current global debug severity and if the `streams_` collection + // is empty. If `severity` is smaller than the global severity and if the + // `streams_` collection is empty, the LogMessage will be considered a noop // LogMessage. static bool IsNoop(LoggingSeverity severity); // Version of IsNoop that uses fewer instructions at the call site, since the @@ -573,7 +573,7 @@ class LogMessage { // The output streams and their associated severities static LogSink* streams_; - // Holds true with high probability if |streams_| is empty, false with high + // Holds true with high probability if `streams_` is empty, false with high // probability otherwise. Operated on with std::memory_order_relaxed because // it's ok to lose or log some additional statements near the instant streams // are added/removed. diff --git a/rtc_base/mdns_responder_interface.h b/rtc_base/mdns_responder_interface.h index 96280a779e..64fb3cebff 100644 --- a/rtc_base/mdns_responder_interface.h +++ b/rtc_base/mdns_responder_interface.h @@ -29,17 +29,17 @@ class MdnsResponderInterface { MdnsResponderInterface() = default; virtual ~MdnsResponderInterface() = default; - // Asynchronously creates and returns a new name via |callback| for |addr| if + // Asynchronously creates and returns a new name via `callback` for `addr` if // there is no name mapped to it by this responder, and initializes the // reference count of this name to one. Otherwise the existing name mapped to - // |addr| is returned and its reference count is incremented by one. + // `addr` is returned and its reference count is incremented by one. virtual void CreateNameForAddress(const rtc::IPAddress& addr, NameCreatedCallback callback) = 0; - // Decrements the reference count of the mapped name of |addr|, if + // Decrements the reference count of the mapped name of `addr`, if // there is a map created previously via CreateNameForAddress; asynchronously - // removes the association between |addr| and its mapped name, and returns - // true via |callback| if the decremented reference count reaches zero. - // Otherwise no operation is done and false is returned via |callback| + // removes the association between `addr` and its mapped name, and returns + // true via `callback` if the decremented reference count reaches zero. + // Otherwise no operation is done and false is returned via `callback` // asynchronously. virtual void RemoveNameForAddress(const rtc::IPAddress& addr, NameRemovedCallback callback) = 0; diff --git a/rtc_base/memory/aligned_malloc.cc b/rtc_base/memory/aligned_malloc.cc index b00fab2994..7add079398 100644 --- a/rtc_base/memory/aligned_malloc.cc +++ b/rtc_base/memory/aligned_malloc.cc @@ -26,7 +26,7 @@ namespace webrtc { uintptr_t GetRightAlign(uintptr_t start_pos, size_t alignment) { - // The pointer should be aligned with |alignment| bytes. The - 1 guarantees + // The pointer should be aligned with `alignment` bytes. The - 1 guarantees // that it is aligned towards the closest higher (right) address. return (start_pos + alignment - 1) & ~(alignment - 1); } diff --git a/rtc_base/memory/aligned_malloc.h b/rtc_base/memory/aligned_malloc.h index 42a6daaef6..1c7d303885 100644 --- a/rtc_base/memory/aligned_malloc.h +++ b/rtc_base/memory/aligned_malloc.h @@ -21,13 +21,13 @@ namespace webrtc { -// Returns a pointer to the first boundry of |alignment| bytes following the -// address of |ptr|. +// Returns a pointer to the first boundry of `alignment` bytes following the +// address of `ptr`. // Note that there is no guarantee that the memory in question is available. -// |ptr| has no requirements other than it can't be NULL. +// `ptr` has no requirements other than it can't be NULL. void* GetRightAlign(const void* ptr, size_t alignment); -// Allocates memory of |size| bytes aligned on an |alignment| boundry. +// Allocates memory of `size` bytes aligned on an `alignment` boundry. // The return value is a pointer to the memory. Note that the memory must // be de-allocated using AlignedFree. void* AlignedMalloc(size_t size, size_t alignment); diff --git a/rtc_base/memory/aligned_malloc_unittest.cc b/rtc_base/memory/aligned_malloc_unittest.cc index 572af5a8bb..8e750035f0 100644 --- a/rtc_base/memory/aligned_malloc_unittest.cc +++ b/rtc_base/memory/aligned_malloc_unittest.cc @@ -22,7 +22,7 @@ namespace webrtc { -// Returns true if |size| and |alignment| are valid combinations. +// Returns true if `size` and `alignment` are valid combinations. bool CorrectUsage(size_t size, size_t alignment) { std::unique_ptr scoped( static_cast(AlignedMalloc(size, alignment))); diff --git a/rtc_base/memory/fifo_buffer.h b/rtc_base/memory/fifo_buffer.h index bf2edf6e24..de3ebcd5e8 100644 --- a/rtc_base/memory/fifo_buffer.h +++ b/rtc_base/memory/fifo_buffer.h @@ -34,7 +34,7 @@ class FifoBuffer final : public StreamInterface { // Resizes the buffer to the specified capacity. Fails if data_length_ > size bool SetCapacity(size_t length); - // Read into |buffer| with an offset from the current read position, offset + // Read into `buffer` with an offset from the current read position, offset // is specified in number of bytes. // This method doesn't adjust read position nor the number of available // bytes, user has to call ConsumeReadData() to do this. @@ -43,7 +43,7 @@ class FifoBuffer final : public StreamInterface { size_t offset, size_t* bytes_read); - // Write |buffer| with an offset from the current write position, offset is + // Write `buffer` with an offset from the current write position, offset is // specified in number of bytes. // This method doesn't adjust the number of buffered bytes, user has to call // ConsumeWriteBuffer() to do this. diff --git a/rtc_base/memory/fifo_buffer_unittest.cc b/rtc_base/memory/fifo_buffer_unittest.cc index 14cb4a5a6d..5c8ef43835 100644 --- a/rtc_base/memory/fifo_buffer_unittest.cc +++ b/rtc_base/memory/fifo_buffer_unittest.cc @@ -249,7 +249,7 @@ TEST(FifoBufferTest, WriteOffsetAndReadOffset) { // Write 14 bytes. EXPECT_EQ(SR_SUCCESS, buf.Write(in, 14, nullptr, nullptr)); - // Make sure data is in |buf|. + // Make sure data is in `buf`. size_t buffered; EXPECT_TRUE(buf.GetBuffered(&buffered)); EXPECT_EQ(14u, buffered); diff --git a/rtc_base/message_digest.h b/rtc_base/message_digest.h index 691330e23c..02e0bfd561 100644 --- a/rtc_base/message_digest.h +++ b/rtc_base/message_digest.h @@ -32,9 +32,9 @@ class MessageDigest { virtual ~MessageDigest() {} // Returns the digest output size (e.g. 16 bytes for MD5). virtual size_t Size() const = 0; - // Updates the digest with |len| bytes from |buf|. + // Updates the digest with `len` bytes from `buf`. virtual void Update(const void* buf, size_t len) = 0; - // Outputs the digest value to |buf| with length |len|. + // Outputs the digest value to `buf` with length `len`. // Returns the number of bytes written, i.e., Size(). virtual size_t Finish(void* buf, size_t len) = 0; }; @@ -51,28 +51,28 @@ bool IsFips180DigestAlgorithm(const std::string& alg); // Functions to create hashes. -// Computes the hash of |in_len| bytes of |input|, using the |digest| hash -// implementation, and outputs the hash to the buffer |output|, which is -// |out_len| bytes long. Returns the number of bytes written to |output| if -// successful, or 0 if |out_len| was too small. +// Computes the hash of `in_len` bytes of `input`, using the `digest` hash +// implementation, and outputs the hash to the buffer `output`, which is +// `out_len` bytes long. Returns the number of bytes written to `output` if +// successful, or 0 if `out_len` was too small. size_t ComputeDigest(MessageDigest* digest, const void* input, size_t in_len, void* output, size_t out_len); // Like the previous function, but creates a digest implementation based on -// the desired digest name |alg|, e.g. DIGEST_SHA_1. Returns 0 if there is no +// the desired digest name `alg`, e.g. DIGEST_SHA_1. Returns 0 if there is no // digest with the given name. size_t ComputeDigest(const std::string& alg, const void* input, size_t in_len, void* output, size_t out_len); -// Computes the hash of |input| using the |digest| hash implementation, and +// Computes the hash of `input` using the `digest` hash implementation, and // returns it as a hex-encoded string. std::string ComputeDigest(MessageDigest* digest, const std::string& input); // Like the previous function, but creates a digest implementation based on -// the desired digest name |alg|, e.g. DIGEST_SHA_1. Returns empty string if +// the desired digest name `alg`, e.g. DIGEST_SHA_1. Returns empty string if // there is no digest with the given name. std::string ComputeDigest(const std::string& alg, const std::string& input); // Like the previous function, but returns an explicit result code. @@ -87,10 +87,10 @@ inline std::string MD5(const std::string& input) { // Functions to compute RFC 2104 HMACs. -// Computes the HMAC of |in_len| bytes of |input|, using the |digest| hash -// implementation and |key_len| bytes of |key| to key the HMAC, and outputs -// the HMAC to the buffer |output|, which is |out_len| bytes long. Returns the -// number of bytes written to |output| if successful, or 0 if |out_len| was too +// Computes the HMAC of `in_len` bytes of `input`, using the `digest` hash +// implementation and `key_len` bytes of `key` to key the HMAC, and outputs +// the HMAC to the buffer `output`, which is `out_len` bytes long. Returns the +// number of bytes written to `output` if successful, or 0 if `out_len` was too // small. size_t ComputeHmac(MessageDigest* digest, const void* key, @@ -100,7 +100,7 @@ size_t ComputeHmac(MessageDigest* digest, void* output, size_t out_len); // Like the previous function, but creates a digest implementation based on -// the desired digest name |alg|, e.g. DIGEST_SHA_1. Returns 0 if there is no +// the desired digest name `alg`, e.g. DIGEST_SHA_1. Returns 0 if there is no // digest with the given name. size_t ComputeHmac(const std::string& alg, const void* key, @@ -109,13 +109,13 @@ size_t ComputeHmac(const std::string& alg, size_t in_len, void* output, size_t out_len); -// Computes the HMAC of |input| using the |digest| hash implementation and |key| +// Computes the HMAC of `input` using the `digest` hash implementation and `key` // to key the HMAC, and returns it as a hex-encoded string. std::string ComputeHmac(MessageDigest* digest, const std::string& key, const std::string& input); // Like the previous function, but creates a digest implementation based on -// the desired digest name |alg|, e.g. DIGEST_SHA_1. Returns empty string if +// the desired digest name `alg`, e.g. DIGEST_SHA_1. Returns empty string if // there is no digest with the given name. std::string ComputeHmac(const std::string& alg, const std::string& key, diff --git a/rtc_base/nat_socket_factory.cc b/rtc_base/nat_socket_factory.cc index effbb5a6c3..874e9387c6 100644 --- a/rtc_base/nat_socket_factory.cc +++ b/rtc_base/nat_socket_factory.cc @@ -103,7 +103,7 @@ class NATSocket : public AsyncSocket, public sigslot::has_slots<> { int Connect(const SocketAddress& addr) override { int result = 0; - // If we're not already bound (meaning |socket_| is null), bind to ANY + // If we're not already bound (meaning `socket_` is null), bind to ANY // address. if (!socket_) { result = BindInternal(SocketAddress(GetAnyIP(family_), 0)); diff --git a/rtc_base/network.cc b/rtc_base/network.cc index a22d8ffbe4..5725458cb1 100644 --- a/rtc_base/network.cc +++ b/rtc_base/network.cc @@ -398,20 +398,20 @@ void NetworkManagerBase::MergeNetworkList(const NetworkList& new_networks, } networks_map_[key]->set_mdns_responder_provider(this); } - // It may still happen that the merged list is a subset of |networks_|. + // It may still happen that the merged list is a subset of `networks_`. // To detect this change, we compare their sizes. if (merged_list.size() != networks_.size()) { *changed = true; } - // If the network list changes, we re-assign |networks_| to the merged list + // If the network list changes, we re-assign `networks_` to the merged list // and re-sort it. if (*changed) { networks_ = merged_list; // Reset the active states of all networks. for (const auto& kv : networks_map_) { Network* network = kv.second; - // If |network| is in the newly generated |networks_|, it is active. + // If `network` is in the newly generated `networks_`, it is active. bool found = absl::c_linear_search(networks_, network); network->set_active(found); } diff --git a/rtc_base/network.h b/rtc_base/network.h index 8b6b6235fa..8088840e69 100644 --- a/rtc_base/network.h +++ b/rtc_base/network.h @@ -175,14 +175,14 @@ class RTC_EXPORT NetworkManagerBase : public NetworkManager { protected: typedef std::map NetworkMap; - // Updates |networks_| with the networks listed in |list|. If - // |network_map_| already has a Network object for a network listed - // in the |list| then it is reused. Accept ownership of the Network - // objects in the |list|. |changed| will be set to true if there is + // Updates `networks_` with the networks listed in `list`. If + // `network_map_` already has a Network object for a network listed + // in the `list` then it is reused. Accept ownership of the Network + // objects in the `list`. `changed` will be set to true if there is // any change in the network list. void MergeNetworkList(const NetworkList& list, bool* changed); - // |stats| will be populated even if |*changed| is false. + // `stats` will be populated even if |*changed| is false. void MergeNetworkList(const NetworkList& list, bool* changed, NetworkManager::Stats* stats); @@ -353,7 +353,7 @@ class RTC_EXPORT Network { // Returns the length, in bits, of this network's prefix. int prefix_length() const { return prefix_length_; } - // |key_| has unique value per network interface. Used in sorting network + // `key_` has unique value per network interface. Used in sorting network // interfaces. Key is derived from interface name and it's prefix. std::string key() const { return key_; } diff --git a/rtc_base/network_monitor.h b/rtc_base/network_monitor.h index 1e150fe861..c0eea1ff52 100644 --- a/rtc_base/network_monitor.h +++ b/rtc_base/network_monitor.h @@ -42,8 +42,8 @@ const char* NetworkPreferenceToString(NetworkPreference preference); // where only the ip address is known at the time of binding. class NetworkBinderInterface { public: - // Binds a socket to the network that is attached to |address| so that all - // packets on the socket |socket_fd| will be sent via that network. + // Binds a socket to the network that is attached to `address` so that all + // packets on the socket `socket_fd` will be sent via that network. // This is needed because some operating systems (like Android) require a // special bind call to put packets on a non-default network interface. virtual NetworkBindingResult BindSocketToNetwork( @@ -53,7 +53,7 @@ class NetworkBinderInterface { }; /* - * Receives network-change events via |OnNetworksChanged| and signals the + * Receives network-change events via `OnNetworksChanged` and signals the * networks changed event. * * Threading consideration: @@ -85,7 +85,7 @@ class NetworkMonitorInterface { virtual NetworkPreference GetNetworkPreference( const std::string& interface_name) = 0; - // Does |this| NetworkMonitorInterface implement BindSocketToNetwork? + // Does `this` NetworkMonitorInterface implement BindSocketToNetwork? // Only Android returns true. virtual bool SupportsBindSocketToNetwork() const { return false; } diff --git a/rtc_base/numerics/event_based_exponential_moving_average.cc b/rtc_base/numerics/event_based_exponential_moving_average.cc index 36c5b8994c..b426fdeed7 100644 --- a/rtc_base/numerics/event_based_exponential_moving_average.cc +++ b/rtc_base/numerics/event_based_exponential_moving_average.cc @@ -24,9 +24,9 @@ constexpr double ninetyfive_percent_confidence = 1.96; namespace rtc { -// |half_time| specifies how much weight will be given to old samples, +// `half_time` specifies how much weight will be given to old samples, // a sample gets exponentially less weight so that it's 50% -// after |half_time| time units has passed. +// after `half_time` time units has passed. EventBasedExponentialMovingAverage::EventBasedExponentialMovingAverage( int half_time) { SetHalfTime(half_time); diff --git a/rtc_base/numerics/event_based_exponential_moving_average.h b/rtc_base/numerics/event_based_exponential_moving_average.h index 352b55f5ae..a59fff7241 100644 --- a/rtc_base/numerics/event_based_exponential_moving_average.h +++ b/rtc_base/numerics/event_based_exponential_moving_average.h @@ -26,11 +26,11 @@ namespace rtc { * https://en.wikipedia.org/wiki/Talk:Moving_average. * * A sample gets exponentially less weight so that it's 50% - * after |half_time| time units. + * after `half_time` time units. */ class EventBasedExponentialMovingAverage { public: - // |half_time| specifies how much weight will be given to old samples, + // `half_time` specifies how much weight will be given to old samples, // see example above. explicit EventBasedExponentialMovingAverage(int half_time); diff --git a/rtc_base/numerics/event_rate_counter.h b/rtc_base/numerics/event_rate_counter.h index ebeac873b8..60ec3ba416 100644 --- a/rtc_base/numerics/event_rate_counter.h +++ b/rtc_base/numerics/event_rate_counter.h @@ -19,10 +19,10 @@ namespace webrtc { // so it's mostly useful for end of call statistics. class EventRateCounter { public: - // Adds an event based on it's |event_time| for correct updates of the + // Adds an event based on it's `event_time` for correct updates of the // interval statistics, each event must be added past the previous events. void AddEvent(Timestamp event_time); - // Adds the events from |other|. Note that the interval stats won't be + // Adds the events from `other`. Note that the interval stats won't be // recalculated, only merged, so this is not equivalent to if the events would // have been added to the same counter from the start. void AddEvents(EventRateCounter other); diff --git a/rtc_base/numerics/exp_filter.h b/rtc_base/numerics/exp_filter.h index 4be9a0a778..6bded80d02 100644 --- a/rtc_base/numerics/exp_filter.h +++ b/rtc_base/numerics/exp_filter.h @@ -25,7 +25,7 @@ class ExpFilter { } // Resets the filter to its initial state, and resets filter factor base to - // the given value |alpha|. + // the given value `alpha`. void Reset(float alpha); // Applies the filter with a given exponent on the provided sample: @@ -35,7 +35,7 @@ class ExpFilter { // Returns current filtered value. float filtered() const { return filtered_; } - // Changes the filter factor base to the given value |alpha|. + // Changes the filter factor base to the given value `alpha`. void UpdateBase(float alpha); private: diff --git a/rtc_base/numerics/histogram_percentile_counter.h b/rtc_base/numerics/histogram_percentile_counter.h index a708c2da71..4787f2ef98 100644 --- a/rtc_base/numerics/histogram_percentile_counter.h +++ b/rtc_base/numerics/histogram_percentile_counter.h @@ -20,11 +20,11 @@ #include "absl/types/optional.h" namespace rtc { -// Calculates percentiles on the stream of data. Use |Add| methods to add new -// values. Use |GetPercentile| to get percentile of the currently added values. +// Calculates percentiles on the stream of data. Use `Add` methods to add new +// values. Use `GetPercentile` to get percentile of the currently added values. class HistogramPercentileCounter { public: - // Values below |long_tail_boundary| are stored as the histogram in an array. + // Values below `long_tail_boundary` are stored as the histogram in an array. // Values above - in a map. explicit HistogramPercentileCounter(uint32_t long_tail_boundary); ~HistogramPercentileCounter(); diff --git a/rtc_base/numerics/histogram_percentile_counter_unittest.cc b/rtc_base/numerics/histogram_percentile_counter_unittest.cc index 6fdaa364eb..fc36b59208 100644 --- a/rtc_base/numerics/histogram_percentile_counter_unittest.cc +++ b/rtc_base/numerics/histogram_percentile_counter_unittest.cc @@ -23,7 +23,7 @@ TEST(HistogramPercentileCounterTest, ReturnsCorrectPercentiles) { EXPECT_FALSE(counter.GetPercentile(0.5f)); // Pairs of {fraction, percentile value} computed by hand - // for |kTestValues|. + // for `kTestValues`. const std::vector> kTestPercentiles = { {0.0f, 1}, {0.01f, 1}, {0.5f, 10}, {0.9f, 18}, {0.95f, 19}, {0.99f, 20}, {1.0f, 20}}; diff --git a/rtc_base/numerics/math_utils.h b/rtc_base/numerics/math_utils.h index 0f1d51b090..5482cec6e5 100644 --- a/rtc_base/numerics/math_utils.h +++ b/rtc_base/numerics/math_utils.h @@ -18,7 +18,7 @@ namespace webrtc { namespace webrtc_impl { -// Given two numbers |x| and |y| such that x >= y, computes the difference +// Given two numbers `x` and `y` such that x >= y, computes the difference // x - y without causing undefined behavior due to signed overflow. template typename std::make_unsigned::type unsigned_difference(T x, T y) { diff --git a/rtc_base/numerics/moving_average.h b/rtc_base/numerics/moving_average.h index dfaf6ce81b..41ce60348e 100644 --- a/rtc_base/numerics/moving_average.h +++ b/rtc_base/numerics/moving_average.h @@ -35,7 +35,7 @@ class MovingAverage { // Adds new sample. If the window is full, the oldest element is pushed out. void AddSample(int sample); - // Returns rounded down average of last |window_size| elements or all + // Returns rounded down average of last `window_size` elements or all // elements if there are not enough of them. Returns nullopt if there were // no elements added. absl::optional GetAverageRoundedDown() const; @@ -58,7 +58,7 @@ class MovingAverage { // Sum of the samples in the moving window. int64_t sum_ = 0; // Circular buffer for all the samples in the moving window. - // Size is always |window_size| + // Size is always `window_size` std::vector history_; }; diff --git a/rtc_base/numerics/moving_max_counter.h b/rtc_base/numerics/moving_max_counter.h index ca956e96e8..26dd506d63 100644 --- a/rtc_base/numerics/moving_max_counter.h +++ b/rtc_base/numerics/moving_max_counter.h @@ -27,8 +27,8 @@ namespace rtc { // fixed moving window. // // Window size is configured at constructor. -// Samples can be added with |Add()| and max over current window is returned by -// |MovingMax|. |current_time_ms| in successive calls to Add and MovingMax +// Samples can be added with `Add()` and max over current window is returned by +// `MovingMax`. `current_time_ms` in successive calls to Add and MovingMax // should never decrease as if it's a wallclock time. template class MovingMaxCounter { diff --git a/rtc_base/numerics/moving_median_filter.h b/rtc_base/numerics/moving_median_filter.h index 4abaeff5bc..157eb152c3 100644 --- a/rtc_base/numerics/moving_median_filter.h +++ b/rtc_base/numerics/moving_median_filter.h @@ -26,8 +26,8 @@ namespace webrtc { template class MovingMedianFilter { public: - // Construct filter. |window_size| is how many latest samples are stored and - // used to take median. |window_size| must be positive. + // Construct filter. `window_size` is how many latest samples are stored and + // used to take median. `window_size` must be positive. explicit MovingMedianFilter(size_t window_size); // Insert a new sample. diff --git a/rtc_base/numerics/percentile_filter.h b/rtc_base/numerics/percentile_filter.h index cba44639b7..2a18c1aa73 100644 --- a/rtc_base/numerics/percentile_filter.h +++ b/rtc_base/numerics/percentile_filter.h @@ -26,14 +26,14 @@ namespace webrtc { template class PercentileFilter { public: - // Construct filter. |percentile| should be between 0 and 1. + // Construct filter. `percentile` should be between 0 and 1. explicit PercentileFilter(float percentile); // Insert one observation. The complexity of this operation is logarithmic in // the size of the container. void Insert(const T& value); - // Remove one observation or return false if |value| doesn't exist in the + // Remove one observation or return false if `value` doesn't exist in the // container. The complexity of this operation is logarithmic in the size of // the container. bool Erase(const T& value); @@ -73,7 +73,7 @@ void PercentileFilter::Insert(const T& value) { percentile_it_ = set_.begin(); percentile_index_ = 0; } else if (value < *percentile_it_) { - // If new element is before us, increment |percentile_index_|. + // If new element is before us, increment `percentile_index_`. ++percentile_index_; } UpdatePercentileIterator(); @@ -91,7 +91,7 @@ bool PercentileFilter::Erase(const T& value) { percentile_it_ = set_.erase(it); } else { set_.erase(it); - // If erased element was before us, decrement |percentile_index_|. + // If erased element was before us, decrement `percentile_index_`. if (value <= *percentile_it_) --percentile_index_; } diff --git a/rtc_base/numerics/percentile_filter_unittest.cc b/rtc_base/numerics/percentile_filter_unittest.cc index 2655cc28cc..0de8be5609 100644 --- a/rtc_base/numerics/percentile_filter_unittest.cc +++ b/rtc_base/numerics/percentile_filter_unittest.cc @@ -117,17 +117,17 @@ TEST_P(PercentileFilterTest, InsertAndEraseTenValuesInRandomOrder) { // The percentile value of the ten values above. const int64_t expected_value = static_cast(GetParam() * 9); - // Insert two sets of |zero_to_nine| in random order. + // Insert two sets of `zero_to_nine` in random order. for (int i = 0; i < 2; ++i) { absl::c_shuffle(zero_to_nine, std::mt19937(std::random_device()())); for (int64_t value : zero_to_nine) filter_.Insert(value); - // After inserting a full set of |zero_to_nine|, the percentile should + // After inserting a full set of `zero_to_nine`, the percentile should // stay constant. EXPECT_EQ(expected_value, filter_.GetPercentileValue()); } - // Insert and erase sets of |zero_to_nine| in random order a few times. + // Insert and erase sets of `zero_to_nine` in random order a few times. for (int i = 0; i < 3; ++i) { absl::c_shuffle(zero_to_nine, std::mt19937(std::random_device()())); for (int64_t value : zero_to_nine) diff --git a/rtc_base/numerics/sample_counter.h b/rtc_base/numerics/sample_counter.h index 93d39c3c8d..717a1afbcf 100644 --- a/rtc_base/numerics/sample_counter.h +++ b/rtc_base/numerics/sample_counter.h @@ -29,8 +29,8 @@ class SampleCounter { absl::optional Sum(int64_t min_required_samples) const; int64_t NumSamples() const; void Reset(); - // Adds all the samples from the |other| SampleCounter as if they were all - // individually added using |Add(int)| method. + // Adds all the samples from the `other` SampleCounter as if they were all + // individually added using `Add(int)` method. void Add(const SampleCounter& other); protected: @@ -46,8 +46,8 @@ class SampleCounterWithVariance : public SampleCounter { void Add(int sample); absl::optional Variance(int64_t min_required_samples) const; void Reset(); - // Adds all the samples from the |other| SampleCounter as if they were all - // individually added using |Add(int)| method. + // Adds all the samples from the `other` SampleCounter as if they were all + // individually added using `Add(int)` method. void Add(const SampleCounterWithVariance& other); private: diff --git a/rtc_base/numerics/sequence_number_util.h b/rtc_base/numerics/sequence_number_util.h index 5b4ad10e94..5da9d45e32 100644 --- a/rtc_base/numerics/sequence_number_util.h +++ b/rtc_base/numerics/sequence_number_util.h @@ -22,9 +22,9 @@ namespace webrtc { -// Test if the sequence number |a| is ahead or at sequence number |b|. +// Test if the sequence number `a` is ahead or at sequence number `b`. // -// If |M| is an even number and the two sequence numbers are at max distance +// If `M` is an even number and the two sequence numbers are at max distance // from each other, then the sequence number with the highest value is // considered to be ahead. template @@ -52,9 +52,9 @@ inline bool AheadOrAt(T a, T b) { return AheadOrAt(a, b); } -// Test if the sequence number |a| is ahead of sequence number |b|. +// Test if the sequence number `a` is ahead of sequence number `b`. // -// If |M| is an even number and the two sequence numbers are at max distance +// If `M` is an even number and the two sequence numbers are at max distance // from each other, then the sequence number with the highest value is // considered to be ahead. template diff --git a/rtc_base/openssl_adapter.cc b/rtc_base/openssl_adapter.cc index c381f04899..42195de6fd 100644 --- a/rtc_base/openssl_adapter.cc +++ b/rtc_base/openssl_adapter.cc @@ -294,7 +294,7 @@ int OpenSSLAdapter::BeginSSL() { // First set up the context. We should either have a factory, with its own // pre-existing context, or be running standalone, in which case we will - // need to create one, and specify |false| to disable session caching. + // need to create one, and specify `false` to disable session caching. if (ssl_session_cache_ == nullptr) { RTC_DCHECK(!ssl_ctx_); ssl_ctx_ = CreateContext(ssl_mode_, false); @@ -370,7 +370,7 @@ int OpenSSLAdapter::BeginSSL() { SSL_set1_curves_list(ssl_, rtc::join(elliptic_curves_, ':').c_str()); } - // Now that the initial config is done, transfer ownership of |bio| to the + // Now that the initial config is done, transfer ownership of `bio` to the // SSL object. If ContinueSSL() fails, the bio will be freed in Cleanup(). SSL_set_bio(ssl_, bio.get(), bio.get()); bio.release(); diff --git a/rtc_base/openssl_adapter.h b/rtc_base/openssl_adapter.h index 9b2a36e00f..8d42967c71 100644 --- a/rtc_base/openssl_adapter.h +++ b/rtc_base/openssl_adapter.h @@ -75,7 +75,7 @@ class OpenSSLAdapter final : public SSLAdapter, ConnState GetState() const override; bool IsResumedSession() override; // Creates a new SSL_CTX object, configured for client-to-server usage - // with SSLMode |mode|, and if |enable_cache| is true, with support for + // with SSLMode `mode`, and if `enable_cache` is true, with support for // storing successful sessions so that they can be later resumed. // OpenSSLAdapterFactory will call this method to create its own internal // SSL_CTX, and OpenSSLAdapter will also call this when used without a @@ -114,7 +114,7 @@ class OpenSSLAdapter final : public SSLAdapter, void Error(const char* context, int err, bool signal = true); void Cleanup(); - // Return value and arguments have the same meanings as for Send; |error| is + // Return value and arguments have the same meanings as for Send; `error` is // an output parameter filled with the result of SSL_get_error. int DoSslWrite(const void* pv, size_t cb, int* error); void OnMessage(Message* msg) override; @@ -136,7 +136,7 @@ class OpenSSLAdapter final : public SSLAdapter, #endif friend class OpenSSLStreamAdapter; // for custom_verify_callback_; - // If the SSL_CTX was created with |enable_cache| set to true, this callback + // If the SSL_CTX was created with `enable_cache` set to true, this callback // will be called when a SSL session has been successfully established, // to allow its SSL_SESSION* to be cached for later resumption. static int NewSSLSessionCallback(SSL* ssl, SSL_SESSION* session); diff --git a/rtc_base/openssl_digest.h b/rtc_base/openssl_digest.h index 7fcb71ce00..6da01a0ded 100644 --- a/rtc_base/openssl_digest.h +++ b/rtc_base/openssl_digest.h @@ -23,14 +23,14 @@ namespace rtc { // An implementation of the digest class that uses OpenSSL. class OpenSSLDigest final : public MessageDigest { public: - // Creates an OpenSSLDigest with |algorithm| as the hash algorithm. + // Creates an OpenSSLDigest with `algorithm` as the hash algorithm. explicit OpenSSLDigest(const std::string& algorithm); ~OpenSSLDigest() override; // Returns the digest output size (e.g. 16 bytes for MD5). size_t Size() const override; - // Updates the digest with |len| bytes from |buf|. + // Updates the digest with `len` bytes from `buf`. void Update(const void* buf, size_t len) override; - // Outputs the digest value to |buf| with length |len|. + // Outputs the digest value to `buf` with length `len`. size_t Finish(void* buf, size_t len) override; // Helper function to look up a digest's EVP by name. diff --git a/rtc_base/openssl_stream_adapter.cc b/rtc_base/openssl_stream_adapter.cc index d250853815..76da464de9 100644 --- a/rtc_base/openssl_stream_adapter.cc +++ b/rtc_base/openssl_stream_adapter.cc @@ -57,7 +57,7 @@ namespace rtc { namespace { -// SRTP cipher suite table. |internal_name| is used to construct a +// SRTP cipher suite table. `internal_name` is used to construct a // colon-separated profile strings which is needed by // SSL_CTX_set_tlsext_use_srtp(). struct SrtpCipherMapEntry { diff --git a/rtc_base/openssl_stream_adapter.h b/rtc_base/openssl_stream_adapter.h index 58e15e3e6f..236bdfdfea 100644 --- a/rtc_base/openssl_stream_adapter.h +++ b/rtc_base/openssl_stream_adapter.h @@ -63,9 +63,9 @@ class SSLCertChain; /////////////////////////////////////////////////////////////////////////////// -// If |allow| has a value, its value determines if legacy TLS protocols are +// If `allow` has a value, its value determines if legacy TLS protocols are // allowed, overriding the default configuration. -// If |allow| has no value, any previous override is removed and the default +// If `allow` has no value, any previous override is removed and the default // configuration is restored. RTC_EXPORT void SetAllowLegacyTLSProtocols(const absl::optional& allow); @@ -169,7 +169,7 @@ class OpenSSLStreamAdapter final : public SSLStreamAdapter { // raised on the stream with the specified error. // A 0 error means a graceful close, otherwise there is not really enough // context to interpret the error code. - // |alert| indicates an alert description (one of the SSL_AD constants) to + // `alert` indicates an alert description (one of the SSL_AD constants) to // send to the remote endpoint when closing the association. If 0, a normal // shutdown will be performed. void Error(const char* context, int err, uint8_t alert, bool signal); diff --git a/rtc_base/operations_chain.cc b/rtc_base/operations_chain.cc index f707d339b6..59d30d350e 100644 --- a/rtc_base/operations_chain.cc +++ b/rtc_base/operations_chain.cc @@ -30,7 +30,7 @@ void OperationsChain::CallbackHandle::OnOperationComplete() { has_run_ = true; #endif // RTC_DCHECK_IS_ON operations_chain_->OnOperationComplete(); - // We have no reason to keep the |operations_chain_| alive through reference + // We have no reason to keep the `operations_chain_` alive through reference // counting anymore. operations_chain_ = nullptr; } diff --git a/rtc_base/operations_chain.h b/rtc_base/operations_chain.h index 3dc5995114..7823f6e238 100644 --- a/rtc_base/operations_chain.h +++ b/rtc_base/operations_chain.h @@ -40,8 +40,8 @@ class Operation { virtual void Run() = 0; }; -// FunctorT is the same as in OperationsChain::ChainOperation(). |callback_| is -// passed on to the |functor_| and is used to inform the OperationsChain that +// FunctorT is the same as in OperationsChain::ChainOperation(). `callback_` is +// passed on to the `functor_` and is used to inform the OperationsChain that // the operation completed. The functor is responsible for invoking the // callback when the operation has completed. template @@ -63,13 +63,13 @@ class OperationWithFunctor final : public Operation { has_run_ = true; #endif // RTC_DCHECK_IS_ON // The functor being executed may invoke the callback synchronously, - // marking the operation as complete. As such, |this| OperationWithFunctor - // object may get deleted here, including destroying |functor_|. To + // marking the operation as complete. As such, `this` OperationWithFunctor + // object may get deleted here, including destroying `functor_`. To // protect the functor from self-destruction while running, it is moved to // a local variable. auto functor = std::move(functor_); functor(std::move(callback_)); - // |this| may now be deleted; don't touch any member variables. + // `this` may now be deleted; don't touch any member variables. } private: @@ -122,7 +122,7 @@ class OperationsChain final : public RefCountedObject { bool IsEmpty() const; // Chains an operation. Chained operations are executed in FIFO order. The - // operation starts when |functor| is executed by the OperationsChain and is + // operation starts when `functor` is executed by the OperationsChain and is // contractually obligated to invoke the callback passed to it when the // operation is complete. Operations must start and complete on the same // sequence that this method was invoked on. diff --git a/rtc_base/operations_chain_unittest.cc b/rtc_base/operations_chain_unittest.cc index 792a2c76ff..f99c05e0db 100644 --- a/rtc_base/operations_chain_unittest.cc +++ b/rtc_base/operations_chain_unittest.cc @@ -78,8 +78,8 @@ class OperationTracker { callback(); } - // This operation is completed asynchronously; it pings |background_thread_|, - // blocking that thread until |unblock_operation_event| is signaled and then + // This operation is completed asynchronously; it pings `background_thread_`, + // blocking that thread until `unblock_operation_event` is signaled and then // completes upon posting back to the thread that the operation started on. // Note that this requires the starting thread to be executing tasks (handle // messages), i.e. must not be blocked. @@ -191,7 +191,7 @@ class OperationTrackerProxy { return operation_complete_event; } - // The order of completed events. Touches the |operation_tracker_| on the + // The order of completed events. Touches the `operation_tracker_` on the // calling thread, this is only thread safe if all chained operations have // completed. const std::vector& completed_operation_events() const { @@ -212,7 +212,7 @@ class SignalOnDestruction final { RTC_DCHECK(destructor_called_); } ~SignalOnDestruction() { - // Moved objects will have |destructor_called_| set to null. Destroying a + // Moved objects will have `destructor_called_` set to null. Destroying a // moved SignalOnDestruction should not signal. if (destructor_called_) { *destructor_called_ = true; diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc index 7904548041..ed6f81baf1 100644 --- a/rtc_base/physical_socket_server.cc +++ b/rtc_base/physical_socket_server.cc @@ -711,7 +711,7 @@ bool SocketDispatcher::IsDescriptorClosed() { if (udp_) { // The MSG_PEEK trick doesn't work for UDP, since (at least in some // circumstances) it requires reading an entire UDP packet, which would be - // bad for performance here. So, just check whether |s_| has been closed, + // bad for performance here. So, just check whether `s_` has been closed, // which should be sufficient. return s_ == INVALID_SOCKET; } diff --git a/rtc_base/platform_thread.h b/rtc_base/platform_thread.h index 11ccfae3d0..2c82c02455 100644 --- a/rtc_base/platform_thread.h +++ b/rtc_base/platform_thread.h @@ -50,12 +50,12 @@ class PlatformThread final { // removed. PlatformThread() = default; - // Moves |rhs| into this, storing an empty state in |rhs|. + // Moves `rhs` into this, storing an empty state in `rhs`. // TODO(bugs.webrtc.org/12727) Look into if default and move support can be // removed. PlatformThread(PlatformThread&& rhs); - // Moves |rhs| into this, storing an empty state in |rhs|. + // Moves `rhs` into this, storing an empty state in `rhs`. // TODO(bugs.webrtc.org/12727) Look into if default and move support can be // removed. PlatformThread& operator=(PlatformThread&& rhs); diff --git a/rtc_base/rate_tracker.h b/rtc_base/rate_tracker.h index 3b3c23538d..d706569ecd 100644 --- a/rtc_base/rate_tracker.h +++ b/rtc_base/rate_tracker.h @@ -47,7 +47,7 @@ class RateTracker { // these samples, and increments the count for that bucket by sample_count. void AddSamples(int64_t sample_count); - // Increment count for bucket at |current_time_ms|. + // Increment count for bucket at `current_time_ms`. void AddSamplesAtTime(int64_t current_time_ms, int64_t sample_count); protected: diff --git a/rtc_base/rolling_accumulator_unittest.cc b/rtc_base/rolling_accumulator_unittest.cc index 83013ca545..3a26f9e42f 100644 --- a/rtc_base/rolling_accumulator_unittest.cc +++ b/rtc_base/rolling_accumulator_unittest.cc @@ -20,7 +20,7 @@ namespace { const double kLearningRate = 0.5; -// Add |n| samples drawn from uniform distribution in [a;b]. +// Add `n` samples drawn from uniform distribution in [a;b]. void FillStatsFromUniformDistribution(RollingAccumulator& stats, int n, double a, diff --git a/rtc_base/rtc_certificate.h b/rtc_base/rtc_certificate.h index fa026ec331..882c735036 100644 --- a/rtc_base/rtc_certificate.h +++ b/rtc_base/rtc_certificate.h @@ -53,13 +53,13 @@ class RTCCertificatePEM { class RTC_EXPORT RTCCertificate final : public RefCountedNonVirtual { public: - // Takes ownership of |identity|. + // Takes ownership of `identity`. static scoped_refptr Create( std::unique_ptr identity); // Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z. uint64_t Expires() const; - // Checks if the certificate has expired, where |now| is expressed in ms + // Checks if the certificate has expired, where `now` is expressed in ms // relative to epoch, 1970-01-01T00:00:00Z. bool HasExpired(uint64_t now) const; @@ -87,7 +87,7 @@ class RTC_EXPORT RTCCertificate final private: // The SSLIdentity is the owner of the SSLCertificate. To protect our - // GetSSLCertificate() we take ownership of |identity_|. + // GetSSLCertificate() we take ownership of `identity_`. const std::unique_ptr identity_; }; diff --git a/rtc_base/rtc_certificate_generator.cc b/rtc_base/rtc_certificate_generator.cc index 5e1fdcac30..3a597814ae 100644 --- a/rtc_base/rtc_certificate_generator.cc +++ b/rtc_base/rtc_certificate_generator.cc @@ -47,11 +47,11 @@ scoped_refptr RTCCertificateGenerator::GenerateCertificate( uint64_t expires_s = *expires_ms / 1000; // Limit the expiration time to something reasonable (a year). This was // somewhat arbitrarily chosen. It also ensures that the value is not too - // large for the unspecified |time_t|. + // large for the unspecified `time_t`. expires_s = std::min(expires_s, kYearInSeconds); - // TODO(torbjorng): Stop using |time_t|, its type is unspecified. It it safe + // TODO(torbjorng): Stop using `time_t`, its type is unspecified. It it safe // to assume it can hold up to a year's worth of seconds (and more), but - // |SSLIdentity::Create| should stop relying on |time_t|. + // |SSLIdentity::Create| should stop relying on `time_t`. // See bugs.webrtc.org/5720. time_t cert_lifetime_s = static_cast(expires_s); identity = SSLIdentity::Create(kIdentityName, key_params, cert_lifetime_s); @@ -76,9 +76,9 @@ void RTCCertificateGenerator::GenerateCertificateAsync( RTC_DCHECK(signaling_thread_->IsCurrent()); RTC_DCHECK(callback); - // Create a new |RTCCertificateGenerationTask| for this generation request. It + // Create a new `RTCCertificateGenerationTask` for this generation request. It // is reference counted and referenced by the message data, ensuring it lives - // until the task has completed (independent of |RTCCertificateGenerator|). + // until the task has completed (independent of `RTCCertificateGenerator`). worker_thread_->PostTask(RTC_FROM_HERE, [key_params, expires_ms, signaling_thread = signaling_thread_, cb = callback]() { diff --git a/rtc_base/rtc_certificate_generator.h b/rtc_base/rtc_certificate_generator.h index 7c91163312..ee68b27969 100644 --- a/rtc_base/rtc_certificate_generator.h +++ b/rtc_base/rtc_certificate_generator.h @@ -33,15 +33,15 @@ class RTCCertificateGeneratorCallback : public RefCountInterface { ~RTCCertificateGeneratorCallback() override {} }; -// Generates |RTCCertificate|s. -// See |RTCCertificateGenerator| for the WebRTC repo's implementation. +// Generates `RTCCertificate`s. +// See `RTCCertificateGenerator` for the WebRTC repo's implementation. class RTCCertificateGeneratorInterface { public: virtual ~RTCCertificateGeneratorInterface() {} // Generates a certificate asynchronously on the worker thread. - // Must be called on the signaling thread. The |callback| is invoked with the - // result on the signaling thread. |exipres_ms| optionally specifies for how + // Must be called on the signaling thread. The `callback` is invoked with the + // result on the signaling thread. `exipres_ms` optionally specifies for how // long we want the certificate to be valid, but the implementation may choose // its own restrictions on the expiration time. virtual void GenerateCertificateAsync( @@ -50,17 +50,17 @@ class RTCCertificateGeneratorInterface { const scoped_refptr& callback) = 0; }; -// Standard implementation of |RTCCertificateGeneratorInterface|. -// The static function |GenerateCertificate| generates a certificate on the -// current thread. The |RTCCertificateGenerator| instance generates certificates -// asynchronously on the worker thread with |GenerateCertificateAsync|. +// Standard implementation of `RTCCertificateGeneratorInterface`. +// The static function `GenerateCertificate` generates a certificate on the +// current thread. The `RTCCertificateGenerator` instance generates certificates +// asynchronously on the worker thread with `GenerateCertificateAsync`. class RTC_EXPORT RTCCertificateGenerator : public RTCCertificateGeneratorInterface { public: // Generates a certificate on the current thread. Returns null on failure. - // If |expires_ms| is specified, the certificate will expire in approximately - // that many milliseconds from now. |expires_ms| is limited to a year, a - // larger value than that is clamped down to a year. If |expires_ms| is not + // If `expires_ms` is specified, the certificate will expire in approximately + // that many milliseconds from now. `expires_ms` is limited to a year, a + // larger value than that is clamped down to a year. If `expires_ms` is not // specified, a default expiration time is used. static scoped_refptr GenerateCertificate( const KeyParams& key_params, @@ -69,10 +69,10 @@ class RTC_EXPORT RTCCertificateGenerator RTCCertificateGenerator(Thread* signaling_thread, Thread* worker_thread); ~RTCCertificateGenerator() override {} - // |RTCCertificateGeneratorInterface| overrides. - // If |expires_ms| is specified, the certificate will expire in approximately - // that many milliseconds from now. |expires_ms| is limited to a year, a - // larger value than that is clamped down to a year. If |expires_ms| is not + // `RTCCertificateGeneratorInterface` overrides. + // If `expires_ms` is specified, the certificate will expire in approximately + // that many milliseconds from now. `expires_ms` is limited to a year, a + // larger value than that is clamped down to a year. If `expires_ms` is not // specified, a default expiration time is used. void GenerateCertificateAsync( const KeyParams& key_params, diff --git a/rtc_base/rtc_certificate_generator_unittest.cc b/rtc_base/rtc_certificate_generator_unittest.cc index 2d6986a9ea..bef85f25e6 100644 --- a/rtc_base/rtc_certificate_generator_unittest.cc +++ b/rtc_base/rtc_certificate_generator_unittest.cc @@ -94,7 +94,7 @@ TEST_F(RTCCertificateGeneratorTest, GenerateAsyncECDSA) { absl::nullopt, fixture_); // Until generation has completed, the certificate is null. Since this is an // async call, generation must not have completed until we process messages - // posted to this thread (which is done by |EXPECT_TRUE_WAIT|). + // posted to this thread (which is done by `EXPECT_TRUE_WAIT`). EXPECT_FALSE(fixture_->GenerateAsyncCompleted()); EXPECT_FALSE(fixture_->certificate()); EXPECT_TRUE_WAIT(fixture_->GenerateAsyncCompleted(), kGenerationTimeoutMs); @@ -120,7 +120,7 @@ TEST_F(RTCCertificateGeneratorTest, GenerateWithExpires) { kExpiresMs); EXPECT_TRUE(cert_b); - // Verify that |cert_b| expires approximately |kExpiresMs| after |cert_a| + // Verify that `cert_b` expires approximately `kExpiresMs` after `cert_a` // (allowing a +/- 1 second plus maximum generation time difference). EXPECT_GT(cert_b->Expires(), cert_a->Expires()); uint64_t expires_diff = cert_b->Expires() - cert_a->Expires(); diff --git a/rtc_base/rtc_certificate_unittest.cc b/rtc_base/rtc_certificate_unittest.cc index 96bd67ba85..63183883b3 100644 --- a/rtc_base/rtc_certificate_unittest.cc +++ b/rtc_base/rtc_certificate_unittest.cc @@ -62,7 +62,7 @@ class RTCCertificateTest : public ::testing::Test { return cert->HasExpired(now_s * kNumMillisecsPerSec); } - // An RTC_CHECK ensures that |expires_s| this is in valid range of time_t as + // An RTC_CHECK ensures that `expires_s` this is in valid range of time_t as // is required by SSLIdentityParams. On some 32-bit systems time_t is limited // to < 2^31. On such systems this will fail for expiration times of year 2038 // or later. diff --git a/rtc_base/socket.h b/rtc_base/socket.h index 6b3ad5e9f2..81f4f0b1d4 100644 --- a/rtc_base/socket.h +++ b/rtc_base/socket.h @@ -94,7 +94,7 @@ class Socket { virtual int Connect(const SocketAddress& addr) = 0; virtual int Send(const void* pv, size_t cb) = 0; virtual int SendTo(const void* pv, size_t cb, const SocketAddress& addr) = 0; - // |timestamp| is in units of microseconds. + // `timestamp` is in units of microseconds. virtual int Recv(void* pv, size_t cb, int64_t* timestamp) = 0; virtual int RecvFrom(void* pv, size_t cb, diff --git a/rtc_base/ssl_adapter.h b/rtc_base/ssl_adapter.h index 805fdc7ba0..2605770872 100644 --- a/rtc_base/ssl_adapter.h +++ b/rtc_base/ssl_adapter.h @@ -69,7 +69,7 @@ class SSLAdapter : public AsyncSocketAdapter { virtual void SetCertVerifier(SSLCertificateVerifier* ssl_cert_verifier) = 0; // Set the certificate this socket will present to incoming clients. - // Takes ownership of |identity|. + // Takes ownership of `identity`. virtual void SetIdentity(std::unique_ptr identity) = 0; // Choose whether the socket acts as a server socket or client socket. @@ -88,8 +88,8 @@ class SSLAdapter : public AsyncSocketAdapter { virtual bool IsResumedSession() = 0; // Create the default SSL adapter for this platform. On failure, returns null - // and deletes |socket|. Otherwise, the returned SSLAdapter takes ownership - // of |socket|. + // and deletes `socket`. Otherwise, the returned SSLAdapter takes ownership + // of `socket`. static SSLAdapter* Create(AsyncSocket* socket); }; diff --git a/rtc_base/ssl_certificate.cc b/rtc_base/ssl_certificate.cc index 3f7013ee11..3f12c79215 100644 --- a/rtc_base/ssl_certificate.cc +++ b/rtc_base/ssl_certificate.cc @@ -103,12 +103,12 @@ std::unique_ptr SSLCertChain::Clone() const { std::unique_ptr SSLCertChain::GetStats() const { // We have a linked list of certificates, starting with the first element of - // |certs_| and ending with the last element of |certs_|. The "issuer" of a + // `certs_` and ending with the last element of `certs_`. The "issuer" of a // certificate is the next certificate in the chain. Stats are produced for // each certificate in the list. Here, the "issuer" is the issuer's stats. std::unique_ptr issuer; - // The loop runs in reverse so that the |issuer| is known before the - // certificate issued by |issuer|. + // The loop runs in reverse so that the `issuer` is known before the + // certificate issued by `issuer`. for (ptrdiff_t i = certs_.size() - 1; i >= 0; --i) { std::unique_ptr new_stats = certs_[i]->GetStats(); if (new_stats) { diff --git a/rtc_base/ssl_identity.cc b/rtc_base/ssl_identity.cc index 8d93ecfe23..c24f46eff1 100644 --- a/rtc_base/ssl_identity.cc +++ b/rtc_base/ssl_identity.cc @@ -33,8 +33,8 @@ namespace rtc { ////////////////////////////////////////////////////////////////////// namespace { -// Read |n| bytes from ASN1 number string at *|pp| and return the numeric value. -// Update *|pp| and *|np| to reflect number of read bytes. +// Read `n` bytes from ASN1 number string at *`pp` and return the numeric value. +// Update *`pp` and *`np` to reflect number of read bytes. // TODO(bugs.webrtc.org/9860) - Remove this code. inline int ASN1ReadInt(const unsigned char** pp, size_t* np, size_t n) { const unsigned char* p = *pp; @@ -87,7 +87,7 @@ int64_t ASN1TimeToSec(const unsigned char* s, size_t length, bool long_format) { } } - // Read out remaining ASN1 time data and store it in |tm| in documented + // Read out remaining ASN1 time data and store it in `tm` in documented // std::tm format. tm tm; tm.tm_year = year; diff --git a/rtc_base/ssl_identity.h b/rtc_base/ssl_identity.h index a9167ef5eb..78d1ec12b7 100644 --- a/rtc_base/ssl_identity.h +++ b/rtc_base/ssl_identity.h @@ -85,7 +85,7 @@ class RTC_EXPORT KeyParams { // appropriately we can change KeyType enum -> class without breaking Chromium. KeyType IntKeyTypeFamilyToKeyType(int key_type_family); -// Parameters for generating a certificate. If |common_name| is non-empty, it +// Parameters for generating a certificate. If `common_name` is non-empty, it // will be used for the certificate's subject and issuer name, otherwise a // random string will be used. struct SSLIdentityParams { @@ -101,10 +101,10 @@ struct SSLIdentityParams { class RTC_EXPORT SSLIdentity { public: // Generates an identity (keypair and self-signed certificate). If - // |common_name| is non-empty, it will be used for the certificate's subject + // `common_name` is non-empty, it will be used for the certificate's subject // and issuer name, otherwise a random string will be used. The key type and - // parameters are defined in |key_param|. The certificate's lifetime in - // seconds from the current time is defined in |certificate_lifetime|; it + // parameters are defined in `key_param`. The certificate's lifetime in + // seconds from the current time is defined in `certificate_lifetime`; it // should be a non-negative number. // Returns null on failure. // Caller is responsible for freeing the returned object. @@ -160,7 +160,7 @@ bool operator!=(const SSLIdentity& a, const SSLIdentity& b); // Convert from ASN1 time as restricted by RFC 5280 to seconds from 1970-01-01 // 00.00 ("epoch"). If the ASN1 time cannot be read, return -1. The data at -// |s| is not 0-terminated; its char count is defined by |length|. +// `s` is not 0-terminated; its char count is defined by `length`. int64_t ASN1TimeToSec(const unsigned char* s, size_t length, bool long_format); extern const char kPemTypeCertificate[]; diff --git a/rtc_base/ssl_identity_unittest.cc b/rtc_base/ssl_identity_unittest.cc index a907bfc3ed..a8be7963b5 100644 --- a/rtc_base/ssl_identity_unittest.cc +++ b/rtc_base/ssl_identity_unittest.cc @@ -298,7 +298,7 @@ class SSLIdentityTest : public ::testing::Test { } void TestCloningIdentity(const SSLIdentity& identity) { - // Convert |identity| to PEM strings and create a new identity by converting + // Convert `identity` to PEM strings and create a new identity by converting // back from the string format. std::string priv_pem = identity.PrivateKeyToPEMString(); std::string publ_pem = identity.PublicKeyToPEMString(); diff --git a/rtc_base/ssl_stream_adapter.h b/rtc_base/ssl_stream_adapter.h index 6a21c6bed4..dc8a8ca7dc 100644 --- a/rtc_base/ssl_stream_adapter.h +++ b/rtc_base/ssl_stream_adapter.h @@ -200,7 +200,7 @@ class SSLStreamAdapter : public StreamInterface, public sigslot::has_slots<> { // certificate, not just a CA. SSLStream makes a copy of the digest value. // // Returns true if successful. - // |error| is optional and provides more information about the failure. + // `error` is optional and provides more information about the failure. virtual bool SetPeerCertificateDigest( const std::string& digest_alg, const unsigned char* digest_val, diff --git a/rtc_base/ssl_stream_adapter_unittest.cc b/rtc_base/ssl_stream_adapter_unittest.cc index 1c6eee2802..f92958dd86 100644 --- a/rtc_base/ssl_stream_adapter_unittest.cc +++ b/rtc_base/ssl_stream_adapter_unittest.cc @@ -378,7 +378,7 @@ class SSLStreamAdapterTestBase : public ::testing::Test, virtual void CreateStreams() = 0; // Recreate the client/server identities with the specified validity period. - // |not_before| and |not_after| are offsets from the current time in number + // `not_before` and `not_after` are offsets from the current time in number // of seconds. void ResetIdentitiesWithValidity(int not_before, int not_after) { CreateStreams(); diff --git a/rtc_base/string_encode.cc b/rtc_base/string_encode.cc index 1570b9339d..91a66292f2 100644 --- a/rtc_base/string_encode.cc +++ b/rtc_base/string_encode.cc @@ -49,7 +49,7 @@ size_t hex_encode_output_length(size_t srclen, char delimiter) { } // hex_encode shows the hex representation of binary data in ascii, with -// |delimiter| between bytes, or none if |delimiter| == 0. +// `delimiter` between bytes, or none if `delimiter` == 0. void hex_encode_with_delimiter(char* buffer, const char* csource, size_t srclen, diff --git a/rtc_base/string_encode.h b/rtc_base/string_encode.h index c1401b9f52..7f3345bb5e 100644 --- a/rtc_base/string_encode.h +++ b/rtc_base/string_encode.h @@ -41,7 +41,7 @@ size_t hex_decode(char* buffer, // hex_decode, assuming that there is a delimiter between every byte // pair. -// |delimiter| == 0 means no delimiter +// `delimiter` == 0 means no delimiter // If the buffer is too short or the data is invalid, we return 0. size_t hex_decode_with_delimiter(char* buffer, size_t buflen, diff --git a/rtc_base/strings/string_builder.h b/rtc_base/strings/string_builder.h index e528cf2f0e..6fe478ce4c 100644 --- a/rtc_base/strings/string_builder.h +++ b/rtc_base/strings/string_builder.h @@ -25,7 +25,7 @@ namespace rtc { // when you might otherwise be tempted to use a stringstream (discouraged for // anything except logging). It uses a fixed-size buffer provided by the caller // and concatenates strings and numbers into it, allowing the results to be -// read via |str()|. +// read via `str()`. class SimpleStringBuilder { public: explicit SimpleStringBuilder(rtc::ArrayView buffer); @@ -45,12 +45,12 @@ class SimpleStringBuilder { SimpleStringBuilder& operator<<(double f); SimpleStringBuilder& operator<<(long double f); - // Returns a pointer to the built string. The name |str()| is borrowed for + // Returns a pointer to the built string. The name `str()` is borrowed for // compatibility reasons as we replace usage of stringstream throughout the // code base. const char* str() const { return buffer_.data(); } - // Returns the length of the string. The name |size()| is picked for STL + // Returns the length of the string. The name `size()` is picked for STL // compatibility reasons. size_t size() const { return size_; } diff --git a/rtc_base/synchronization/mutex_unittest.cc b/rtc_base/synchronization/mutex_unittest.cc index b8c45d0a8c..3021c5932f 100644 --- a/rtc_base/synchronization/mutex_unittest.cc +++ b/rtc_base/synchronization/mutex_unittest.cc @@ -113,7 +113,7 @@ class LockRunner : public rtc::MessageHandlerAutoCleanup { EXPECT_EQ(0, shared_value_); int old = shared_value_; - // Use a loop to increase the chance of race. If the |locker_| + // Use a loop to increase the chance of race. If the `locker_` // implementation is faulty, it would be improbable that the error slips // through. for (int i = 0; i < kOperationsToRun; ++i) { diff --git a/rtc_base/system/file_wrapper.h b/rtc_base/system/file_wrapper.h index 0b293d9a80..b55b0b9864 100644 --- a/rtc_base/system/file_wrapper.h +++ b/rtc_base/system/file_wrapper.h @@ -32,7 +32,7 @@ class FileWrapper final { public: // Opens a file, in read or write mode. Use the is_open() method on the // returned object to check if the open operation was successful. On failure, - // and if |error| is non-null, the system errno value is stored at |*error|. + // and if `error` is non-null, the system errno value is stored at |*error|. // The file is closed by the destructor. static FileWrapper OpenReadOnly(const char* file_name_utf8); static FileWrapper OpenReadOnly(const std::string& file_name_utf8); @@ -43,8 +43,8 @@ class FileWrapper final { FileWrapper() = default; - // Takes over ownership of |file|, closing it on destruction. Calling with - // null |file| is allowed, and results in a FileWrapper with is_open() false. + // Takes over ownership of `file`, closing it on destruction. Calling with + // null `file` is allowed, and results in a FileWrapper with is_open() false. explicit FileWrapper(FILE* file) : file_(file) {} ~FileWrapper() { Close(); } diff --git a/rtc_base/task_queue_for_test.h b/rtc_base/task_queue_for_test.h index dd5679bc99..97ca254d6e 100644 --- a/rtc_base/task_queue_for_test.h +++ b/rtc_base/task_queue_for_test.h @@ -49,7 +49,7 @@ class RTC_LOCKABLE TaskQueueForTest : public rtc::TaskQueue { // a task executes on the task queue. // This variant is specifically for posting custom QueuedTask derived // implementations that tests do not want to pass ownership of over to the - // task queue (i.e. the Run() method always returns |false|.). + // task queue (i.e. the Run() method always returns `false`.). template void SendTask(Closure* task) { RTC_CHECK(!IsCurrent()); diff --git a/rtc_base/task_queue_libevent.cc b/rtc_base/task_queue_libevent.cc index 909698611e..a8b0dbffef 100644 --- a/rtc_base/task_queue_libevent.cc +++ b/rtc_base/task_queue_libevent.cc @@ -281,7 +281,7 @@ void TaskQueueLibevent::OnWakeup(int socket, if (task->Run()) { task.reset(); } else { - // |false| means the task should *not* be deleted. + // `false` means the task should *not* be deleted. task.release(); } } diff --git a/rtc_base/task_queue_win.cc b/rtc_base/task_queue_win.cc index d797d478f4..da0535d5c5 100644 --- a/rtc_base/task_queue_win.cc +++ b/rtc_base/task_queue_win.cc @@ -102,13 +102,13 @@ class DelayedTaskInfo { private: int64_t due_time_ = 0; // Absolute timestamp in milliseconds. - // |task| needs to be mutable because std::priority_queue::top() returns + // `task` needs to be mutable because std::priority_queue::top() returns // a const reference and a key in an ordered queue must not be changed. // There are two basic workarounds, one using const_cast, which would also - // make the key (|due_time|), non-const and the other is to make the non-key - // (|task|), mutable. - // Because of this, the |task| variable is made private and can only be - // mutated by calling the |Run()| method. + // make the key (`due_time`), non-const and the other is to make the non-key + // (`task`), mutable. + // Because of this, the `task` variable is made private and can only be + // mutated by calling the `Run()` method. mutable std::unique_ptr task_; }; diff --git a/rtc_base/task_utils/pending_task_safety_flag.h b/rtc_base/task_utils/pending_task_safety_flag.h index fc1b5bd878..6446bfe55e 100644 --- a/rtc_base/task_utils/pending_task_safety_flag.h +++ b/rtc_base/task_utils/pending_task_safety_flag.h @@ -30,8 +30,8 @@ namespace webrtc { // Typical usage: // When posting a task, post a copy (capture by-value in a lambda) of the flag -// reference and before performing the work, check the |alive()| state. Abort if -// alive() returns |false|: +// reference and before performing the work, check the `alive()` state. Abort if +// alive() returns `false`: // // class ExampleClass { // .... diff --git a/rtc_base/task_utils/pending_task_safety_flag_unittest.cc b/rtc_base/task_utils/pending_task_safety_flag_unittest.cc index 07bbea296e..ec5f6a5931 100644 --- a/rtc_base/task_utils/pending_task_safety_flag_unittest.cc +++ b/rtc_base/task_utils/pending_task_safety_flag_unittest.cc @@ -31,7 +31,7 @@ using ::testing::Return; TEST(PendingTaskSafetyFlagTest, Basic) { rtc::scoped_refptr safety_flag; { - // Scope for the |owner| instance. + // Scope for the `owner` instance. class Owner { public: Owner() = default; @@ -44,7 +44,7 @@ TEST(PendingTaskSafetyFlagTest, Basic) { safety_flag = owner.flag_; EXPECT_TRUE(safety_flag->alive()); } - // |owner| now out of scope. + // `owner` now out of scope. EXPECT_FALSE(safety_flag->alive()); } @@ -57,7 +57,7 @@ TEST(PendingTaskSafetyFlagTest, BasicScoped) { safety_flag = owner.safety.flag(); EXPECT_TRUE(safety_flag->alive()); } - // |owner| now out of scope. + // `owner` now out of scope. EXPECT_FALSE(safety_flag->alive()); } @@ -142,7 +142,7 @@ TEST(PendingTaskSafetyFlagTest, PendingTaskDropped) { RTC_FROM_HERE); ASSERT_TRUE(owner); // Queue up a task on tq1 that will execute before the 'DoStuff' task - // can, and delete the |owner| before the 'stuff' task can execute. + // can, and delete the `owner` before the 'stuff' task can execute. rtc::Event blocker; tq1.PostTask([&blocker, &owner]() { blocker.Wait(rtc::Event::kForever); diff --git a/rtc_base/task_utils/to_queued_task_unittest.cc b/rtc_base/task_utils/to_queued_task_unittest.cc index 261b9e891b..852307ab9d 100644 --- a/rtc_base/task_utils/to_queued_task_unittest.cc +++ b/rtc_base/task_utils/to_queued_task_unittest.cc @@ -131,7 +131,7 @@ TEST(ToQueuedTaskTest, PendingTaskSafetyFlag) { PendingTaskSafetyFlag::Create(); int count = 0; - // Create two identical tasks that increment the |count|. + // Create two identical tasks that increment the `count`. auto task1 = ToQueuedTask(flag, [&count]() { ++count; }); auto task2 = ToQueuedTask(flag, [&count]() { ++count; }); diff --git a/rtc_base/third_party/base64/base64.h b/rtc_base/third_party/base64/base64.h index 7a936f23e7..ca249541d0 100644 --- a/rtc_base/third_party/base64/base64.h +++ b/rtc_base/third_party/base64/base64.h @@ -46,11 +46,11 @@ class Base64 { static bool IsBase64Char(char ch); - // Get the char next to the |ch| from the Base64Table. - // If the |ch| is the last one in the Base64Table then returns + // Get the char next to the `ch` from the Base64Table. + // If the `ch` is the last one in the Base64Table then returns // the first one from the table. - // Expects the |ch| be a base64 char. - // The result will be saved in |next_ch|. + // Expects the `ch` be a base64 char. + // The result will be saved in `next_ch`. // Returns true on success. static bool GetNextBase64Char(char ch, char* next_ch); diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc index c3a83af442..cadf6ad62e 100644 --- a/rtc_base/thread.cc +++ b/rtc_base/thread.cc @@ -1080,7 +1080,7 @@ uint32_t Thread::GetCouldBeBlockingCallCount() const { #endif // Returns true if no policies added or if there is at least one policy -// that permits invocation to |target| thread. +// that permits invocation to `target` thread. bool Thread::IsInvokeToThreadAllowed(rtc::Thread* target) { #if (!defined(NDEBUG) || defined(RTC_DCHECK_ALWAYS_ON)) RTC_DCHECK_RUN_ON(this); diff --git a/rtc_base/thread.h b/rtc_base/thread.h index cb5a0e9cd0..d950b06c41 100644 --- a/rtc_base/thread.h +++ b/rtc_base/thread.h @@ -141,8 +141,8 @@ class RTC_EXPORT ThreadManager { bool IsMainThread(); #if RTC_DCHECK_IS_ON - // Registers that a Send operation is to be performed between |source| and - // |target|, while checking that this does not cause a send cycle that could + // Registers that a Send operation is to be performed between `source` and + // `target`, while checking that this does not cause a send cycle that could // potentially cause a deadlock. void RegisterSendAndCheckForCycles(Thread* source, Thread* target); #endif @@ -204,7 +204,7 @@ class RTC_LOCKABLE RTC_EXPORT Thread : public webrtc::TaskQueueBase { explicit Thread(std::unique_ptr ss); // Constructors meant for subclasses; they should call DoInit themselves and - // pass false for |do_init|, so that DoInit is called only on the fully + // pass false for `do_init`, so that DoInit is called only on the fully // instantiated class, which avoids a vptr data race. Thread(SocketServer* ss, bool do_init); Thread(std::unique_ptr ss, bool do_init); @@ -298,7 +298,7 @@ class RTC_LOCKABLE RTC_EXPORT Thread : public webrtc::TaskQueueBase { int cmsWait = kForever, bool process_io = true); virtual bool Peek(Message* pmsg, int cmsWait = 0); - // |time_sensitive| is deprecated and should always be false. + // `time_sensitive` is deprecated and should always be false. virtual void Post(const Location& posted_from, MessageHandler* phandler, uint32_t id = 0, @@ -344,7 +344,7 @@ class RTC_LOCKABLE RTC_EXPORT Thread : public webrtc::TaskQueueBase { static bool SleepMs(int millis); // Sets the thread's name, for debugging. Must be called before Start(). - // If |obj| is non-null, its value is appended to |name|. + // If `obj` is non-null, its value is appended to `name`. const std::string& name() const { return name_; } bool SetName(const std::string& name, const void* obj); @@ -373,7 +373,7 @@ class RTC_LOCKABLE RTC_EXPORT Thread : public webrtc::TaskQueueBase { MessageData* pdata = nullptr); // Convenience method to invoke a functor on another thread. Caller must - // provide the |ReturnT| template argument, which cannot (easily) be deduced. + // provide the `ReturnT` template argument, which cannot (easily) be deduced. // Uses Send() internally, which blocks the current thread until execution // is complete. // Ex: bool result = thread.Invoke(RTC_FROM_HERE, @@ -398,7 +398,7 @@ class RTC_LOCKABLE RTC_EXPORT Thread : public webrtc::TaskQueueBase { InvokeInternal(posted_from, functor); } - // Allows invoke to specified |thread|. Thread never will be dereferenced and + // Allows invoke to specified `thread`. Thread never will be dereferenced and // will be used only for reference-based comparison, so instance can be safely // deleted. If NDEBUG is defined and RTC_DCHECK_ALWAYS_ON is undefined do // nothing. @@ -406,27 +406,27 @@ class RTC_LOCKABLE RTC_EXPORT Thread : public webrtc::TaskQueueBase { // If NDEBUG is defined and RTC_DCHECK_ALWAYS_ON is undefined do nothing. void DisallowAllInvokes(); - // Returns true if |target| was allowed by AllowInvokesToThread() or if no + // Returns true if `target` was allowed by AllowInvokesToThread() or if no // calls were made to AllowInvokesToThread and DisallowAllInvokes. Otherwise // returns false. // If NDEBUG is defined and RTC_DCHECK_ALWAYS_ON is undefined always returns // true. bool IsInvokeToThreadAllowed(rtc::Thread* target); - // Posts a task to invoke the functor on |this| thread asynchronously, i.e. - // without blocking the thread that invoked PostTask(). Ownership of |functor| - // is passed and (usually, see below) destroyed on |this| thread after it is + // Posts a task to invoke the functor on `this` thread asynchronously, i.e. + // without blocking the thread that invoked PostTask(). Ownership of `functor` + // is passed and (usually, see below) destroyed on `this` thread after it is // invoked. // Requirements of FunctorT: // - FunctorT is movable. // - FunctorT implements "T operator()()" or "T operator()() const" for some T - // (if T is not void, the return value is discarded on |this| thread). - // - FunctorT has a public destructor that can be invoked from |this| thread + // (if T is not void, the return value is discarded on `this` thread). + // - FunctorT has a public destructor that can be invoked from `this` thread // after operation() has been invoked. // - The functor must not cause the thread to quit before PostTask() is done. // // Destruction of the functor/task mimics what TaskQueue::PostTask does: If - // the task is run, it will be destroyed on |this| thread. However, if there + // the task is run, it will be destroyed on `this` thread. However, if there // are pending tasks by the time the Thread is destroyed, or a task is posted // to a thread that is quitting, the task is destroyed immediately, on the // calling thread. Destroying the Thread only blocks for any currently running @@ -612,7 +612,7 @@ class RTC_LOCKABLE RTC_EXPORT Thread : public webrtc::TaskQueueBase { // ThreadManager::Instance() cannot be used while ThreadManager is // being created. // The method tries to get synchronization rights of the thread on Windows if - // |need_synchronize_access| is true. + // `need_synchronize_access` is true. bool WrapCurrentWithThreadManager(ThreadManager* thread_manager, bool need_synchronize_access); @@ -651,7 +651,7 @@ class RTC_LOCKABLE RTC_EXPORT Thread : public webrtc::TaskQueueBase { // The SocketServer might not be owned by Thread. SocketServer* const ss_; - // Used if SocketServer ownership lies with |this|. + // Used if SocketServer ownership lies with `this`. std::unique_ptr own_ss_; std::string name_; diff --git a/rtc_base/thread_unittest.cc b/rtc_base/thread_unittest.cc index e603930564..86c14c8554 100644 --- a/rtc_base/thread_unittest.cc +++ b/rtc_base/thread_unittest.cc @@ -511,7 +511,7 @@ TEST(ThreadTest, ThreeThreadsInvoke) { thread->Invoke(RTC_FROM_HERE, [out] { Set(out); }); } - // Set |out| true and call InvokeSet on |thread|. + // Set `out` true and call InvokeSet on `thread`. static void SetAndInvokeSet(LockedBool* out, Thread* thread, LockedBool* out_inner) { @@ -519,8 +519,8 @@ TEST(ThreadTest, ThreeThreadsInvoke) { InvokeSet(thread, out_inner); } - // Asynchronously invoke SetAndInvokeSet on |thread1| and wait until - // |thread1| starts the call. + // Asynchronously invoke SetAndInvokeSet on `thread1` and wait until + // `thread1` starts the call. static void AsyncInvokeSetAndWait(DEPRECATED_AsyncInvoker* invoker, Thread* thread1, Thread* thread2, @@ -842,8 +842,8 @@ TEST_F(AsyncInvokeTest, KillInvokerDuringExecuteWithReentrantInvoke) { Thread::Current()->SleepMs(kWaitTimeout); invoker.AsyncInvoke(RTC_FROM_HERE, main, reentrant_functor); }; - // This queues a task on |thread| to sleep for |kWaitTimeout| then queue a - // task on |main|. But this second queued task should never run, since the + // This queues a task on `thread` to sleep for `kWaitTimeout` then queue a + // task on `main`. But this second queued task should never run, since the // destructor will be entered before it's even invoked. invoker.AsyncInvoke(RTC_FROM_HERE, &thread, functor); functor_started.Wait(Event::kForever); diff --git a/rtc_base/time_utils.cc b/rtc_base/time_utils.cc index fe63d3a8ed..96282f06cf 100644 --- a/rtc_base/time_utils.cc +++ b/rtc_base/time_utils.cc @@ -232,11 +232,11 @@ int64_t TmToSeconds(const tm& tm) { // We will have added one day too much above if expiration is during a leap // year, and expiration is in January or February. - if (expiry_in_leap_year && month <= 2 - 1) // |month| is zero based. + if (expiry_in_leap_year && month <= 2 - 1) // `month` is zero based. day -= 1; - // Combine all variables into seconds from 1970-01-01 00:00 (except |month| - // which was accumulated into |day| above). + // Combine all variables into seconds from 1970-01-01 00:00 (except `month` + // which was accumulated into `day` above). return (((static_cast(year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + diff --git a/rtc_base/timestamp_aligner.cc b/rtc_base/timestamp_aligner.cc index c9f8f9de33..34b68bf39e 100644 --- a/rtc_base/timestamp_aligner.cc +++ b/rtc_base/timestamp_aligner.cc @@ -88,7 +88,7 @@ int64_t TimestampAligner::UpdateOffset(int64_t capturer_time_us, // offset, the filter is reset. This could happen, e.g., if the // capturer's clock is reset, cameras are plugged in and out, or // the application process is temporarily suspended. Expected to - // happen for the very first timestamp (|frames_seen_| = 0). The + // happen for the very first timestamp (`frames_seen_` = 0). The // threshold of 300 ms should make this unlikely in normal // operation, and at the same time, converging gradually rather than // resetting the filter should be tolerable for jumps in capturer's time @@ -124,10 +124,10 @@ int64_t TimestampAligner::ClipTimestamp(int64_t filtered_time_us, time_us = prev_translated_time_us_ + kMinFrameIntervalUs; if (time_us > system_time_us) { // In the anomalous case that this function is called with values of - // |system_time_us| less than |kMinFrameIntervalUs| apart, we may output + // `system_time_us` less than `kMinFrameIntervalUs` apart, we may output // timestamps with with too short inter-frame interval. We may even return // duplicate timestamps in case this function is called several times with - // exactly the same |system_time_us|. + // exactly the same `system_time_us`. RTC_LOG(LS_WARNING) << "too short translated timestamp interval: " "system time (us) = " << system_time_us << ", interval (us) = " diff --git a/rtc_base/timestamp_aligner.h b/rtc_base/timestamp_aligner.h index da45aa6d1f..73af9debf9 100644 --- a/rtc_base/timestamp_aligner.h +++ b/rtc_base/timestamp_aligner.h @@ -37,8 +37,8 @@ class RTC_EXPORT TimestampAligner { public: // Translates timestamps of a capture system to the same timescale as is used - // by rtc::TimeMicros(). |capturer_time_us| is assumed to be accurate, but - // with an unknown epoch and clock drift. |system_time_us| is + // by rtc::TimeMicros(). `capturer_time_us` is assumed to be accurate, but + // with an unknown epoch and clock drift. `system_time_us` is // time according to rtc::TimeMicros(), preferably read as soon as // possible when the frame is captured. It may have poor accuracy // due to poor resolution or scheduling delays. Returns the @@ -56,9 +56,9 @@ class RTC_EXPORT TimestampAligner { int64_t UpdateOffset(int64_t capturer_time_us, int64_t system_time_us); // Clip timestamp, return value is always - // <= |system_time_us|, and - // >= min(|prev_translated_time_us_| + |kMinFrameIntervalUs|, - // |system_time_us|). + // <= `system_time_us`, and + // >= min(`prev_translated_time_us_` + `kMinFrameIntervalUs`, + // `system_time_us`). int64_t ClipTimestamp(int64_t filtered_time_us, int64_t system_time_us); private: @@ -69,12 +69,12 @@ class RTC_EXPORT TimestampAligner { // State for the ClipTimestamp method, applied after the filter. // A large negative clock drift of the capturer tends to push translated - // timestamps into the future. |clip_bias_us_| is subtracted from the + // timestamps into the future. `clip_bias_us_` is subtracted from the // translated timestamps, to get them back from the future. int64_t clip_bias_us_; // Used to ensure that translated timestamps are monotonous. int64_t prev_translated_time_us_; - // Offset between |prev_translated_time_us_| and the corresponding capturer + // Offset between `prev_translated_time_us_` and the corresponding capturer // time. int64_t prev_time_offset_us_; RTC_DISALLOW_COPY_AND_ASSIGN(TimestampAligner); diff --git a/rtc_base/timestamp_aligner_unittest.cc b/rtc_base/timestamp_aligner_unittest.cc index df6207a22c..0a050ffd7f 100644 --- a/rtc_base/timestamp_aligner_unittest.cc +++ b/rtc_base/timestamp_aligner_unittest.cc @@ -23,8 +23,8 @@ namespace rtc { namespace { // Computes the difference x_k - mean(x), when x_k is the linear sequence x_k = -// k, and the "mean" is plain mean for the first |window_size| samples, followed -// by exponential averaging with weight 1 / |window_size| for each new sample. +// k, and the "mean" is plain mean for the first `window_size` samples, followed +// by exponential averaging with weight 1 / `window_size` for each new sample. // This is needed to predict the effect of camera clock drift on the timestamp // translation. See the comment on TimestampAligner::UpdateOffset for more // context. @@ -160,7 +160,7 @@ TEST(TimestampAlignerTest, ClipToMonotonous) { // translated timestamps in the future. Which is tolerated if // |timestamp_aligner.clip_bias_us| is large enough. Instead of // changing that private member for this test, just add the bias to - // |kSystemTimeUs| when calling ClipTimestamp. + // `kSystemTimeUs` when calling ClipTimestamp. const int64_t kClipBiasUs = 100000; bool did_clip = false; diff --git a/rtc_base/trace_event.h b/rtc_base/trace_event.h index a0b788fbf9..e9a5c4c6f2 100644 --- a/rtc_base/trace_event.h +++ b/rtc_base/trace_event.h @@ -136,10 +136,10 @@ // TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD! // free(str); // Trace system now has dangling pointer // -// To avoid this issue with the |name| and |arg_name| parameters, use the +// To avoid this issue with the `name` and `arg_name` parameters, use the // TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime overhead. // Notes: The category must always be in a long-lived char* (i.e. static const). -// The |arg_values|, when used, are always deep copied with the _COPY +// The `arg_values`, when used, are always deep copied with the _COPY // macros. // // When are string argument values copied: @@ -303,7 +303,7 @@ // must be representable as a 32 bit integer. // - category and name strings must have application lifetime (statics or // literals). They may not include " chars. -// - |id| is used to disambiguate counters with the same name. It must either +// - `id` is used to disambiguate counters with the same name. It must either // be a pointer or an integer value up to 64 bits. If it's a pointer, the bits // will be xored with a hash of the process ID so that the same pointer on // two different processes will not collide. @@ -321,7 +321,7 @@ // values as a stacked-bar chart. // - category and name strings must have application lifetime (statics or // literals). They may not include " chars. -// - |id| is used to disambiguate counters with the same name. It must either +// - `id` is used to disambiguate counters with the same name. It must either // be a pointer or an integer value up to 64 bits. If it's a pointer, the bits // will be xored with a hash of the process ID so that the same pointer on // two different processes will not collide. @@ -344,9 +344,9 @@ // does nothing. // - category and name strings must have application lifetime (statics or // literals). They may not include " chars. -// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC +// - `id` is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC // events are considered to match if their category, name and id values all -// match. |id| must either be a pointer or an integer value up to 64 bits. If +// match. `id` must either be a pointer or an integer value up to 64 bits. If // it's a pointer, the bits will be xored with a hash of the process ID so // that the same pointer on two different processes will not collide. // An asynchronous operation can consist of multiple phases. The first phase is @@ -354,7 +354,7 @@ // ASYNC_STEP macros. When the operation completes, call ASYNC_END. // An ASYNC trace typically occur on a single thread (if not, they will only be // drawn on the thread defined in the ASYNC_BEGIN event), but all events in that -// operation must use the same |name| and |id|. Each event can have its own +// operation must use the same `name` and `id`. Each event can have its own // args. #define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ @@ -380,9 +380,9 @@ category, name, id, TRACE_EVENT_FLAG_COPY, \ arg1_name, arg1_val, arg2_name, arg2_val) -// Records a single ASYNC_STEP event for |step| immediately. If the category -// is not enabled, then this does nothing. The |name| and |id| must match the -// ASYNC_BEGIN event above. The |step| param identifies this step within the +// Records a single ASYNC_STEP event for `step` immediately. If the category +// is not enabled, then this does nothing. The `name` and `id` must match the +// ASYNC_BEGIN event above. The `step` param identifies this step within the // async event. This should be called at the beginning of the next phase of an // asynchronous operation. #define TRACE_EVENT_ASYNC_STEP0(category, name, id, step) \ @@ -434,9 +434,9 @@ // does nothing. // - category and name strings must have application lifetime (statics or // literals). They may not include " chars. -// - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW +// - `id` is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW // events are considered to match if their category, name and id values all -// match. |id| must either be a pointer or an integer value up to 64 bits. If +// match. `id` must either be a pointer or an integer value up to 64 bits. If // it's a pointer, the bits will be xored with a hash of the process ID so // that the same pointer on two different processes will not collide. // FLOW events are different from ASYNC events in how they are drawn by the @@ -447,7 +447,7 @@ // by the FLOW_BEGIN calls. Additional phases can be defined using the FLOW_STEP // macros. When the operation completes, call FLOW_END. An async operation can // span threads and processes, but all events in that operation must use the -// same |name| and |id|. Each event can have its own args. +// same `name` and `id`. Each event can have its own args. #define TRACE_EVENT_FLOW_BEGIN0(category, name, id) \ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ category, name, id, TRACE_EVENT_FLAG_NONE) @@ -472,9 +472,9 @@ category, name, id, TRACE_EVENT_FLAG_COPY, \ arg1_name, arg1_val, arg2_name, arg2_val) -// Records a single FLOW_STEP event for |step| immediately. If the category -// is not enabled, then this does nothing. The |name| and |id| must match the -// FLOW_BEGIN event above. The |step| param identifies this step within the +// Records a single FLOW_STEP event for `step` immediately. If the category +// is not enabled, then this does nothing. The `name` and `id` must match the +// FLOW_BEGIN event above. The `step` param identifies this step within the // async event. This should be called at the beginning of the next phase of an // asynchronous operation. #define TRACE_EVENT_FLOW_STEP0(category, name, id, step) \ @@ -1019,4 +1019,4 @@ class TraceEndOnScopeClose { #endif // RTC_TRACE_EVENTS_ENABLED -#endif // RTC_BASE_TRACE_EVENT_H_ \ No newline at end of file +#endif // RTC_BASE_TRACE_EVENT_H_ diff --git a/rtc_base/unique_id_generator.h b/rtc_base/unique_id_generator.h index 22398fd3f2..3e2f9d7072 100644 --- a/rtc_base/unique_id_generator.h +++ b/rtc_base/unique_id_generator.h @@ -41,7 +41,7 @@ class UniqueNumberGenerator { // Generates a number that this generator has never produced before. // If there are no available numbers to generate, this method will fail - // with an |RTC_CHECK|. + // with an `RTC_CHECK`. TIntegral GenerateNumber(); TIntegral operator()() { return GenerateNumber(); } diff --git a/rtc_base/virtual_socket_server.cc b/rtc_base/virtual_socket_server.cc index f5e993645e..77d61742ac 100644 --- a/rtc_base/virtual_socket_server.cc +++ b/rtc_base/virtual_socket_server.cc @@ -631,7 +631,7 @@ bool VirtualSocketServer::Wait(int cmsWait, bool process_io) { if (stop_on_idle_ && Thread::Current()->empty()) { return false; } - // Note: we don't need to do anything with |process_io| since we don't have + // Note: we don't need to do anything with `process_io` since we don't have // any real I/O. Received packets come in the form of queued messages, so // Thread will ensure WakeUp is called if another thread sends a // packet. @@ -713,7 +713,7 @@ int VirtualSocketServer::Bind(VirtualSocket* socket, SocketAddress* addr) { RTC_NOTREACHED(); } - // If the IP appears in |alternative_address_mapping_|, meaning the test has + // If the IP appears in `alternative_address_mapping_`, meaning the test has // configured sockets bound to this IP to actually use another IP, replace // the IP here. auto alternative = alternative_address_mapping_.find(addr->ipaddr()); diff --git a/rtc_base/virtual_socket_server.h b/rtc_base/virtual_socket_server.h index 6c58a4bdfe..af86991ed4 100644 --- a/rtc_base/virtual_socket_server.h +++ b/rtc_base/virtual_socket_server.h @@ -104,10 +104,10 @@ class VirtualSocketServer : public SocketServer { size_t largest_seen_udp_payload() { return largest_seen_udp_payload_; } - // If |blocked| is true, subsequent attempts to send will result in -1 being + // If `blocked` is true, subsequent attempts to send will result in -1 being // returned, with the socket error set to EWOULDBLOCK. // - // If this method is later called with |blocked| set to false, any sockets + // If this method is later called with `blocked` set to false, any sockets // that previously failed to send with EWOULDBLOCK will emit SignalWriteEvent. // // This can be used to simulate the send buffer on a network interface being diff --git a/rtc_base/win/windows_version.cc b/rtc_base/win/windows_version.cc index 42148adeea..dab61ae897 100644 --- a/rtc_base/win/windows_version.cc +++ b/rtc_base/win/windows_version.cc @@ -99,7 +99,7 @@ class RegKey { } } - // Reads a REG_DWORD (uint32_t) into |out_value|. If |name| is null or empty, + // Reads a REG_DWORD (uint32_t) into `out_value`. If `name` is null or empty, // reads the key's default value, if any. LONG ReadValueDW(const wchar_t* name, DWORD* out_value) const { RTC_DCHECK(out_value); @@ -117,7 +117,7 @@ class RegKey { return result; } - // Reads a string into |out_value|. If |name| is null or empty, reads + // Reads a string into `out_value`. If `name` is null or empty, reads // the key's default value, if any. LONG ReadValue(const wchar_t* name, std::wstring* out_value) const { RTC_DCHECK(out_value); diff --git a/rtc_base/win32.cc b/rtc_base/win32.cc index 1a99c4f199..8d8fe27369 100644 --- a/rtc_base/win32.cc +++ b/rtc_base/win32.cc @@ -154,7 +154,7 @@ const char* inet_ntop_v6(const void* src, char* dst, socklen_t size) { } // Helper function for inet_pton for IPv4 addresses. -// |src| points to a character string containing an IPv4 network address in +// `src` points to a character string containing an IPv4 network address in // dotted-decimal format, "ddd.ddd.ddd.ddd", where ddd is a decimal number // of up to three digits in the range 0 to 255. // The address is converted and copied to dst,