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

Unified Diff: content/renderer/scheduler/task_queue_manager.h

Issue 681793003: scheduler: Add support for tracing scheduler state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused function. Created 6 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: content/renderer/scheduler/task_queue_manager.h
diff --git a/content/renderer/scheduler/task_queue_manager.h b/content/renderer/scheduler/task_queue_manager.h
index b1b79357ad3df52d49f85e52d72cb2874dc29e98..d9b074c0832fc59d6ba2392c212f35117eef8401 100644
--- a/content/renderer/scheduler/task_queue_manager.h
+++ b/content/renderer/scheduler/task_queue_manager.h
@@ -15,6 +15,13 @@
#include "base/threading/thread_checker.h"
#include "content/common/content_export.h"
+namespace base {
+namespace debug {
+class ConvertableToTraceFormat;
+class TracedValue;
+}
+}
+
namespace content {
namespace internal {
class TaskQueue;
@@ -69,6 +76,10 @@ class CONTENT_EXPORT TaskQueueManager {
// lock, so calling it has some overhead.
bool IsQueueEmpty(size_t queue_index) const;
+ // Set the name |queue_index| for tracing purposes. |name| must be a pointer
+ // to a static string.
+ void SetQueueName(size_t queue_index, const char* name);
+
private:
friend class internal::TaskQueue;
@@ -86,6 +97,11 @@ class CONTENT_EXPORT TaskQueueManager {
// Returns true if any work queue has tasks after doing this.
bool UpdateWorkQueues();
+ // Chooses the next work queue to service. Returns true if |out_queue_index|
+ // indicates the queue from which the next task should be run, false to
+ // avoid running any tasks.
+ bool SelectWorkQueueToService(size_t* out_queue_index);
+
// Runs a single task from the work queue designated by |queue_index|. The
// queue must not be empty.
void RunTaskFromWorkQueue(size_t queue_index);
@@ -99,6 +115,13 @@ class CONTENT_EXPORT TaskQueueManager {
base::TimeDelta delay);
internal::TaskQueue* Queue(size_t queue_index) const;
+ scoped_refptr<base::debug::ConvertableToTraceFormat>
+ AsValueWithSelectorResult(bool should_run, size_t selected_queue) const;
+ static void QueueAsValueInto(const base::TaskQueue& queue,
+ base::debug::TracedValue* state);
+ static void TaskAsValueInto(const base::PendingTask& task,
+ base::debug::TracedValue* state);
+
std::vector<scoped_refptr<internal::TaskQueue>> queues_;
base::AtomicSequenceNumber task_sequence_num_;
base::debug::TaskAnnotator task_annotator_;

Powered by Google App Engine
This is Rietveld 408576698