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