Add RTC_ prefix to (D)CHECKs and related macros.
We must remove dependency on Chromium, i.e. we can't use Chromium's base/logging.h. That means we need to define these macros in WebRTC also when doing Chromium builds. And this causes redefinition.
Alternative solutions:
* Check if we already have defined e.g. CHECK, and don't define them in that case. This makes us depend on include order in Chromium, which is not acceptable.
* Don't allow using the macros in WebRTC headers. Error prone since if someone adds it there by mistake it may compile fine, but later break if a header in added or order is changed in Chromium. That will be confusing and hard to enforce.
* Ensure that headers that are included by an embedder don't include our macros. This would require some heavy refactoring to be maintainable and enforcable.
* Changes in Chromium for this is obviously not an option.
BUG=chromium:468375
NOTRY=true
Review URL: https://codereview.webrtc.org/1335923002
Cr-Commit-Position: refs/heads/master@{#9964}
diff --git a/webrtc/modules/utility/source/process_thread_impl.cc b/webrtc/modules/utility/source/process_thread_impl.cc
index 51b7494..df56fe3 100644
--- a/webrtc/modules/utility/source/process_thread_impl.cc
+++ b/webrtc/modules/utility/source/process_thread_impl.cc
@@ -48,9 +48,9 @@
thread_name_(thread_name) {}
ProcessThreadImpl::~ProcessThreadImpl() {
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!thread_.get());
- DCHECK(!stop_);
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(!thread_.get());
+ RTC_DCHECK(!stop_);
while (!queue_.empty()) {
delete queue_.front();
@@ -59,12 +59,12 @@
}
void ProcessThreadImpl::Start() {
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!thread_.get());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(!thread_.get());
if (thread_.get())
return;
- DCHECK(!stop_);
+ RTC_DCHECK(!stop_);
{
// TODO(tommi): Since DeRegisterModule is currently being called from
@@ -78,11 +78,11 @@
thread_ = ThreadWrapper::CreateThread(&ProcessThreadImpl::Run, this,
thread_name_);
- CHECK(thread_->Start());
+ RTC_CHECK(thread_->Start());
}
void ProcessThreadImpl::Stop() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
if(!thread_.get())
return;
@@ -93,7 +93,7 @@
wake_up_->Set();
- CHECK(thread_->Stop());
+ RTC_CHECK(thread_->Stop());
stop_ = false;
// TODO(tommi): Since DeRegisterModule is currently being called from
@@ -130,15 +130,15 @@
}
void ProcessThreadImpl::RegisterModule(Module* module) {
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(module);
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(module);
#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
{
// Catch programmer error.
rtc::CritScope lock(&lock_);
for (const ModuleCallback& mc : modules_)
- DCHECK(mc.module != module);
+ RTC_DCHECK(mc.module != module);
}
#endif
@@ -162,7 +162,7 @@
void ProcessThreadImpl::DeRegisterModule(Module* module) {
// Allowed to be called on any thread.
// TODO(tommi): Disallow this ^^^
- DCHECK(module);
+ RTC_DCHECK(module);
{
rtc::CritScope lock(&lock_);