Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 compositor_task_queue_( | 99 compositor_task_queue_( |
| 100 helper_.NewTaskQueue(TaskQueue::Spec(TaskQueue::QueueType::COMPOSITOR) | 100 helper_.NewTaskQueue(TaskQueue::Spec(TaskQueue::QueueType::COMPOSITOR) |
| 101 .SetShouldMonitorQuiescence(true))), | 101 .SetShouldMonitorQuiescence(true))), |
| 102 compositor_task_queue_enabled_voter_( | 102 compositor_task_queue_enabled_voter_( |
| 103 compositor_task_queue_->CreateQueueEnabledVoter()), | 103 compositor_task_queue_->CreateQueueEnabledVoter()), |
| 104 delayed_update_policy_runner_( | 104 delayed_update_policy_runner_( |
| 105 base::Bind(&RendererSchedulerImpl::UpdatePolicy, | 105 base::Bind(&RendererSchedulerImpl::UpdatePolicy, |
| 106 base::Unretained(this)), | 106 base::Unretained(this)), |
| 107 helper_.ControlTaskQueue()), | 107 helper_.ControlTaskQueue()), |
| 108 seqlock_queueing_time_estimator_( | 108 seqlock_queueing_time_estimator_( |
| 109 QueueingTimeEstimator(this, base::TimeDelta::FromSeconds(1))), | 109 QueueingTimeEstimator(this, base::TimeDelta::FromSeconds(1), 1)), |
|
tdresser
2017/05/08 17:58:15
We'll want this to behave the same with a step siz
Liquan (Max) Gu
2017/05/10 15:14:21
Does 5 steps per window sound good?
tdresser
2017/05/10 18:54:31
Hmmm. Eventually, we'll want something much greate
| |
| 110 main_thread_only_(this, | 110 main_thread_only_(this, |
| 111 compositor_task_queue_, | 111 compositor_task_queue_, |
| 112 helper_.scheduler_tqm_delegate().get(), | 112 helper_.scheduler_tqm_delegate().get(), |
| 113 helper_.scheduler_tqm_delegate()->NowTicks()), | 113 helper_.scheduler_tqm_delegate()->NowTicks()), |
| 114 policy_may_need_update_(&any_thread_lock_), | 114 policy_may_need_update_(&any_thread_lock_), |
| 115 weak_factory_(this) { | 115 weak_factory_(this) { |
| 116 task_queue_throttler_.reset(new TaskQueueThrottler(this)); | 116 task_queue_throttler_.reset(new TaskQueueThrottler(this)); |
| 117 update_policy_closure_ = base::Bind(&RendererSchedulerImpl::UpdatePolicy, | 117 update_policy_closure_ = base::Bind(&RendererSchedulerImpl::UpdatePolicy, |
| 118 weak_factory_.GetWeakPtr()); | 118 weak_factory_.GetWeakPtr()); |
| 119 end_renderer_hidden_idle_period_closure_.Reset(base::Bind( | 119 end_renderer_hidden_idle_period_closure_.Reset(base::Bind( |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1663 void RendererSchedulerImpl::SetRAILModeObserver(RAILModeObserver* observer) { | 1663 void RendererSchedulerImpl::SetRAILModeObserver(RAILModeObserver* observer) { |
| 1664 GetMainThreadOnly().rail_mode_observer = observer; | 1664 GetMainThreadOnly().rail_mode_observer = observer; |
| 1665 } | 1665 } |
| 1666 | 1666 |
| 1667 bool RendererSchedulerImpl::MainThreadSeemsUnresponsive( | 1667 bool RendererSchedulerImpl::MainThreadSeemsUnresponsive( |
| 1668 base::TimeDelta main_thread_responsiveness_threshold) { | 1668 base::TimeDelta main_thread_responsiveness_threshold) { |
| 1669 base::TimeTicks now = tick_clock()->NowTicks(); | 1669 base::TimeTicks now = tick_clock()->NowTicks(); |
| 1670 base::TimeDelta estimated_queueing_time; | 1670 base::TimeDelta estimated_queueing_time; |
| 1671 | 1671 |
| 1672 bool can_read = false; | 1672 bool can_read = false; |
| 1673 QueueingTimeEstimator::State queueing_time_estimator_state; | 1673 QueueingTimeEstimator::State queueing_time_estimator_state(1); |
|
tdresser
2017/05/08 17:58:14
Same as above.
Liquan (Max) Gu
2017/05/10 15:14:21
It seems unnecessary to define it seperately.
tdresser
2017/05/10 18:54:31
Acknowledged.
| |
| 1674 | 1674 |
| 1675 base::subtle::Atomic32 version; | 1675 base::subtle::Atomic32 version; |
| 1676 seqlock_queueing_time_estimator_.seqlock.TryRead(&can_read, &version); | 1676 seqlock_queueing_time_estimator_.seqlock.TryRead(&can_read, &version); |
| 1677 | 1677 |
| 1678 // If we fail to determine if the main thread is busy, assume whether or not | 1678 // If we fail to determine if the main thread is busy, assume whether or not |
| 1679 // it's busy hasn't change since the last time we asked. | 1679 // it's busy hasn't change since the last time we asked. |
| 1680 if (!can_read) | 1680 if (!can_read) |
| 1681 return GetCompositorThreadOnly().main_thread_seems_unresponsive; | 1681 return GetCompositorThreadOnly().main_thread_seems_unresponsive; |
| 1682 | 1682 |
| 1683 queueing_time_estimator_state = | 1683 queueing_time_estimator_state = |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1957 case TimeDomainType::VIRTUAL: | 1957 case TimeDomainType::VIRTUAL: |
| 1958 return "virtual"; | 1958 return "virtual"; |
| 1959 default: | 1959 default: |
| 1960 NOTREACHED(); | 1960 NOTREACHED(); |
| 1961 return nullptr; | 1961 return nullptr; |
| 1962 } | 1962 } |
| 1963 } | 1963 } |
| 1964 | 1964 |
| 1965 } // namespace scheduler | 1965 } // namespace scheduler |
| 1966 } // namespace blink | 1966 } // namespace blink |
| OLD | NEW |