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 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1851 return virtual_time_domain_.get(); | 1851 return virtual_time_domain_.get(); |
1852 } | 1852 } |
1853 | 1853 |
1854 void RendererSchedulerImpl::EnableVirtualTime() { | 1854 void RendererSchedulerImpl::EnableVirtualTime() { |
1855 GetMainThreadOnly().use_virtual_time = true; | 1855 GetMainThreadOnly().use_virtual_time = true; |
1856 | 1856 |
1857 // The |unthrottled_task_runners_| are not actively managed by UpdatePolicy(). | 1857 // The |unthrottled_task_runners_| are not actively managed by UpdatePolicy(). |
1858 AutoAdvancingVirtualTimeDomain* time_domain = GetVirtualTimeDomain(); | 1858 AutoAdvancingVirtualTimeDomain* time_domain = GetVirtualTimeDomain(); |
1859 for (const scoped_refptr<TaskQueue>& task_queue : unthrottled_task_runners_) | 1859 for (const scoped_refptr<TaskQueue>& task_queue : unthrottled_task_runners_) |
1860 task_queue->SetTimeDomain(time_domain); | 1860 task_queue->SetTimeDomain(time_domain); |
1861 control_task_runner_->SetTimeDomain(time_domain); | |
alex clarke (OOO till 29th)
2017/04/25 11:53:17
I'm a little nervous about that, generally we don'
Sami
2017/04/25 16:58:21
That's a great point, I agree that we should be a
| |
1861 | 1862 |
1862 ForceUpdatePolicy(); | 1863 ForceUpdatePolicy(); |
1863 } | 1864 } |
1864 | 1865 |
1865 void RendererSchedulerImpl::DisableVirtualTimeForTesting() { | 1866 void RendererSchedulerImpl::DisableVirtualTimeForTesting() { |
1866 GetMainThreadOnly().use_virtual_time = false; | 1867 GetMainThreadOnly().use_virtual_time = false; |
1867 | 1868 |
1868 RealTimeDomain* time_domain = real_time_domain(); | 1869 RealTimeDomain* time_domain = real_time_domain(); |
1869 // The |unthrottled_task_runners_| are not actively managed by UpdatePolicy(). | 1870 // The |unthrottled_task_runners_| are not actively managed by UpdatePolicy(). |
1870 for (const scoped_refptr<TaskQueue>& task_queue : unthrottled_task_runners_) | 1871 for (const scoped_refptr<TaskQueue>& task_queue : unthrottled_task_runners_) |
1871 task_queue->SetTimeDomain(time_domain); | 1872 task_queue->SetTimeDomain(time_domain); |
1873 control_task_runner_->SetTimeDomain(time_domain); | |
1872 | 1874 |
1873 ForceUpdatePolicy(); | 1875 ForceUpdatePolicy(); |
1874 } | 1876 } |
1875 | 1877 |
1876 bool RendererSchedulerImpl::ShouldDisableThrottlingBecauseOfAudio( | 1878 bool RendererSchedulerImpl::ShouldDisableThrottlingBecauseOfAudio( |
1877 base::TimeTicks now) { | 1879 base::TimeTicks now) { |
1878 if (!GetMainThreadOnly().last_audio_state_change) | 1880 if (!GetMainThreadOnly().last_audio_state_change) |
1879 return false; | 1881 return false; |
1880 | 1882 |
1881 if (GetMainThreadOnly().is_audio_playing) | 1883 if (GetMainThreadOnly().is_audio_playing) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1951 case TimeDomainType::VIRTUAL: | 1953 case TimeDomainType::VIRTUAL: |
1952 return "virtual"; | 1954 return "virtual"; |
1953 default: | 1955 default: |
1954 NOTREACHED(); | 1956 NOTREACHED(); |
1955 return nullptr; | 1957 return nullptr; |
1956 } | 1958 } |
1957 } | 1959 } |
1958 | 1960 |
1959 } // namespace scheduler | 1961 } // namespace scheduler |
1960 } // namespace blink | 1962 } // namespace blink |
OLD | NEW |