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

Unified Diff: webrtc/base/taskrunner.cc

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. Created 3 years, 10 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/taskparent.cc ('k') | webrtc/base/testclient.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 79e48ecddfa8bcb387f3e6b6caf64a2d13af2122..0ee5d023b5b415f821912cf3222588b232541302 100644
--- a/webrtc/base/taskrunner.cc
+++ b/webrtc/base/taskrunner.cc
@@ -77,7 +77,7 @@ void TaskRunner::InternalRunTasks(bool in_destructor) {
Task* task = tasks_[i];
if (next_timeout_task_ &&
task->unique_id() == next_timeout_task_->unique_id()) {
- next_timeout_task_ = NULL;
+ next_timeout_task_ = nullptr;
need_timeout_recalc = true;
}
@@ -86,21 +86,19 @@ void TaskRunner::InternalRunTasks(bool in_destructor) {
#endif
delete task;
#if RTC_DCHECK_IS_ON
- deleting_task_ = NULL;
+ deleting_task_ = nullptr;
#endif
- tasks_[i] = NULL;
+ tasks_[i] = nullptr;
}
}
- // Finally, remove nulls
+ // Finally, remove nulls.
std::vector<Task *>::iterator it;
- it = std::remove(tasks_.begin(),
- tasks_.end(),
- reinterpret_cast<Task *>(NULL));
+ it = std::remove(tasks_.begin(), tasks_.end(), nullptr);
tasks_.erase(it, tasks_.end());
if (need_timeout_recalc)
- RecalcNextTimeout(NULL);
+ RecalcNextTimeout(nullptr);
// Make sure that adjustments are done to account
// for any timeout changes (but don't call this
@@ -118,7 +116,7 @@ void TaskRunner::PollTasks() {
// TODO: We need to guard against WakeTasks not updating
// next_timeout_task_. Maybe also add documentation in the header file once
// we understand this code better.
- Task* old_timeout_task = NULL;
+ Task* old_timeout_task = nullptr;
while (next_timeout_task_ &&
old_timeout_task != next_timeout_task_ &&
next_timeout_task_->TimedOut()) {
@@ -144,9 +142,10 @@ int64_t TaskRunner::next_task_timeout() const {
void TaskRunner::UpdateTaskTimeout(Task* task,
int64_t previous_task_timeout_time) {
- RTC_DCHECK(task != NULL);
+ RTC_DCHECK(task != nullptr);
int64_t previous_timeout_time = next_task_timeout();
- bool task_is_timeout_task = next_timeout_task_ != NULL &&
+ bool task_is_timeout_task =
+ next_timeout_task_ != nullptr &&
task->unique_id() == next_timeout_task_->unique_id();
if (task_is_timeout_task) {
previous_timeout_time = previous_task_timeout_time;
@@ -156,7 +155,7 @@ void TaskRunner::UpdateTaskTimeout(Task* task,
// check to see if it's closer than the current
// "about to timeout" task
if (task->timeout_time()) {
- if (next_timeout_task_ == NULL ||
+ if (next_timeout_task_ == nullptr ||
(task->timeout_time() <= next_timeout_task_->timeout_time())) {
next_timeout_task_ = task;
}
@@ -184,14 +183,14 @@ void TaskRunner::RecalcNextTimeout(Task *exclude_task) {
// it has the closest timeout time
int64_t next_timeout_time = 0;
- next_timeout_task_ = NULL;
+ next_timeout_task_ = nullptr;
for (size_t i = 0; i < tasks_.size(); ++i) {
Task *task = tasks_[i];
// if the task isn't complete, and it actually has a timeout time
if (!task->IsDone() && (task->timeout_time() > 0))
// if it doesn't match our "exclude" task
- if (exclude_task == NULL ||
+ if (exclude_task == nullptr ||
exclude_task->unique_id() != task->unique_id())
// if its timeout time is sooner than our current timeout time
if (next_timeout_time == 0 ||
« no previous file with comments | « webrtc/base/taskparent.cc ('k') | webrtc/base/testclient.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698