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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 base::TimeDelta::FromMinutes(2); | 48 base::TimeDelta::FromMinutes(2); |
49 // We do not throttle anything while audio is played and shortly after that. | 49 // We do not throttle anything while audio is played and shortly after that. |
50 constexpr base::TimeDelta kThrottlingDelayAfterAudioIsPlayed = | 50 constexpr base::TimeDelta kThrottlingDelayAfterAudioIsPlayed = |
51 base::TimeDelta::FromSeconds(5); | 51 base::TimeDelta::FromSeconds(5); |
52 | 52 |
53 void ReportForegroundRendererTaskLoad(base::TimeTicks time, double load) { | 53 void ReportForegroundRendererTaskLoad(base::TimeTicks time, double load) { |
54 if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) | 54 if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) |
55 return; | 55 return; |
56 | 56 |
57 int load_percentage = static_cast<int>(load * 100); | 57 int load_percentage = static_cast<int>(load * 100); |
58 DCHECK_LE(load_percentage, 100); | 58 // TODO(altimin): Revert back to DCHECK. |
| 59 CHECK_LE(load_percentage, 100); |
59 | 60 |
60 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.ForegroundRendererMainThreadLoad", | 61 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.ForegroundRendererMainThreadLoad", |
61 load_percentage); | 62 load_percentage); |
62 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 63 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
63 "RendererScheduler.ForegroundRendererLoad", load_percentage); | 64 "RendererScheduler.ForegroundRendererLoad", load_percentage); |
64 } | 65 } |
65 | 66 |
66 void ReportBackgroundRendererTaskLoad(base::TimeTicks time, double load) { | 67 void ReportBackgroundRendererTaskLoad(base::TimeTicks time, double load) { |
67 if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) | 68 if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) |
68 return; | 69 return; |
69 | 70 |
70 int load_percentage = static_cast<int>(load * 100); | 71 int load_percentage = static_cast<int>(load * 100); |
71 DCHECK_LE(load_percentage, 100); | 72 // TODO(altimin): Revert back to DCHECK. |
| 73 CHECK_LE(load_percentage, 100); |
72 | 74 |
73 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.BackgroundRendererMainThreadLoad", | 75 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.BackgroundRendererMainThreadLoad", |
74 load_percentage); | 76 load_percentage); |
75 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 77 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
76 "RendererScheduler.BackgroundRendererLoad", load_percentage); | 78 "RendererScheduler.BackgroundRendererLoad", load_percentage); |
77 } | 79 } |
78 | 80 |
79 base::TimeTicks MonotonicTimeInSecondsToTimeTicks( | 81 base::TimeTicks MonotonicTimeInSecondsToTimeTicks( |
80 double monotonicTimeInSeconds) { | 82 double monotonicTimeInSeconds) { |
81 return base::TimeTicks() + | 83 return base::TimeTicks() + |
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 case TimeDomainType::VIRTUAL: | 1900 case TimeDomainType::VIRTUAL: |
1899 return "virtual"; | 1901 return "virtual"; |
1900 default: | 1902 default: |
1901 NOTREACHED(); | 1903 NOTREACHED(); |
1902 return nullptr; | 1904 return nullptr; |
1903 } | 1905 } |
1904 } | 1906 } |
1905 | 1907 |
1906 } // namespace scheduler | 1908 } // namespace scheduler |
1907 } // namespace blink | 1909 } // namespace blink |
OLD | NEW |