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

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

Issue 1432263002: (reland) Adds TimeDomains to the TaskQueueManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot to change VirtualTimeDomain::GetName 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_manager.h
diff --git a/components/scheduler/base/task_queue_manager.h b/components/scheduler/base/task_queue_manager.h
index 002c4bc351a7d7fba8b4be655d326ce16f10bc42..1ed42326a457ecf1bf7ccd6b0dd9ff44c44802e0 100644
--- a/components/scheduler/base/task_queue_manager.h
+++ b/components/scheduler/base/task_queue_manager.h
@@ -30,10 +30,12 @@ class TracedValue;
namespace scheduler {
namespace internal {
-class LazyNow;
class TaskQueueImpl;
} // namespace internal
+class LazyNow;
+class RealTimeDomain;
+class TimeDomain;
class TaskQueueManagerDelegate;
// The task queue manager provides N task queues and a selector interface for
@@ -103,8 +105,16 @@ class SCHEDULER_EXPORT TaskQueueManager
// Returns the delegate used by the TaskQueueManager.
const scoped_refptr<TaskQueueManagerDelegate>& delegate() const;
+ // Time domains must be registered for the task queues to get updated.
+ void RegisterTimeDomain(const scoped_refptr<TimeDomain>& time_domain);
+ void UnregisterTimeDomain(const scoped_refptr<TimeDomain>& time_domain);
+
+ const scoped_refptr<RealTimeDomain>& real_time_domain() const {
+ return real_time_domain_;
+ }
+
private:
- friend class internal::LazyNow;
+ friend class LazyNow;
friend class internal::TaskQueueImpl;
friend class TaskQueueManagerTest;
@@ -166,34 +176,14 @@ class SCHEDULER_EXPORT TaskQueueManager
int GetNextSequenceNumber();
+ bool ATimeDomainCanAdvance();
Sami 2015/11/19 13:01:03 nit: the name makes this sound like an idempotent
alex clarke (OOO till 29th) 2015/11/19 13:54:48 Done.
+
scoped_refptr<base::trace_event::ConvertableToTraceFormat>
AsValueWithSelectorResult(bool should_run,
internal::TaskQueueImpl* selected_queue) const;
- // Causes DoWork to start calling UpdateWorkQueue for |queue|. Can be called
- // from any thread.
- void RegisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue);
-
- // Prevents DoWork from calling UpdateWorkQueue for |queue|. Must be called
- // from the thread the TaskQueueManager was created on.
- void UnregisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue);
-
- // Schedule a call to DoWork at |delayed_run_time| which indirectly calls
- // TaskQueueImpl::MoveReadyDelayedTasksToIncomingQueue for |queue|.
- // Can be called from any thread.
- void ScheduleDelayedWork(internal::TaskQueueImpl* queue,
- base::TimeTicks delayed_run_time,
- internal::LazyNow* lazy_now);
-
- // Function calling ScheduleDelayedWork that's suitable for use in base::Bind.
- void ScheduleDelayedWorkTask(scoped_refptr<internal::TaskQueueImpl> queue,
- base::TimeTicks delayed_run_time);
-
- // Call TaskQueueImpl::MoveReadyDelayedTasksToIncomingQueue for each
- // registered queue for which the delay has elapsed.
- void WakeupReadyDelayedQueues(internal::LazyNow* lazy_now);
-
- void MoveNewlyUpdatableQueuesIntoUpdatableQueueSet();
+ std::set<scoped_refptr<TimeDomain>> time_domains_;
+ scoped_refptr<RealTimeDomain> real_time_domain_;
std::set<scoped_refptr<internal::TaskQueueImpl>> queues_;
@@ -201,19 +191,6 @@ class SCHEDULER_EXPORT TaskQueueManager
// raw pointers and doesn't expect the rug to be pulled out from underneath.
std::set<scoped_refptr<internal::TaskQueueImpl>> queues_to_delete_;
- // This lock guards only |newly_updatable_|. It's not expected to be heavily
- // contended.
- base::Lock newly_updatable_lock_;
- std::vector<internal::TaskQueueImpl*> newly_updatable_;
-
- // Set of task queues with avaliable work on the incoming queue. This should
- // only be accessed from the main thread.
- std::set<internal::TaskQueueImpl*> updatable_queue_set_;
-
- typedef std::multimap<base::TimeTicks, internal::TaskQueueImpl*>
- DelayedWakeupMultimap;
-
- DelayedWakeupMultimap delayed_wakeup_multimap_;
base::AtomicSequenceNumber task_sequence_num_;
base::debug::TaskAnnotator task_annotator_;
@@ -241,6 +218,7 @@ class SCHEDULER_EXPORT TaskQueueManager
Observer* observer_; // NOT OWNED
scoped_refptr<DeletionSentinel> deletion_sentinel_;
+ scoped_refptr<TimeDomain> time_domain_;
base::WeakPtrFactory<TaskQueueManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TaskQueueManager);

Powered by Google App Engine
This is Rietveld 408576698