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

Unified Diff: webrtc/base/taskrunner.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.h ('k') | webrtc/base/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/taskrunner.cc
diff --git a/webrtc/base/taskrunner.cc b/webrtc/base/taskrunner.cc
index 73916a07194ffc51d746232aa2cafcbcedc5cb66..27599970c1eaba1bac8e7d9e75af593cd2cc435e 100644
--- a/webrtc/base/taskrunner.cc
+++ b/webrtc/base/taskrunner.cc
@@ -12,6 +12,7 @@
#include "webrtc/base/taskrunner.h"
+#include "webrtc/base/checks.h"
#include "webrtc/base/common.h"
#include "webrtc/base/task.h"
#include "webrtc/base/logging.h"
@@ -19,15 +20,7 @@
namespace rtc {
TaskRunner::TaskRunner()
- : TaskParent(this),
- next_timeout_task_(NULL),
- tasks_running_(false)
-#if !defined(NDEBUG)
- , abort_count_(0),
- deleting_task_(NULL)
-#endif
-{
-}
+ : TaskParent(this) {}
TaskRunner::~TaskRunner() {
// this kills and deletes children silently!
@@ -54,8 +47,10 @@ void TaskRunner::InternalRunTasks(bool in_destructor) {
// If that occurs, then tasks may be deleted in this method,
// but pointers to them will still be in the
// "ChildSet copy" in TaskParent::AbortAllChildren.
- // Subsequent use of those task may cause data corruption or crashes.
- ASSERT(!abort_count_);
+ // Subsequent use of those task may cause data corruption or crashes.
+#if RTC_DCHECK_IS_ON
+ RTC_DCHECK(!abort_count_);
+#endif
// Running continues until all tasks are Blocked (ok for a small # of tasks)
if (tasks_running_) {
return; // don't reenter
@@ -87,11 +82,11 @@ void TaskRunner::InternalRunTasks(bool in_destructor) {
need_timeout_recalc = true;
}
-#if !defined(NDEBUG)
+#if RTC_DCHECK_IS_ON
deleting_task_ = task;
#endif
delete task;
-#if !defined(NDEBUG)
+#if RTC_DCHECK_IS_ON
deleting_task_ = NULL;
#endif
tasks_[i] = NULL;
@@ -150,7 +145,7 @@ int64_t TaskRunner::next_task_timeout() const {
void TaskRunner::UpdateTaskTimeout(Task* task,
int64_t previous_task_timeout_time) {
- ASSERT(task != NULL);
+ RTC_DCHECK(task != NULL);
int64_t previous_timeout_time = next_task_timeout();
bool task_is_timeout_task = next_timeout_task_ != NULL &&
task->unique_id() == next_timeout_task_->unique_id();
« no previous file with comments | « webrtc/base/taskrunner.h ('k') | webrtc/base/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698