| 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 // TODO(altimin): Revert back to DCHECK. | 58 DCHECK_LE(load_percentage, 100); |
| 59 CHECK_LE(load_percentage, 100); | |
| 60 | 59 |
| 61 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.ForegroundRendererMainThreadLoad", | 60 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.ForegroundRendererMainThreadLoad", |
| 62 load_percentage); | 61 load_percentage); |
| 63 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 62 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 64 "RendererScheduler.ForegroundRendererLoad", load_percentage); | 63 "RendererScheduler.ForegroundRendererLoad", load_percentage); |
| 65 } | 64 } |
| 66 | 65 |
| 67 void ReportBackgroundRendererTaskLoad(base::TimeTicks time, double load) { | 66 void ReportBackgroundRendererTaskLoad(base::TimeTicks time, double load) { |
| 68 if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) | 67 if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) |
| 69 return; | 68 return; |
| 70 | 69 |
| 71 int load_percentage = static_cast<int>(load * 100); | 70 int load_percentage = static_cast<int>(load * 100); |
| 72 // TODO(altimin): Revert back to DCHECK. | 71 DCHECK_LE(load_percentage, 100); |
| 73 CHECK_LE(load_percentage, 100); | |
| 74 | 72 |
| 75 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.BackgroundRendererMainThreadLoad", | 73 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.BackgroundRendererMainThreadLoad", |
| 76 load_percentage); | 74 load_percentage); |
| 77 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 75 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 78 "RendererScheduler.BackgroundRendererLoad", load_percentage); | 76 "RendererScheduler.BackgroundRendererLoad", load_percentage); |
| 79 } | 77 } |
| 80 | 78 |
| 81 base::TimeTicks MonotonicTimeInSecondsToTimeTicks( | 79 base::TimeTicks MonotonicTimeInSecondsToTimeTicks( |
| 82 double monotonicTimeInSeconds) { | 80 double monotonicTimeInSeconds) { |
| 83 return base::TimeTicks() + | 81 return base::TimeTicks() + |
| (...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 case TimeDomainType::VIRTUAL: | 1898 case TimeDomainType::VIRTUAL: |
| 1901 return "virtual"; | 1899 return "virtual"; |
| 1902 default: | 1900 default: |
| 1903 NOTREACHED(); | 1901 NOTREACHED(); |
| 1904 return nullptr; | 1902 return nullptr; |
| 1905 } | 1903 } |
| 1906 } | 1904 } |
| 1907 | 1905 |
| 1908 } // namespace scheduler | 1906 } // namespace scheduler |
| 1909 } // namespace blink | 1907 } // namespace blink |
| OLD | NEW |