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

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc

Issue 2416803003: Record PendingTaskCount when a backgrounded renderer is suspended. (Closed)
Patch Set: Add GetNumberOfPendingTasks to TaskQueueManager Created 4 years, 2 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: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
index 0785e8d223049ce92bd458346d1d60784a432023..f8026073d6b4153e1357cc879087e985a8ac4303 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
@@ -321,6 +321,17 @@ bool TaskQueueImpl::IsEmpty() const {
return any_thread().immediate_incoming_queue.empty();
}
+size_t TaskQueueImpl::GetNumberOfPendingTasks() const {
+ size_t task_count = 0;
+ task_count += main_thread_only().delayed_work_queue->Size();
+ task_count += main_thread_only().delayed_incoming_queue.size();
+ task_count += main_thread_only().immediate_work_queue->Size();
+
+ base::AutoLock lock(any_thread_lock_);
+ task_count += any_thread().immediate_incoming_queue.size();
+ return task_count;
+}
+
bool TaskQueueImpl::HasPendingImmediateWork() const {
// Any work queue tasks count as immediate work.
if (!main_thread_only().delayed_work_queue->Empty() ||

Powered by Google App Engine
This is Rietveld 408576698