Index: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h |
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h |
index bc0c3d61673941d281a437980f1da94c676af044..f43c1beacbd0364e6b3d90184e2907a29beb872e 100644 |
--- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h |
+++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h |
@@ -8,6 +8,7 @@ |
#include "base/atomicops.h" |
#include "base/macros.h" |
#include "base/synchronization/lock.h" |
+#include "device/base/synchronization/shared_memory_seqlock_buffer.h" |
#include "platform/scheduler/base/pollable_thread_safe_flag.h" |
#include "platform/scheduler/base/queueing_time_estimator.h" |
#include "platform/scheduler/base/thread_load_tracker.h" |
@@ -122,6 +123,7 @@ class BLINK_PLATFORM_EXPORT RendererSchedulerImpl |
void SetTopLevelBlameContext( |
base::trace_event::BlameContext* blame_context) override; |
void SetRAILModeObserver(RAILModeObserver* observer) override; |
+ bool MainThreadSeemsUnresponsive() override; |
// RenderWidgetSignals::Observer implementation: |
void SetAllRenderWidgetsHidden(bool hidden) override; |
@@ -134,9 +136,10 @@ class BLINK_PLATFORM_EXPORT RendererSchedulerImpl |
const base::PendingTask& task) override; |
// TaskTimeObserver implementation: |
- void ReportTaskTime(TaskQueue* task_queue, |
- double start_time, |
- double end_time) override; |
+ void ReportTaskStartTime(double start_time) override; |
+ void ReportTaskEndTime(TaskQueue* task_queue, |
+ double start_time, |
+ double end_time) override; |
// QueueingTimeEstimator::Client implementation: |
void OnQueueingTimeForWindowEstimated(base::TimeDelta queueing_time) override; |
@@ -378,6 +381,11 @@ class BLINK_PLATFORM_EXPORT RendererSchedulerImpl |
CancelableClosureHolder end_renderer_hidden_idle_period_closure_; |
CancelableClosureHolder suspend_timers_when_backgrounded_closure_; |
+ using SeqLockQueueingTimeEstimator = |
+ device::SharedMemorySeqLockBuffer<QueueingTimeEstimator>; |
+ |
+ SeqLockQueueingTimeEstimator seqlock_queueing_time_estimator_; |
Sami
2016/11/14 21:16:45
Please add a short note here saying that this only
tdresser
2016/12/15 13:17:00
Why do you say it only protects access to the data
Sami
2016/12/15 17:54:37
I'm a little fuzzy on what I was going for here, b
tdresser
2016/12/15 19:16:09
Done.
|
+ |
// We have decided to improve thread safety at the cost of some boilerplate |
// (the accessors) for the following data members. |
@@ -390,7 +398,6 @@ class BLINK_PLATFORM_EXPORT RendererSchedulerImpl |
TaskCostEstimator loading_task_cost_estimator; |
TaskCostEstimator timer_task_cost_estimator; |
- QueueingTimeEstimator queueing_time_estimator; |
IdleTimeEstimator idle_time_estimator; |
ThreadLoadTracker background_main_thread_load_tracker; |
ThreadLoadTracker foreground_main_thread_load_tracker; |
@@ -398,6 +405,7 @@ class BLINK_PLATFORM_EXPORT RendererSchedulerImpl |
Policy current_policy; |
base::TimeTicks current_policy_expiration_time; |
base::TimeTicks estimated_next_frame_begin; |
+ base::TimeTicks current_task_start_time; |
base::TimeDelta compositor_frame_interval; |
base::TimeDelta longest_jank_free_task_duration; |
base::Optional<base::TimeTicks> last_audio_state_change; |
@@ -426,7 +434,7 @@ class BLINK_PLATFORM_EXPORT RendererSchedulerImpl |
}; |
struct AnyThread { |
- AnyThread(); |
+ AnyThread(RendererSchedulerImpl* renderer_scheduler_impl); |
alex clarke (OOO till 29th)
2016/11/14 17:00:17
explicit
tdresser
2016/12/15 13:17:00
Done.
|
~AnyThread(); |
base::TimeTicks last_idle_period_end_time; |
@@ -446,6 +454,7 @@ class BLINK_PLATFORM_EXPORT RendererSchedulerImpl |
~CompositorThreadOnly(); |
WebInputEvent::Type last_input_type; |
+ bool main_thread_seems_unresponsive; |
std::unique_ptr<base::ThreadChecker> compositor_thread_checker; |
void CheckOnValidThread() { |
@@ -490,6 +499,10 @@ class BLINK_PLATFORM_EXPORT RendererSchedulerImpl |
} |
PollableThreadSafeFlag policy_may_need_update_; |
+ // The maximum expected queueing time before the main thread is considered |
+ // unresponsive. |
+ base::TimeDelta main_thread_responsiveness_threshold_; |
Sami
2016/11/14 21:16:45
Do you still need this given the constant is a Tim
tdresser
2016/12/15 13:17:00
There's nothing worse than trying to land a change
|
+ |
base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |