| Index: src/cancelable-task.cc
|
| diff --git a/src/cancelable-task.cc b/src/cancelable-task.cc
|
| index defbb44775a8c1f64b8eedac62ea21b8376eacd1..5638e23fbf8a3674a51e2bbfa9f770f1396c8d56 100644
|
| --- a/src/cancelable-task.cc
|
| +++ b/src/cancelable-task.cc
|
| @@ -26,13 +26,15 @@ Cancelable::~Cancelable() {
|
| }
|
| }
|
|
|
| -CancelableTaskManager::CancelableTaskManager() : task_id_counter_(0) {}
|
| +CancelableTaskManager::CancelableTaskManager()
|
| + : task_id_counter_(0), canceled_(false) {}
|
|
|
| uint32_t CancelableTaskManager::Register(Cancelable* task) {
|
| base::LockGuard<base::Mutex> guard(&mutex_);
|
| uint32_t id = ++task_id_counter_;
|
| // The loop below is just used when task_id_counter_ overflows.
|
| while (cancelable_tasks_.count(id) > 0) ++id;
|
| + CHECK(!canceled_);
|
| cancelable_tasks_[id] = task;
|
| return id;
|
| }
|
| @@ -69,6 +71,7 @@ void CancelableTaskManager::CancelAndWait() {
|
| // of canceling we wait for the background tasks that have already been
|
| // started.
|
| base::LockGuard<base::Mutex> guard(&mutex_);
|
| + canceled_ = true;
|
|
|
| // Cancelable tasks could be running or could potentially register new
|
| // tasks, requiring a loop here.
|
|
|