Added CHECK for tasks passed to PostTask being null.
I hope this will make the crashes associated with posting null tasks fail fast so they can be more easily diagnosed.
TEST=try
BUG=none
TBR=darin@chromium.org
Review URL: http://codereview.chromium.org/6982004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84869 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 7e61bb63138faa706154f3c6da31b1cdf8dd8b65
diff --git a/base/message_loop.cc b/base/message_loop.cc
index bf0d25d..a3520a6 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -255,6 +255,7 @@
void MessageLoop::PostTask(
const tracked_objects::Location& from_here, Task* task) {
+ CHECK(task);
PendingTask pending_task(
base::Bind(&TaskClosureAdapter::Run,
new TaskClosureAdapter(task, &should_leak_tasks_)),
@@ -265,6 +266,7 @@
void MessageLoop::PostDelayedTask(
const tracked_objects::Location& from_here, Task* task, int64 delay_ms) {
+ CHECK(task);
PendingTask pending_task(
base::Bind(&TaskClosureAdapter::Run,
new TaskClosureAdapter(task, &should_leak_tasks_)),
@@ -275,6 +277,7 @@
void MessageLoop::PostNonNestableTask(
const tracked_objects::Location& from_here, Task* task) {
+ CHECK(task);
PendingTask pending_task(
base::Bind(&TaskClosureAdapter::Run,
new TaskClosureAdapter(task, &should_leak_tasks_)),
@@ -285,6 +288,7 @@
void MessageLoop::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here, Task* task, int64 delay_ms) {
+ CHECK(task);
PendingTask pending_task(
base::Bind(&TaskClosureAdapter::Run,
new TaskClosureAdapter(task, &should_leak_tasks_)),
@@ -295,7 +299,7 @@
void MessageLoop::PostTask(
const tracked_objects::Location& from_here, const base::Closure& task) {
- DCHECK(!task.is_null());
+ CHECK(!task.is_null());
PendingTask pending_task(task, from_here, CalculateDelayedRuntime(0), true);
AddToIncomingQueue(&pending_task);
}
@@ -303,7 +307,7 @@
void MessageLoop::PostDelayedTask(
const tracked_objects::Location& from_here, const base::Closure& task,
int64 delay_ms) {
- DCHECK(!task.is_null());
+ CHECK(!task.is_null());
PendingTask pending_task(task, from_here,
CalculateDelayedRuntime(delay_ms), true);
AddToIncomingQueue(&pending_task);
@@ -311,7 +315,7 @@
void MessageLoop::PostNonNestableTask(
const tracked_objects::Location& from_here, const base::Closure& task) {
- DCHECK(!task.is_null());
+ CHECK(!task.is_null());
PendingTask pending_task(task, from_here, CalculateDelayedRuntime(0), false);
AddToIncomingQueue(&pending_task);
}
@@ -319,7 +323,7 @@
void MessageLoop::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here, const base::Closure& task,
int64 delay_ms) {
- DCHECK(!task.is_null());
+ CHECK(!task.is_null());
PendingTask pending_task(task, from_here,
CalculateDelayedRuntime(delay_ms), false);
AddToIncomingQueue(&pending_task);