Commit graph

60 commits

Author SHA1 Message Date
Mirko Bonadei
f1df04b094 Fix -Wunreachable-code on Linux.
Starting from [1] the toolchain has started to enforce
-Wunreachable-code on Linux, this CL fixes the issues that are preventing
the Chromium roll into WebRTC.

Error example at [2].

[1] - https://chromium-review.googlesource.com/c/chromium/src/+/2093537
[2] - https://ci.chromium.org/p/webrtc/builders/try/linux_rel/34282?

Bug: webrtc:11448
Change-Id: I96e8901ae80c44d69143ed8d972e250b6b926a7d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171500
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30858}
2020-03-23 20:51:37 +00:00
Jiawei Ou
14e5f0b2cb Update RTC_CHECK and RTC_LOG macros so they work when called from xxxxx::rtc namespaces
Adding :: before rtc allow us to use the macro in nested rtc namespace for external components like

namespace xxxxxxx {
namespace rtc {
RTC_CHECK(true);
}
}

Bug: webrtc:11400
Change-Id: I79349b847c3fce8197c82aec31b672a1a16e5388
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169683
Commit-Queue: Jiawei Ou <ouj@fb.com>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30684}
2020-03-04 22:53:34 +00:00
Artem Titov
6a4a14635e Add ability to strip out logging messages from the binary
Bug: webrtc:11125
Change-Id: I6e1e96536502c6ae94b6061ea09951cdc2fd87ac
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160410
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29919}
2019-11-26 16:29:50 +00:00
Danil Chapovalov
b9f69028a0 Store logging streams in a manually linked list instead of std::list
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}
2019-10-21 09:02:52 +00:00
Jonas Olsson
a4d873786f Format almost everything.
This CL was generated by running

git ls-files | grep -P "(\.h|\.cc)$" | grep -v 'sdk/' | grep -v 'rtc_base/ssl_' | \
grep -v 'fake_rtc_certificate_generator.h' | grep -v 'modules/audio_device/win/' | \
grep -v 'system_wrappers/source/clock.cc' | grep -v 'rtc_base/trace_event.h' | \
grep -v 'modules/audio_coding/codecs/ilbc/' | grep -v 'screen_capturer_mac.h' | \
grep -v 'spl_inl_mips.h' | grep -v 'data_size_unittest.cc' | grep -v 'timestamp_unittest.cc' \
| xargs clang-format -i ; git cl format

Most of these changes are clang-format grouping and reordering includes
differently.

Bug: webrtc:9340
Change-Id: Ic83ddbc169bfacd21883e381b5181c3dd4fe8a63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144051
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28505}
2019-07-08 13:45:15 +00:00
Niels Möller
171bd2644d Delete unused MacOS code related to ERRCTX_OSSTATUS
Bug: webrtc:6424
Change-Id: I3f98d31677201fcc52e492a463945fb9f6f2e883
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138831
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28231}
2019-06-11 13:11:56 +00:00
Sebastian Jansson
f4e085a499 Using absl traits for checks and logging.
Bug: webrtc:9883
Change-Id: If4af810c1ba64c6c022c0fb5328a75527bec5934
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133622
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27993}
2019-05-20 18:39:12 +00:00
Sebastian Jansson
b113862ccd Allow log print of data units.
Bug: webrtc:9709
Change-Id: I5987a9779e645115dc1893944302a73d540bcf2f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/125680
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27578}
2019-04-12 07:36:49 +00:00
Amit Hilbuch
10c5a93eb7 Relanding #128202 Adding support for enum class in RTC_CHECK and RTC_LOG.
This is a reland of: https://webrtc-review.googlesource.com/c/src/+/128202
Logging unit test has been fixed to unregister the log listener.

Bug: webrtc:10418
Change-Id: Idac9cb71807e16a585ccb7e3e4271aa45d69f547
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128541
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27192}
2019-03-19 17:13:47 +00:00
Steve Anton
ae88f39801 Revert "Adding support for enum class in RTC_CHECK and RTC_LOG."
This reverts commit 6b6f537e83.

Reason for revert: AddressSanitizer: stack-use-after-return third_party/webrtc/files/stable/webrtc/rtc_base/logging.cc:214:17 in rtc::LogMessage::~LogMessage()

Original change's description:
> Adding support for enum class in RTC_CHECK and RTC_LOG.
> 
> Enum class types are by design not convertible to arithmetic types.
> As a result they are currently not supported in RTC_CHECK and RTC_LOG.
> The current workaround was to use something like RTC_CHECK(v1 == v2)
> instead of RTC_CHECK_EQ(v1, v2).
> This change adds support for any enum class type by converting it to the
> underlying type.
> 
> Bug: webrtc:10418
> Change-Id: I59e6608e6a97a4cc007c903f8e021a58d4c49ff8
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128202
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27166}

TBR=kwiberg@webrtc.org,amithi@webrtc.org

Change-Id: I515087dbbebd6bf8cbebd8f9944fd61a20f758db
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10418
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128540
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27168}
2019-03-18 19:22:10 +00:00
Amit Hilbuch
6b6f537e83 Adding support for enum class in RTC_CHECK and RTC_LOG.
Enum class types are by design not convertible to arithmetic types.
As a result they are currently not supported in RTC_CHECK and RTC_LOG.
The current workaround was to use something like RTC_CHECK(v1 == v2)
instead of RTC_CHECK_EQ(v1, v2).
This change adds support for any enum class type by converting it to the
underlying type.

Bug: webrtc:10418
Change-Id: I59e6608e6a97a4cc007c903f8e021a58d4c49ff8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128202
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27166}
2019-03-18 18:17:58 +00:00
Mirko Bonadei
dc71420e78 Remove deprecated code from logging.
Bug: webrtc:10198
Change-Id: I00c74751c5c71e515c3208a558677215ac547b78
Reviewed-on: https://webrtc-review.googlesource.com/c/116994
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26235}
2019-01-14 11:02:49 +00:00
Steve Anton
10542f21c8 (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries
Mechanically generated by running this command:

tools_webrtc/do-renames.sh update all-renames.txt && git cl format

Then manually updating:

tools_webrtc/sanitizers/tsan_suppressions_webrtc.cc

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I54824cd91dada8fc3ee3d098f971bc319d477833
Reviewed-on: https://webrtc-review.googlesource.com/c/115653
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26226}
2019-01-11 17:11:39 +00:00
Niels Möller
25aefd3584 Delete log severity LS_SENSITIVE
Bug: webrtc:10026
Change-Id: Ic23cd6fe6df047fd0498cb0699176b447f1d7bc6
Reviewed-on: https://webrtc-review.googlesource.com/c/111581
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26011}
2018-12-14 08:54:28 +00:00
Jonas Olsson
388e4e9d96 Make RTC_LOG_FILE_LINE use its parameters
Our macros always pass __FILE__ and __LINE__ as parameters, so the impact was limited. However, doing the correct thing is obviously preferable to doing the wrong thing, so let's fix it.

Bug: webrtc:10003
Change-Id: Id2529c4bd8c7e90a8f0ac3ffa713dbe305ba66d8
Reviewed-on: https://webrtc-review.googlesource.com/c/111244
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25712}
2018-11-20 13:19:18 +00:00
Jiawei Ou
3ea187803b Add severity into RTC logging callbacks
Bug: webrtc:9945
Change-Id: I5022f63103503d2213492d3cd1a6953fe658fda7
Reviewed-on: https://webrtc-review.googlesource.com/c/108981
Commit-Queue: Jiawei Ou <ouj@fb.com>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25510}
2018-11-06 07:53:01 +00:00
Mirko Bonadei
99a70a2d78 Remove rtc_base_approved_objc and introduce rtc_base:logging_mac.
This CL removes the need of having rtc_base:rtc_base_approved_generic
and rtc_base:rtc_base_approved_objc since it removes the _objc build
target by moving the declaration of rtc::DescriptionFromOSStatus into
rtc_base/logging_mac.h in order to have a new target
rtc_base:logging_mac on which rtc_base:logging can depend on.

The target rtc_base:rtc_base_approved_generic will be removed in a
follow up CL.

Bug: webrtc:9838
Change-Id: Id93ac7bced213128e7d654694ff15337c26dab62
Reviewed-on: https://webrtc-review.googlesource.com/c/104802
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25085}
2018-10-10 09:43:46 +00:00
Yves Gerey
2e00abc98e Reland "[cleanup] Remove useless includes."
Reason for reland: Downstream project fixed.

Original change's description:

> [cleanup] Remove useless includes.
>
> Manual cleanup guided by include-what-you-use diagnostic.
>
> Bug: webrtc:8311
> Change-Id: I00be03392cc7ee005101427ea7dc701621ccea68
> Reviewed-on: https://webrtc-review.googlesource.com/c/103320
> Commit-Queue: Yves Gerey <yvesg@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25013}

Bug: webrtc:8311
Change-Id: Id6ec4aeb798886a90ace640a190eaf16497ba31b
Reviewed-on: https://webrtc-review.googlesource.com/c/104120
Commit-Queue: Yves Gerey <yvesg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25034}
2018-10-08 07:44:19 +00:00
Oleh Prypin
96a0f61917 Revert "[cleanup] Remove useless includes."
This reverts commit be8b5348c7.

Reason for revert: Breaks downstream project

Original change's description:
> [cleanup] Remove useless includes.
> 
> Manual cleanup guided by include-what-you-use diagnostic.
> 
> Bug: webrtc:8311
> Change-Id: I00be03392cc7ee005101427ea7dc701621ccea68
> Reviewed-on: https://webrtc-review.googlesource.com/c/103320
> Commit-Queue: Yves Gerey <yvesg@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25013}

TBR=phoglund@google.com,phoglund@webrtc.org,yvesg@webrtc.org

Change-Id: I7a6e1cdfef685173b76f234ad598083043dcd9a0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8311
Reviewed-on: https://webrtc-review.googlesource.com/c/104022
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25015}
2018-10-05 13:13:45 +00:00
Yves Gerey
be8b5348c7 [cleanup] Remove useless includes.
Manual cleanup guided by include-what-you-use diagnostic.

Bug: webrtc:8311
Change-Id: I00be03392cc7ee005101427ea7dc701621ccea68
Reviewed-on: https://webrtc-review.googlesource.com/c/103320
Commit-Queue: Yves Gerey <yvesg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25013}
2018-10-05 11:51:06 +00:00
Jonas Olsson
941a07cca3 Remove all remaining non-test uses of std::stringstream.
Bug: webrtc:8982
Change-Id: I635a8545c46dc8c89663d64af351e22e65cbcb33
Reviewed-on: https://webrtc-review.googlesource.com/98880
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24715}
2018-09-13 08:52:05 +00:00
Jonas Olsson
f2ce37cae5 Add support for logging absl::string_view.
Bug: webrtc:8982
Change-Id: I5691f91ea663756666cf187ee223ede50f87d5f0
Reviewed-on: https://webrtc-review.googlesource.com/99840
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24707}
2018-09-12 14:15:03 +00:00
Jonas Olsson
d8c50780ea Reland "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: 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}
2018-09-07 13:27:29 +00:00
Jonas Olsson
8a7916b3f8 Add a LOG macro with customizable file name and line number.
This enables us to migrate a internal project from depending on implementation
details of our LOG macros.

Bug: webrtc:9278
Change-Id: I41408aec40e26d2b55df58360f94f5ceaa57af4e
Reviewed-on: https://webrtc-review.googlesource.com/98001
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24597}
2018-09-06 08:51:24 +00:00
Jonas Olsson
46d65e2c2c Revert "Consolidate loggability checks and replace streams."
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}
2018-09-04 13:42:20 +00:00
Jonas Olsson
4092cd6db4 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}
2018-09-04 09:49:13 +00:00
Paulina Hensman
f1e3cb418e Add OnLogMessage(msg, sev, tag) to logsinks
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}
2018-06-21 09:11:43 +00:00
Yves Gerey
665174fdbb Reformat the WebRTC code base
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}
2018-06-19 14:00:39 +00:00
Alex Glaznev
5abd78b40a Revert "Reland "Injectable logging""
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}
2018-06-01 20:10:26 +00:00
Karl Wiberg
cefc46517e RTC_LOG_* macros: Implement argument passing with a single variadic call
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}
2018-05-23 23:15:04 +00:00
Niels Möller
65ec0fc81e Delete unneeded includes of basictypes.h.
This is a kitchen-sink header, some pieces should be moved to
byteorder.h, the rest likely deleted.

Delete most includes of basictypes.h. In leaf headers,
include stddef.h and stdint.h explicitly where needed.

Bug: webrtc:6853
Change-Id: Ibc809936a8f94d418e4eb650da1e89c1b9142073
Reviewed-on: https://webrtc-review.googlesource.com/77721
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23333}
2018-05-21 19:35:08 +00:00
Paulina Hensman
21219a0e43 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}
2018-05-18 15:04:16 +00:00
Alex Glaznev
4f81038a52 Revert "Injectable logging"
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}
2018-05-15 22:33:53 +00:00
Paulina Hensman
59216ec4a4 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}
2018-05-15 12:36:01 +00:00
Karl Wiberg
1ffb3747bd RTC_LOG(): Internally, pass logging severity as template argument
When the logging severity is statically known, passing it as a
template argument instead of as a function argument saves space at the
call site.

Because this is a constructor, it's not possible to pass template
arguments explicitly---they need to be deduced. So we pass a dummy
function argument whose type encodes the logging severity, and because
the dummy is an empty struct, the ABI generally specifies that this is
a no-op with no runtime cost.

In aggregate, this reduces the size of libjingle_peerconnection_so.so
by 4 kB.

Bug: webrtc:9185
Change-Id: I8118f39dc2aed3be34b2979a239fc0d3dffa969f
Reviewed-on: https://webrtc-review.googlesource.com/74582
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23136}
2018-05-07 09:08:14 +00:00
Karl Wiberg
ee10ea8a41 RTC_LOG(): Internally, pass logging severity as template argument
When the logging severity is statically known, passing it as a
template argument instead of as a function argument saves space at the
call site.

In aggregate, this reduces the size of libjingle_peerconnection_so.so
by 8 kB.

Bug: webrtc:9185
Change-Id: I9ca363845216370e97b230952c86e6d07719962f
Reviewed-on: https://webrtc-review.googlesource.com/74480
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23121}
2018-05-04 14:38:34 +00:00
Karl Wiberg
ab4f1c1bce Be more clever when passing default arguments in log statements
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}
2018-05-04 09:22:34 +00:00
Tommi
e51a0a8bf1 Re-Reland "Some cleanup for the logging code:""
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}
2018-02-27 15:59:39 +00:00
Tommi
fef0500aa7 Adding a new string utility class: SimpleStringBuilder.
This is a fairly minimalistic string building class that
can be used instead of stringstream, which is discouraged
but tempting to use due to its convenient interface and
familiarity for anyone using our logging macros.

As a starter, I'm changing the string building code in
ReceiveStatisticsProxy and SendStatisticsProxy from using
stringstream and using SimpleStringBuilder instead.

In the case of SimpleStringBuilder, there's a single allocation,
it's done on the stack (fast), and minimal code is required for
each concatenation. The developer is responsible for ensuring
that the buffer size is adequate but the class won't overflow
the buffer.  In dcheck-enabled builds, a check will go off if
we run out of buffer space.

As part of using SimpleStringBuilder for a small part of
rtc::LogMessage, a few more changes were made:
- SimpleStringBuilder is used for formatting errors instead of ostringstream.
- A new 'noop' state has been introduced for log messages that will be dropped.
- Use a static (singleton) noop ostream object for noop logging messages
  instead of building up an actual ostringstream object that will be dropped.
- Add a LogMessageForTest class for better state inspection/testing.
- Fix benign bug in LogTest.Perf, change the test to not use File IO and
  always enable it.
- Ensure that minimal work is done for noop messages.
- Remove dependency on rtc::Thread.
- Add tests for the extra_ field, correctly parsed paths and noop handling.

Bug: webrtc:8529, webrtc:4364, webrtc:8933
Change-Id: Ifa258c135135945e4560d9e24315f7d96f784acb
Reviewed-on: https://webrtc-review.googlesource.com/55520
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22203}
2018-02-27 13:37:39 +00:00
Zhi Huang
d81aac48ee Revert "Reland "Some cleanup for the logging code:""
This reverts commit 12dc1842d6.

Reason for revert: Some internal tests keeps failing with this change.

Original change's description:
> Reland "Some cleanup for the logging code:"
> 
> This is a reland of 9ecdcdf2b5.
> 
> 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: Id062a5b61917e66561f6c8441c2defd525e38f16
> Reviewed-on: https://webrtc-review.googlesource.com/57880
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Commit-Queue: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22191}

TBR=kwiberg@webrtc.org,tommi@webrtc.org,jonasolsson@webrtc.org

Change-Id: I2b04e361459926a503552a0e1fcf3d1da3ddb643
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8928
Reviewed-on: https://webrtc-review.googlesource.com/58101
Reviewed-by: Zhi Huang <zhihuang@webrtc.org>
Commit-Queue: Zhi Huang <zhihuang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22195}
2018-02-27 01:59:14 +00:00
Tommi
12dc1842d6 Reland "Some cleanup for the logging code:"
This is a reland of 9ecdcdf2b5.

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: Id062a5b61917e66561f6c8441c2defd525e38f16
Reviewed-on: https://webrtc-review.googlesource.com/57880
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22191}
2018-02-26 22:00:34 +00:00
Philip Eliasson
278aa42718 Revert "Some cleanup for the logging code:"
This reverts commit 9ecdcdf2b5.

Reason for revert: Breaks downstream project.

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}

TBR=kwiberg@webrtc.org,tommi@webrtc.org,jonasolsson@webrtc.org

Change-Id: I37a13d766fbdee2adb7f45231cf8be6b2b456bec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8928
Reviewed-on: https://webrtc-review.googlesource.com/57720
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22187}
2018-02-26 14:54:52 +00:00
Tommi
9ecdcdf2b5 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}
2018-02-26 12:09:50 +00:00
Jonas Olsson
2b6f13508e Un-inline LogMessage::Loggable
Make min_sev_ and dbg_sev_ file-local, and don't inline Loggable().
This should shrink the size of each RTC_LOG statement by a few
instructions. In my local tests the android binary becomes ~12k smaller.

Bug: webrtc:8529
Change-Id: Ic90cf8a7b042d49370cc8d0b1b08058940b615f8
Reviewed-on: https://webrtc-review.googlesource.com/53680
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22081}
2018-02-19 13:38:13 +00:00
Jonas Olsson
45cc890560 Assorted logging pedantry
This cl fixes various minor issues found during a quick scan of the current log
usage.

Bug: webrtc:8529
Change-Id: I1e1eb02ef220177dbb327203509736ad7f70cc1c
Reviewed-on: https://webrtc-review.googlesource.com/52262
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Henrik Grunell <henrikg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21996}
2018-02-13 10:47:24 +00:00
Jonas Olsson
24ea822dcb Remove logging in audio/* from release builds.
This makes the binary around 8000 bytes smaller.

Bug: webrtc:8529
Change-Id: Ic59b16e300dd4dd5471e1079103982300cb5d660
Reviewed-on: https://webrtc-review.googlesource.com/43300
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21762}
2018-01-25 13:46:54 +00:00
Niels Möller
86b893c857 Delete declaration of LogMultilineState and LogMultiline.
Implementation was deleted in cl
https://webrtc-review.googlesource.com/33240

Bug: webrtc:6424
Change-Id: I384e2b2933aa4127c8f68f2af1560da807568da8
Reviewed-on: https://webrtc-review.googlesource.com/38240
Reviewed-by: Henrik Grunell <henrikg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21532}
2018-01-09 12:41:20 +00:00
Niels Möller
895d4cf085 Delete unused class LoggingAdapter.
Bug: webrtc:6424
Change-Id: I854b372a67fd52f9c5f527529143bc1096eac5ff
Reviewed-on: https://webrtc-review.googlesource.com/33240
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21315}
2017-12-18 09:21:03 +00:00
Patrik Höglund
a8005cfd8b Fix circular dependencies between optional, array_view, and rtc_base.
This splits things out of rtc_base and makes dependencies explicit.

Bug: webrtc:6828
Change-Id: Id521896c3c43595349021c857bec216e429a0c8d
Reviewed-on: https://webrtc-review.googlesource.com/32780
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21264}
2017-12-14 06:49:11 +00:00
Patrik Höglund
d37709b659 Revert "Fix circular dependencies between optional, array_view, and rtc_base."
This reverts commit a9e0924fa7.

Reason for revert: Breaks because of RTC_LAST_SYSTEM_ERROR

Original change's description:
> Fix circular dependencies between optional, array_view, and rtc_base.
> 
> This splits things out of rtc_base and makes dependencies explicit.
> 
> Bug: webrtc:6828
> Change-Id: Ib813c7bd9e4de7ab015acb917bc09ee7204ba7bd
> Reviewed-on: https://webrtc-review.googlesource.com/31940
> Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#21245}

TBR=phoglund@webrtc.org,kwiberg@webrtc.org

Change-Id: I1a5dcf2223f00ae7c46f9f2a12b990ab3a84397d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:6828
Reviewed-on: https://webrtc-review.googlesource.com/32760
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21251}
2017-12-13 14:56:33 +00:00