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

Unified Diff: components/scheduler/base/task_queue_impl.h

Issue 1432263002: (reland) Adds TimeDomains to the TaskQueueManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing some more feedback. Created 5 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
Index: components/scheduler/base/task_queue_impl.h
diff --git a/components/scheduler/base/task_queue_impl.h b/components/scheduler/base/task_queue_impl.h
index e75746cebdf41b56eae1d6a69dcf7f614c99da34..ec9780d5d6f6cdaac35a0f5142df9afa833e5ba2 100644
--- a/components/scheduler/base/task_queue_impl.h
+++ b/components/scheduler/base/task_queue_impl.h
@@ -11,18 +11,19 @@
#include "base/threading/thread_checker.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
-#include "components/scheduler/base/lazy_now.h"
#include "components/scheduler/base/task_queue.h"
#include "components/scheduler/scheduler_export.h"
namespace scheduler {
+class LazyNow;
+class TimeDomain;
class TaskQueueManager;
namespace internal {
-
class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue {
public:
TaskQueueImpl(TaskQueueManager* task_queue_manager,
+ const scoped_refptr<TimeDomain>& time_domain,
const Spec& spec,
const char* disabled_by_default_tracing_category,
const char* disabled_by_default_verbose_tracing_category);
@@ -124,9 +125,8 @@ class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue {
// Delayed task posted to the underlying run loop, which locks
// |any_thread_lock_| and calls MoveReadyDelayedTasksToIncomingQueueLocked to
- // process dealyed tasks
- // that need to be run now. Thread safe, but in practice it's always called
- // from the main thread.
+ // process dealyed tasks that need to be run now. Thread safe, but in
+ // practice it's always called from the main thread.
void MoveReadyDelayedTasksToIncomingQueue(LazyNow* lazy_now);
// Test support functions. These should not be used in production code.
@@ -135,6 +135,7 @@ class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue {
size_t WorkQueueSizeForTest() const {
return main_thread_only().work_queue.size();
}
+ size_t IncomingQueueSizeForTest() const;
// Can be called on any thread.
static const char* PumpPolicyToString(TaskQueue::PumpPolicy pump_policy);
@@ -153,7 +154,9 @@ class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue {
};
struct AnyThread {
- AnyThread(TaskQueueManager* task_queue_manager, PumpPolicy pump_policy);
+ AnyThread(TaskQueueManager* task_queue_manager,
+ PumpPolicy pump_policy,
+ const scoped_refptr<TimeDomain>& time_domain);
~AnyThread();
// TaskQueueManager is maintained in two copies: inside AnyThread and inside
@@ -164,6 +167,7 @@ class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue {
std::queue<Task> incoming_queue;
PumpPolicy pump_policy;
std::priority_queue<Task> delayed_task_queue;
+ scoped_refptr<TimeDomain> time_domain;
};
struct MainThreadOnly {
@@ -191,8 +195,7 @@ class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue {
base::TimeTicks desired_run_time,
TaskType task_type);
- // Enqueues any delayed tasks which should be run now on the incoming_queue_
- // and calls ScheduleDelayedWorkLocked to ensure future tasks are scheduled.
+ // Enqueues any delayed tasks which should be run now on the incoming_queue_.
// Must be called with |any_thread_lock_| locked.
void MoveReadyDelayedTasksToIncomingQueueLocked(LazyNow* lazy_now);

Powered by Google App Engine
This is Rietveld 408576698