Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: webrtc/base/thread.cc

Issue 2620303003: Replace ASSERT by RTC_DCHECK in all non-test code. (Closed)
Patch Set: Address final nits. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/taskrunner.cc ('k') | webrtc/base/transformadapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/thread.cc
diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc
index af5e68bedf81234704fa3d8e611d196f13865b90..2657bbeb4ee24a7e562dd712e233e4243d50fbd5 100644
--- a/webrtc/base/thread.cc
+++ b/webrtc/base/thread.cc
@@ -20,6 +20,7 @@
#include <time.h>
#endif
+#include "webrtc/base/checks.h"
#include "webrtc/base/common.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/nullsocketserver.h"
@@ -134,7 +135,7 @@ Thread::ScopedDisallowBlockingCalls::ScopedDisallowBlockingCalls()
}
Thread::ScopedDisallowBlockingCalls::~ScopedDisallowBlockingCalls() {
- ASSERT(thread_->IsCurrent());
+ RTC_DCHECK(thread_->IsCurrent());
thread_->SetAllowBlockingCalls(previous_state_);
}
@@ -213,9 +214,9 @@ bool Thread::SetName(const std::string& name, const void* obj) {
}
bool Thread::Start(Runnable* runnable) {
- ASSERT(owned_);
+ RTC_DCHECK(owned_);
if (!owned_) return false;
- ASSERT(!running());
+ RTC_DCHECK(!running());
if (running()) return false;
Restart(); // reset IsQuitting() if the thread is being restarted
@@ -273,14 +274,14 @@ void Thread::SafeWrapCurrent() {
void Thread::Join() {
if (running()) {
- ASSERT(!IsCurrent());
+ RTC_DCHECK(!IsCurrent());
if (Current() && !Current()->blocking_calls_allowed_) {
LOG(LS_WARNING) << "Waiting for the thread to join, "
<< "but blocking calls have been disallowed";
}
#if defined(WEBRTC_WIN)
- ASSERT(thread_ != NULL);
+ RTC_DCHECK(thread_ != NULL);
WaitForSingleObject(thread_, INFINITE);
CloseHandle(thread_);
thread_ = NULL;
@@ -294,7 +295,7 @@ void Thread::Join() {
}
bool Thread::SetAllowBlockingCalls(bool allow) {
- ASSERT(IsCurrent());
+ RTC_DCHECK(IsCurrent());
bool previous = blocking_calls_allowed_;
blocking_calls_allowed_ = allow;
return previous;
@@ -304,7 +305,7 @@ bool Thread::SetAllowBlockingCalls(bool allow) {
void Thread::AssertBlockingIsAllowedOnCurrentThread() {
#if !defined(NDEBUG)
Thread* current = Thread::Current();
- ASSERT(!current || current->blocking_calls_allowed_);
+ RTC_DCHECK(!current || current->blocking_calls_allowed_);
#endif
}
@@ -366,7 +367,7 @@ void Thread::Send(const Location& posted_from,
AutoThread thread;
Thread *current_thread = Thread::Current();
- ASSERT(current_thread != NULL); // AutoThread ensures this
+ RTC_DCHECK(current_thread != NULL); // AutoThread ensures this
bool ready = false;
{
@@ -555,7 +556,7 @@ AutoThread::~AutoThread() {
#if defined(WEBRTC_WIN)
void ComThread::Run() {
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
- ASSERT(SUCCEEDED(hr));
+ RTC_DCHECK(SUCCEEDED(hr));
if (SUCCEEDED(hr)) {
Thread::Run();
CoUninitialize();
« no previous file with comments | « webrtc/base/taskrunner.cc ('k') | webrtc/base/transformadapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698