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

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

Issue 1461143003: Revert of Adds TimeDomains to the TaskQueueManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « components/scheduler/base/task_queue.h ('k') | components/scheduler/base/task_queue_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1f130e124eefa9c7a0b59ff9723989c349859351..e75746cebdf41b56eae1d6a69dcf7f614c99da34 100644
--- a/components/scheduler/base/task_queue_impl.h
+++ b/components/scheduler/base/task_queue_impl.h
@@ -11,19 +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 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);
@@ -82,7 +81,9 @@
void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override;
void RemoveTaskObserver(
base::MessageLoop::TaskObserver* task_observer) override;
- void SetTimeDomain(const scoped_refptr<TimeDomain>& time_domain) override;
+
+ bool NextPendingDelayedTaskRunTime(
+ base::TimeTicks* next_pending_delayed_task);
void UpdateWorkQueue(LazyNow* lazy_now,
bool should_trigger_wakeup,
@@ -123,8 +124,9 @@
// 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.
@@ -133,7 +135,6 @@
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);
@@ -152,9 +153,7 @@
};
struct AnyThread {
- AnyThread(TaskQueueManager* task_queue_manager,
- PumpPolicy pump_policy,
- const scoped_refptr<TimeDomain>& time_domain);
+ AnyThread(TaskQueueManager* task_queue_manager, PumpPolicy pump_policy);
~AnyThread();
// TaskQueueManager is maintained in two copies: inside AnyThread and inside
@@ -165,11 +164,10 @@
std::queue<Task> incoming_queue;
PumpPolicy pump_policy;
std::priority_queue<Task> delayed_task_queue;
- scoped_refptr<TimeDomain> time_domain;
};
struct MainThreadOnly {
- MainThreadOnly(TaskQueueManager* task_queue_manager);
+ explicit MainThreadOnly(TaskQueueManager* task_queue_manager);
~MainThreadOnly();
// Another copy of TaskQueueManager for lock-free access from the main
@@ -192,10 +190,9 @@
const base::Closure& task,
base::TimeTicks desired_run_time,
TaskType task_type);
- void ScheduleDelayedWorkTask(const scoped_refptr<TimeDomain> time_domain,
- base::TimeTicks desired_run_time);
-
- // Enqueues any delayed tasks which should be run now on the incoming_queue_.
+
+ // Enqueues any delayed tasks which should be run now on the incoming_queue_
+ // and calls ScheduleDelayedWorkLocked to ensure future tasks are scheduled.
// Must be called with |any_thread_lock_| locked.
void MoveReadyDelayedTasksToIncomingQueueLocked(LazyNow* lazy_now);
« no previous file with comments | « components/scheduler/base/task_queue.h ('k') | components/scheduler/base/task_queue_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698