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

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

Issue 681793003: scheduler: Add support for tracing scheduler state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/renderer_scheduler_selector.h
diff --git a/content/renderer/scheduler/renderer_scheduler_selector.h b/content/renderer/scheduler/renderer_scheduler_selector.h
index 7f661308505b283fdae760cfd3dd557b753dc2fd..b768494c844f7056ae234055cfb2db59fcebe04c 100644
--- a/content/renderer/scheduler/renderer_scheduler_selector.h
+++ b/content/renderer/scheduler/renderer_scheduler_selector.h
@@ -7,9 +7,17 @@
#include <set>
+#include "base/memory/ref_counted.h"
#include "base/threading/thread_checker.h"
#include "content/renderer/scheduler/task_queue_selector.h"
+namespace base {
+namespace debug {
+class ConvertableToTraceFormat;
+class TracedValue;
+}
+}
+
namespace content {
// A RendererSchedulerSelector is a TaskQueueSelector which is used by the
@@ -54,6 +62,13 @@ class RendererSchedulerSelector : public TaskQueueSelector {
const std::vector<const base::TaskQueue*>& work_queues) override;
bool SelectWorkQueueToService(size_t* out_queue_index) override;
+ // Serialize the selector state into the given state dictionary for tracing.
+ void AsValueInto(base::debug::TracedValue* state) const;
+
picksi1 2014/10/28 11:01:40 "AsValueInto" means nothing to me! Is there some i
Sami 2014/10/28 12:57:47 Agreed that it isn't very descriptive, but it's pr
+ // 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:
// Returns true if queueA contains an older task than queueB.
static bool IsOlder(const base::TaskQueue* queueA,
@@ -72,13 +87,26 @@ class RendererSchedulerSelector : public TaskQueueSelector {
bool QueueEnabledWithPriority(size_t queue_index,
QueuePriority priority) const;
+ void DidSelectQueue(size_t selected_queue, QueuePriority priority);
rmcilroy 2014/10/27 17:51:28 nit - comment when to call this.
Sami 2014/10/28 12:57:47 Done.
+
picksi1 2014/10/28 11:01:40 Possibly the ship has sailed, but it should the se
Sami 2014/10/28 12:57:47 I think we went back and forth with this a couple
+ scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithSelectedQueue(
+ size_t selected_queue) const;
+ static const char* PriorityToString(QueuePriority priority);
+
// Number of high priority tasks which can be run before a normal priority
// task should be selected to prevent starvation.
// TODO(rmcilroy): Check if this is a good value.
static const size_t kMaxStarvationTasks = 5;
+ struct Queue {
+ Queue();
+
+ const base::TaskQueue* work_queue;
+ const char* name;
+ };
picksi1 2014/10/28 11:01:40 Does this structure need to hold a work_queue poin
Sami 2014/10/28 12:57:47 Yes, the work queues are not owned by this class s
+
base::ThreadChecker main_thread_checker_;
- std::vector<const base::TaskQueue*> work_queues_;
+ std::vector<Queue> queues_;
std::set<size_t> queue_priorities_[kQueuePriorityCount];
size_t starvation_count_;
};

Powered by Google App Engine
This is Rietveld 408576698