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

Unified Diff: webrtc/base/taskrunner.cc

Issue 2620303003: Replace ASSERT by RTC_DCHECK in all non-test code. (Closed)
Patch Set: Also replace NDEBUG checks in taskrunner.h. 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
Index: webrtc/base/taskrunner.cc
diff --git a/webrtc/base/taskrunner.cc b/webrtc/base/taskrunner.cc
index 73916a07194ffc51d746232aa2cafcbcedc5cb66..96d87b8be9766305eca3213d8f95a362b5d5ef22 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,12 +20,13 @@
namespace rtc {
TaskRunner::TaskRunner()
- : TaskParent(this),
- next_timeout_task_(NULL),
- tasks_running_(false)
-#if !defined(NDEBUG)
- , abort_count_(0),
- deleting_task_(NULL)
+ : TaskParent(this),
+ next_timeout_task_(NULL),
+ tasks_running_(false)
+#if RTC_DCHECK_IS_ON
+ ,
kwiberg-webrtc 2017/01/12 02:10:41 You may want to use default member initializers to
nisse-webrtc 2017/01/12 10:53:24 Could make sense, but not in this cl. Not sure if
kwiberg-webrtc 2017/01/12 11:00:38 I believe you can use either (but preferably not a
nisse-webrtc 2017/01/12 11:09:42 I'll change to using initializers, to make it less
kwiberg-webrtc 2017/01/12 12:54:30 Ah. Good that we're finally about to get serious w
+ abort_count_(0),
+ deleting_task_(NULL)
#endif
{
}
@@ -54,8 +56,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 +91,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 +154,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();

Powered by Google App Engine
This is Rietveld 408576698