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}
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}
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}
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}
* 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}
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}
In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC
from src/webrtc to src/ (in order to preserve an healthy git history).
This CL takes care of fixing header guards, #include paths, etc...
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578
Reviewed-on: https://webrtc-review.googlesource.com/1561
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19846}
In order to eliminate the WebRTC Subtree mirror in Chromium,
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}