Add CHECK and friends from Chromium.

Replace FATAL_ERROR_IF with the more familiar (to Chromium developers)
CHECK and DCHECK. The full Chromium implementation is fairly elaborate
but I copied enough to get us most of the benefits. I believe the main
missing component is a more advanced stack dump. For this bit I relied
on the V8 implementation.

There are a few minor modifications from the Chromium original:
- The FatalMessage class is specialized for logging fatal error
messages and aborting. Chromium uses the general LogMessage class,
which we could consider moving towards in the future.
- NOTIMPLEMENTED() and NOTREACHED() have been removed, partly because
I don't want to rely on our logging.h until base/ and system_wrappers/
are consolidated.
- FATAL() replaces LOG(FATAL).

Minor modifications from V8's stack dump:
- If parsing of a stack trace symbol fails, just print the unparsed
symbol. (I noticed this happened on Mac.)
- Use __GLIBCXX__ and __UCLIBC__. This is from examining the backtrace
use in Chromium.

UNREACHABLE() has been removed because its behavior is different than
Chromium's NOTREACHED(), which is bound to cause confusion. The few uses
were replaced with FATAL(), matching the previous behavior.

Add a NO_RETURN macro, allowing us to remove unreachable return
statements following a CHECK/FATAL.

TESTED=the addition of dummy CHECK, DCHECK, CHECK_EQ and FATAL did the
did the right things. Stack traces work on Mac, but I don't get symbols
on Linux.

R=henrik.lundin@webrtc.org, kwiberg@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/22449004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7003 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org
2014-08-28 16:28:26 +00:00
parent 11c6bde474
commit a5b7869f3d
8 changed files with 318 additions and 71 deletions

View File

@@ -50,8 +50,8 @@ bool AcmSendTest::RegisterCodec(const char* payload_name,
int channels,
int payload_type,
int frame_size_samples) {
FATAL_ERROR_IF(AudioCodingModule::Codec(
payload_name, &codec_, sampling_freq_hz, channels) != 0);
CHECK_EQ(0, AudioCodingModule::Codec(payload_name, &codec_, sampling_freq_hz,
channels));
codec_.pltype = payload_type;
codec_.pacsize = frame_size_samples;
codec_registered_ = (acm_->RegisterSendCodec(codec_) == 0);
@@ -73,9 +73,8 @@ Packet* AcmSendTest::NextPacket() {
// Insert audio and process until one packet is produced.
while (clock_.TimeInMilliseconds() < test_duration_ms_) {
clock_.AdvanceTimeMilliseconds(kBlockSizeMs);
FATAL_ERROR_IF(
!audio_source_->Read(input_block_size_samples_, input_frame_.data_));
FATAL_ERROR_IF(acm_->Add10MsData(input_frame_) != 0);
CHECK(audio_source_->Read(input_block_size_samples_, input_frame_.data_));
CHECK_EQ(0, acm_->Add10MsData(input_frame_));
input_frame_.timestamp_ += input_block_size_samples_;
int32_t encoded_bytes = acm_->Process();
if (encoded_bytes > 0) {