CFStringFromCString is useful, however if we have a static C string, we can use the defined macro CFSTR to create a CFString at runtime instead.
Bug: None
Change-Id: I54b3f590b3ab07858409af27b817013c98556ded
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/293060
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Seija K. <doremylover123@gmail.com>
Cr-Commit-Position: refs/heads/main@{#39341}
The goal of this CL is to create a new LogSink::OnLogMessage API which
propagates the source location of the log to the log sinks.
Bug: b/238157120
Change-Id: I5a12bf80fd9c5569ed7aa1ef9185eee58830b19f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269249
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37672}
This ctor has been deprecated for a while and it should be unused
by WebRTC clients.
Bug: None
Change-Id: I7d33ae24eefafe48924011f55fb53150b717d593
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269180
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37584}
This is part of a large scale effort to increase adoption of
absl::string_view across the WebRTC code base.
This CL adds absl::string_view versions of the OnLogMessage functions in
rtc::LogSink. The const std::string& versions are kept for now since
downstream clients use subclasses of LogSink and need to be migrated
before these are removed.
Bug: webrtc:13579
Change-Id: I57bb72ad503805ff0ca16f1d7aece2d44c65cb73
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/253980
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Xavier Lepaul <xalep@webrtc.org>
Owners-Override: Xavier Lepaul <xalep@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36189}
In logging.cc, use the pointer of the static variable so that
it doesn't need a global constructor/exit time destructor.
In RTCFieldTrials.mm, store the field trial string as a char pointer
instead of a std::unique_ptr to ensure that it is never freed.
LSAN will be unhappy with this fix, but WebRTC itself hasn't been
tested with LSAN enabled, and any code changed in this CL does not
build with build_with_chromium=true, so it shouldn't be a problem.
Bug: webrtc:9693, webrtc:11665
Change-Id: Ia28e3534170e0817b815717f6efe862f7b51ef62
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237320
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Byoungchan Lee <daniel.l@hpcnt.com>
Cr-Commit-Position: refs/heads/main@{#35391}
Add implementation of RTC_DCHECK_NOTREACHED equal to the RTC_NOTREACHED.
The new macros will replace the old one when old one's usage will be
removed. The idea of the renaming to provide a clear signal that this
is debug build only macros and will be stripped in the production build.
Bug: webrtc:9065
Change-Id: I4c35d8b03e74a4b3fd1ae75dba2f9c05643101db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237802
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35348}
This change introduces a race-checking mutex implementation useful
for downstream consumers that can guarantee that they invoke
WebRTC serially.
Fixed: webrtc:11787
Change-Id: I7cb74e2e88dc87b751130504c267ac20ee8df4ba
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179284
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33769}
This does mean that each call site becomes slightly more expensive
in terms of binary size, but until we have a better way to mitigate
the perf impact, I think we'll have to live with it.
We could also consider migrating LS_VERBOSE over to RTC_DLOG.
Bug: webrtc:11968
Change-Id: Ib16f1109366ffaa88b8df28ebfa5bc3b539f691f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184922
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32153}
Single use replaced with snprintf (old code also uses snprintf, but
twice, via rtc::ToString).
Bug: webrtc:6424
Change-Id: Iedb30aacb351428974067141e166cbc53fdda180
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184365
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32127}
This reverts commit I5b9d9036aa90eb0c652f6b17ea1162dea0362640
using spin lock (Global lock) for highly used lock may cause deadlock on ios
Bug: None
Change-Id: Ia7594d665bc17717299245b1a6cfcff18f273e77
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160200
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29857}
LogMessage::streams_ is a global and thus should have trivial destructor
Bug: None
Change-Id: Ie6a8029602f50b2bc5bab546ffc0365ef0954024
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157042
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29552}
rtc::CriticalSection has non-trivial destructor and thus
shouldn't be used for variable with static storage duration
Bug: None
Change-Id: I5b9d9036aa90eb0c652f6b17ea1162dea0362640
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156563
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29469}
Windows UWP allows an application to be built that targets
across all Windows 10 based systems and the Windows store.
Change-Id: I69694bb7e83fb01ad6db2438b065b55738cf01fd
Bug: webrtc:10046
Reviewed-on: https://webrtc-review.googlesource.com/c/110570
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25814}
This CL is the result of running include-what-you-use tool on part
of the code base (audio target and dependencies) plus manual fixes.
bug: webrtc:8311
Change-Id: I277d281ce943c3ecc1bd45fd8d83055931743604
Reviewed-on: https://webrtc-review.googlesource.com/c/106280
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25311}
Currently we check if a message should be printed at the call site using LogMessage::Loggable, in the LogMessage itself using LogMessage::IsNoop and in LogMessage::OutputToDebug using log_to_stderr_.
This change unifies the first two of these into a early return in Log().
Bug: webrtc:8982
Change-Id: I462b1cf63c44fec46e5c59b147b2b99605aaae0c
Reviewed-on: https://webrtc-review.googlesource.com/98820
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24630}
This reverts commit 4092cd6db4.
Reason for revert: Some g3 things depend on log macro implementation details.
Original change's description:
> Consolidate loggability checks and replace streams.
>
> Currently we check if a message should be printed at the call site using LogMessage::Loggable, in the LogMessage itself using LogMessage::IsNoop and in LogMessage::OutputToDebug using log_to_stderr_.
>
> This change unifies the first two of these into a early return in Log().
>
> Bug: webrtc:8982
> Change-Id: Ia4e3e12b34716d76c05807e44db1ed4a62dffb87
> Reviewed-on: https://webrtc-review.googlesource.com/97440
> Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#24547}
TBR=kwiberg@webrtc.org,jonasolsson@webrtc.org
Change-Id: I06f0a5b50c96c08a5e7be4d8d2bcb22d50c0179f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8982
Reviewed-on: https://webrtc-review.googlesource.com/97720
Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24553}
Currently we check if a message should be printed at the call site using LogMessage::Loggable, in the LogMessage itself using LogMessage::IsNoop and in LogMessage::OutputToDebug using log_to_stderr_.
This change unifies the first two of these into a early return in Log().
Bug: webrtc:8982
Change-Id: Ia4e3e12b34716d76c05807e44db1ed4a62dffb87
Reviewed-on: https://webrtc-review.googlesource.com/97440
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24547}
The macro WIN32_LEAN_AND_MEAN is always defined by the toolchain, see
the config //build/config/win:lean_and_mean [1].
This means that WebRTC should not define it in its source files, this
causes two problems:
1. rtc_base:rtc_base_generinc needs to use /wd4005 to avoid a compiler
warning (because the macro is redefined without checking).
2. the macro is not consistently defined before including windows.h,
which means that WebRTC already relies on the toolchain almost
everywhere.
[1] - https://cs.chromium.org/chromium/src/build/config/win/BUILD.gn?l=514&rcl=54f7be95955c9b35e64569c1d40e0c3dd097359c
Bug: webrtc:9251
Change-Id: I2b0b3c16856023db2a38a38f7652bb849ff283c7
Reviewed-on: https://webrtc-review.googlesource.com/87582
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23889}
This fixes a bug where tags are not saved by FileRotatingLogSink.
It is also a preparation step for injectable logging.
Bug: webrtc:9225
Change-Id: I06ae0810073492bd2f103fefd64bd3cd02659fbc
Reviewed-on: https://webrtc-review.googlesource.com/84361
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23695}
Running clang-format with chromium's style guide.
The goal is n-fold:
* providing consistency and readability (that's what code guidelines are for)
* preventing noise with presubmit checks and git cl format
* building on the previous point: making it easier to automatically fix format issues
* you name it
Please consider using git-hyper-blame to ignore this commit.
Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
This reverts commit 21219a0e43.
Reason for revert: No tags are written when routing logs to a file - b/86953692
Original change's description:
> Reland "Injectable logging"
>
> Any injected loggable or NativeLogger would be deleted if PCFactory
> was reinitialized without calling setInjectableLogger. Now native
> logging is not implemented as a Loggable, so it will remain active
> unless a Loggable is injected.
>
> This is a reland of 59216ec4a4
>
> Original change's description:
> > Injectable logging
> >
> > Allows passing a Loggable to PCFactory.initializationOptions, which
> > is then injected to Logging.java and logging.h. Future log messages
> > in both Java and native will then be passed to this Loggable.
> >
> > Bug: webrtc:9225
> > Change-Id: I2ff693380639448301a78a93dc11d3a0106f0967
> > Reviewed-on: https://webrtc-review.googlesource.com/73243
> > Commit-Queue: Paulina Hensman <phensman@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#23241}
>
> Bug: webrtc:9225
> Change-Id: I2fe3fbc8c323814284bb62e43fe1870bdab581ee
> TBR: kwiberg
> Reviewed-on: https://webrtc-review.googlesource.com/77140
> Commit-Queue: Paulina Hensman <phensman@webrtc.org>
> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#23310}
TBR=magjed@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,phensman@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:9225
Change-Id: I4d0a5990b5f742cc1a96afde3ca97fad9143d2d4
Reviewed-on: https://webrtc-review.googlesource.com/80641
Reviewed-by: Alex Glaznev <glaznev@webrtc.org>
Commit-Queue: Alex Glaznev <glaznev@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23498}
Instead of making multiple calls to the std::stringstream << operator,
collect all the arguments and make a single printf-like variadic call
under the hood.
Besides reducing our reliance on iostreams, this makes each RTC_LOG_*
call site smaller; in aggregate, this reduces the size of
libjingle_peerconnection_so.so by 28-32 kB.
A quick benchmark indicates that this change makes log statements
a few percent slower.
Bug: webrtc:8982, webrtc:9185
Change-Id: I3137a4dd8ac510e8d910acccb0c97ce4fffb61c9
Reviewed-on: https://webrtc-review.googlesource.com/75440
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23375}
Any injected loggable or NativeLogger would be deleted if PCFactory
was reinitialized without calling setInjectableLogger. Now native
logging is not implemented as a Loggable, so it will remain active
unless a Loggable is injected.
This is a reland of 59216ec4a4
Original change's description:
> Injectable logging
>
> Allows passing a Loggable to PCFactory.initializationOptions, which
> is then injected to Logging.java and logging.h. Future log messages
> in both Java and native will then be passed to this Loggable.
>
> Bug: webrtc:9225
> Change-Id: I2ff693380639448301a78a93dc11d3a0106f0967
> Reviewed-on: https://webrtc-review.googlesource.com/73243
> Commit-Queue: Paulina Hensman <phensman@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#23241}
Bug: webrtc:9225
Change-Id: I2fe3fbc8c323814284bb62e43fe1870bdab581ee
TBR: kwiberg
Reviewed-on: https://webrtc-review.googlesource.com/77140
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23310}
This reverts commit 59216ec4a4.
Reason for revert: forces all logs to have identical tag
Original change's description:
> Injectable logging
>
> Allows passing a Loggable to PCFactory.initializationOptions, which
> is then injected to Logging.java and logging.h. Future log messages
> in both Java and native will then be passed to this Loggable.
>
> Bug: webrtc:9225
> Change-Id: I2ff693380639448301a78a93dc11d3a0106f0967
> Reviewed-on: https://webrtc-review.googlesource.com/73243
> Commit-Queue: Paulina Hensman <phensman@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#23241}
TBR=magjed@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,phensman@webrtc.org
Change-Id: I27c9587238325b69b26166434740869021b7db8a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9225
Reviewed-on: https://webrtc-review.googlesource.com/76885
Reviewed-by: Alex Glaznev <glaznev@webrtc.org>
Commit-Queue: Alex Glaznev <glaznev@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23253}
Allows passing a Loggable to PCFactory.initializationOptions, which
is then injected to Logging.java and logging.h. Future log messages
in both Java and native will then be passed to this Loggable.
Bug: webrtc:9225
Change-Id: I2ff693380639448301a78a93dc11d3a0106f0967
Reviewed-on: https://webrtc-review.googlesource.com/73243
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23241}
Default argument values are taken care of at the call site. If we
switch to a separate overload, all of those call sites won't have to
pass the default values, saving a few instructions each time.
In aggregate, this reduces the size of libjingle_peerconnection_so.so
by 12 kB.
Bug: webrtc:9185
Change-Id: I8c792c7c6e5b230376dd129d16d9ed2541444d88
Reviewed-on: https://webrtc-review.googlesource.com/74440
Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23112}
So that future CLs can de-inline its methods.
We do this by asking the caller to allocate the buffer instead of
having it as a data member.
Bug: webrtc:8982
Change-Id: I246b0973e54510fdd880c3b6875336c31334d008
Reviewed-on: https://webrtc-review.googlesource.com/60000
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22355}
This is a reland of 12dc1842d6.
Original change's description:
> Some cleanup for the logging code:
>
> * Only include 'tag' for Android. Before there was an
> extra std::string variable per log statement for all
> platforms.
> * Remove unused logging macro for Windows and 'module' ctor argument.
> * Move httpcommon code out of logging and to where it's used.
>
> Change-Id: I347805d3df2cee2840c0d2eef5bfefaff1cdbf37
> Bug: webrtc:8928
> Reviewed-on: https://webrtc-review.googlesource.com/57183
> Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Commit-Queue: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22184}
Bug: webrtc:8928
Change-Id: Ib97895aaeb376e19f136d258c0259a340235a5d1
Reviewed-on: https://webrtc-review.googlesource.com/58200
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22208}