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..f4da9eed3e9175a0adaf018850787d884e506537 100644 |
--- a/components/scheduler/base/task_queue_impl.h |
+++ b/components/scheduler/base/task_queue_impl.h |
@@ -11,18 +11,18 @@ |
#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 DelayedTaskDelegate; |
class TaskQueueManager; |
namespace internal { |
- |
class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue { |
public: |
TaskQueueImpl(TaskQueueManager* task_queue_manager, |
+ const scoped_refptr<DelayedTaskDelegate>& delayed_task_delegate, |
const Spec& spec, |
const char* disabled_by_default_tracing_category, |
const char* disabled_by_default_verbose_tracing_category); |
@@ -85,9 +85,7 @@ class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue { |
bool NextPendingDelayedTaskRunTime( |
base::TimeTicks* next_pending_delayed_task); |
- void UpdateWorkQueue(LazyNow* lazy_now, |
- bool should_trigger_wakeup, |
- const Task* previous_task); |
+ void UpdateWorkQueue(bool should_trigger_wakeup, const Task* previous_task); |
Task TakeTaskFromWorkQueue(); |
std::queue<Task>& work_queue() { return main_thread_only().work_queue; } |
@@ -124,10 +122,9 @@ 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. |
- void MoveReadyDelayedTasksToIncomingQueue(LazyNow* lazy_now); |
+ // process dealyed tasks that need to be run now. Thread safe, but in |
+ // practice it's always called from the main thread. |
+ void MoveReadyDelayedTasksToIncomingQueue(); |
// Test support functions. These should not be used in production code. |
void PushTaskOntoWorkQueueForTest(const Task& task); |
@@ -135,6 +132,7 @@ class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue { |
size_t WorkQueueSizeForTest() const { |
return main_thread_only().work_queue.size(); |
} |
+ size_t IncommingQueueSizeForTest() const; |
Sami
2015/11/17 10:31:06
typo: incoming
alex clarke (OOO till 29th)
2015/11/18 15:30:15
Done.
|
// Can be called on any thread. |
static const char* PumpPolicyToString(TaskQueue::PumpPolicy pump_policy); |
@@ -153,7 +151,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<DelayedTaskDelegate>& delayed_task_delegate); |
~AnyThread(); |
// TaskQueueManager is maintained in two copies: inside AnyThread and inside |
@@ -164,6 +164,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<DelayedTaskDelegate> delayed_task_delegate; |
}; |
struct MainThreadOnly { |
@@ -185,16 +186,14 @@ class SCHEDULER_EXPORT TaskQueueImpl final : public TaskQueue { |
const base::Closure& task, |
base::TimeDelta delay, |
TaskType task_type); |
- bool PostDelayedTaskLocked(LazyNow* lazy_now, |
- const tracked_objects::Location& from_here, |
+ bool PostDelayedTaskLocked(const tracked_objects::Location& from_here, |
const base::Closure& task, |
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); |
+ void MoveReadyDelayedTasksToIncomingQueueLocked(); |
void PumpQueueLocked(); |
bool TaskIsOlderThanQueuedTasks(const Task* task); |