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

Unified Diff: components/offline_pages/core/task_queue.cc

Issue 2535273003: [Offline pages] TaskQueue polishing (Closed)
Patch Set: Created 4 years, 1 month 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 | « components/offline_pages/core/task_queue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/core/task_queue.cc
diff --git a/components/offline_pages/core/task_queue.cc b/components/offline_pages/core/task_queue.cc
index 6f97413bd7607e3fd2e8dce9ab0f33f6e931e12f..777a82d3583cc642bab3d96d6601302e32c05eda 100644
--- a/components/offline_pages/core/task_queue.cc
+++ b/components/offline_pages/core/task_queue.cc
@@ -18,7 +18,7 @@ void TaskQueue::AddTask(std::unique_ptr<Task> task) {
base::ThreadTaskRunnerHandle::Get(),
base::Bind(&TaskQueue::TaskCompleted, weak_ptr_factory_.GetWeakPtr()));
tasks_.push(std::move(task));
- MaybeStartTask();
+ StartTaskIfAvailable();
}
bool TaskQueue::HasPendingTasks() const {
@@ -29,7 +29,7 @@ bool TaskQueue::HasRunningTask() const {
return current_task_.get() != nullptr;
}
-void TaskQueue::MaybeStartTask() {
+void TaskQueue::StartTaskIfAvailable() {
DVLOG(2) << "running? " << HasRunningTask() << ", pending? "
<< HasPendingTasks() << " " << __func__;
if (HasRunningTask() || !HasPendingTasks())
@@ -44,7 +44,7 @@ void TaskQueue::TaskCompleted(Task* task) {
DCHECK_EQ(task, current_task_.get());
if (task == current_task_.get()) {
current_task_.reset(nullptr);
- MaybeStartTask();
+ StartTaskIfAvailable();
}
}
« no previous file with comments | « components/offline_pages/core/task_queue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698