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

Side by Side Diff: content/renderer/scheduler/renderer_scheduler_impl.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_RENDERER_SCHEDULER_IMPL_H_ 5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_
6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
11 #include "content/renderer/scheduler/renderer_scheduler.h" 11 #include "content/renderer/scheduler/renderer_scheduler.h"
12 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" 12 #include "content/renderer/scheduler/single_thread_idle_task_runner.h"
13 #include "content/renderer/scheduler/task_queue_manager.h" 13 #include "content/renderer/scheduler/task_queue_manager.h"
14 14
15 namespace base {
16 namespace debug {
17 class ConvertableToTraceFormat;
18 }
19 }
20
15 namespace content { 21 namespace content {
16 22
17 class RendererSchedulerSelector; 23 class RendererSchedulerSelector;
18 24
19 class RendererSchedulerImpl : public RendererScheduler, 25 class RendererSchedulerImpl : public RendererScheduler,
20 private IdleTaskDeadlineSupplier { 26 private IdleTaskDeadlineSupplier {
21 public: 27 public:
22 RendererSchedulerImpl(); 28 RendererSchedulerImpl();
23 virtual ~RendererSchedulerImpl(); 29 virtual ~RendererSchedulerImpl();
24 30
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 kControlTaskQueue, 75 kControlTaskQueue,
70 // Must be the last entry. 76 // Must be the last entry.
71 kTaskQueueCount, 77 kTaskQueueCount,
72 }; 78 };
73 79
74 enum Policy { 80 enum Policy {
75 kNormalPriorityPolicy, 81 kNormalPriorityPolicy,
76 kCompositorPriorityPolicy, 82 kCompositorPriorityPolicy,
77 }; 83 };
78 84
85 // Returns the serialized scheduler state for tracing.
86 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueLocked() const;
87 static const char* TaskQueueIdToString(QueueId queue_id);
88 static const char* PolicyToString(Policy policy);
89
79 // The time we should stay in CompositorPriority mode for after a touch event. 90 // The time we should stay in CompositorPriority mode for after a touch event.
80 static const int kCompositorPriorityAfterTouchMillis = 100; 91 static const int kCompositorPriorityAfterTouchMillis = 100;
81 92
82 // Implementation of IdleTaskDeadlineSupplier 93 // Implementation of IdleTaskDeadlineSupplier
83 virtual base::TimeTicks CurrentIdleTaskDeadline() const override; 94 virtual base::TimeTicks CurrentIdleTaskDeadline() const override;
84 95
85 // Returns the current scheduler policy. This may involve updating the 96 // Returns the current scheduler policy. This may involve updating the
86 // current policy if a new signal has arrived. Must be called from the main 97 // current policy if a new signal has arrived. Must be called from the main
87 // thread. 98 // thread.
88 Policy SchedulerPolicy(); 99 Policy SchedulerPolicy();
(...skipping 15 matching lines...) Expand all
104 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; 115 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_;
105 116
106 // Don't access current_policy_ directly, instead use SchedulerPolicy(). 117 // Don't access current_policy_ directly, instead use SchedulerPolicy().
107 base::subtle::AtomicWord policy_may_need_update_; 118 base::subtle::AtomicWord policy_may_need_update_;
108 Policy current_policy_; 119 Policy current_policy_;
109 120
110 base::TimeTicks estimated_next_frame_begin_; 121 base::TimeTicks estimated_next_frame_begin_;
111 122
112 // The incoming_signals_lock_ mutex protects access to last_input_time_ 123 // The incoming_signals_lock_ mutex protects access to last_input_time_
113 // and write access to policy_may_need_update_. 124 // and write access to policy_may_need_update_.
114 base::Lock incoming_signals_lock_; 125 mutable base::Lock incoming_signals_lock_;
alexclarke 2014/10/27 17:58:11 Hmm I thought that AssertAcquired was const: http
Sami 2014/10/28 12:57:47 Oops, I added this since I was taking the lock ear
115 base::TimeTicks last_input_time_; 126 base::TimeTicks last_input_time_;
116 127
117 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; 128 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_;
118 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; 129 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_;
119 }; 130 };
120 131
121 } // namespace content 132 } // namespace content
122 133
123 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ 134 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698