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

Side by Side 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: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ 5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_
6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ 6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_
7 7
8 #include "base/atomic_sequence_num.h" 8 #include "base/atomic_sequence_num.h"
9 #include "base/debug/task_annotator.h" 9 #include "base/debug/task_annotator.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/pending_task.h" 12 #include "base/pending_task.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 17
18 namespace base {
19 namespace debug {
20 class TracedValue;
21 }
22 }
23
18 namespace content { 24 namespace content {
19 namespace internal { 25 namespace internal {
20 class TaskQueue; 26 class TaskQueue;
21 } 27 }
22 class TaskQueueSelector; 28 class TaskQueueSelector;
23 29
24 // The task queue manager provides N task queues and a selector interface for 30 // The task queue manager provides N task queues and a selector interface for
25 // choosing which task queue to service next. Each task queue consists of two 31 // choosing which task queue to service next. Each task queue consists of two
26 // sub queues: 32 // sub queues:
27 // 33 //
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // This function only needs to be called if automatic pumping is disabled 68 // This function only needs to be called if automatic pumping is disabled
63 // for |queue_index|. See |SetQueueAutoPump|. By default automatic pumping is 69 // for |queue_index|. See |SetQueueAutoPump|. By default automatic pumping is
64 // enabled for all queues. 70 // enabled for all queues.
65 void PumpQueue(size_t queue_index); 71 void PumpQueue(size_t queue_index);
66 72
67 // Returns true if there no tasks in either the work or incoming task queue 73 // Returns true if there no tasks in either the work or incoming task queue
68 // identified by |queue_index|. Note that this function involves taking a 74 // identified by |queue_index|. Note that this function involves taking a
69 // lock, so calling it has some overhead. 75 // lock, so calling it has some overhead.
70 bool IsQueueEmpty(size_t queue_index) const; 76 bool IsQueueEmpty(size_t queue_index) const;
71 77
78 // Helpers for serializing the task queue state into state dictionaries for
79 // tracing.
80 void AsValueInto(base::debug::TracedValue* state) const;
81 static void QueueAsValueInto(const base::TaskQueue& queue,
82 base::debug::TracedValue* state);
83 static void TaskAsValueInto(const base::PendingTask& task,
rmcilroy 2014/10/27 17:51:28 nit - private
Sami 2014/10/28 12:57:48 Done.
84 base::debug::TracedValue* state);
85
72 private: 86 private:
73 friend class internal::TaskQueue; 87 friend class internal::TaskQueue;
74 88
75 // Called by the task queue to register a new pending task and allocate a 89 // Called by the task queue to register a new pending task and allocate a
76 // sequence number for it. 90 // sequence number for it.
77 void DidQueueTask(base::PendingTask* pending_task); 91 void DidQueueTask(base::PendingTask* pending_task);
78 92
79 // Post a task to call DoWork() on the main task runner. 93 // Post a task to call DoWork() on the main task runner.
80 void PostDoWorkOnMainRunner(); 94 void PostDoWorkOnMainRunner();
81 95
(...skipping 27 matching lines...) Expand all
109 123
110 base::WeakPtr<TaskQueueManager> task_queue_manager_weak_ptr_; 124 base::WeakPtr<TaskQueueManager> task_queue_manager_weak_ptr_;
111 base::WeakPtrFactory<TaskQueueManager> weak_factory_; 125 base::WeakPtrFactory<TaskQueueManager> weak_factory_;
112 126
113 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); 127 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager);
114 }; 128 };
115 129
116 } // namespace content 130 } // namespace content
117 131
118 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ 132 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698