Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/public/renderer/plugin_instance_throttler.h" | 5 #include "content/public/renderer/plugin_instance_throttler.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | |
| 7 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" | 8 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" |
| 8 | 9 |
| 9 namespace content { | 10 namespace content { |
| 10 | 11 |
| 12 namespace { | |
| 13 | |
| 14 const char kPowerSaverUnthrottleHistogram[] = "Plugin.PowerSaver.Unthrottle"; | |
|
Bernhard Bauer
2015/01/23 11:24:59
Add an empty line after this one? Alternatively, t
tommycli
2015/01/23 18:05:59
Done.
| |
| 15 } | |
| 16 | |
| 11 // static | 17 // static |
| 12 scoped_ptr<PluginInstanceThrottler> PluginInstanceThrottler::Get( | 18 scoped_ptr<PluginInstanceThrottler> PluginInstanceThrottler::Get( |
| 13 RenderFrame* frame, | 19 RenderFrame* frame, |
| 14 const GURL& plugin_url, | 20 const GURL& plugin_url, |
| 15 PluginPowerSaverMode power_saver_mode) { | 21 PluginPowerSaverMode power_saver_mode) { |
| 16 if (power_saver_mode == PluginPowerSaverMode::POWER_SAVER_MODE_ESSENTIAL) | 22 if (power_saver_mode == PluginPowerSaverMode::POWER_SAVER_MODE_ESSENTIAL) |
| 17 return nullptr; | 23 return nullptr; |
| 18 | 24 |
| 19 bool power_saver_enabled = | 25 bool power_saver_enabled = |
| 20 power_saver_mode == | 26 power_saver_mode == |
| 21 PluginPowerSaverMode::POWER_SAVER_MODE_PERIPHERAL_THROTTLED; | 27 PluginPowerSaverMode::POWER_SAVER_MODE_PERIPHERAL_THROTTLED; |
| 22 return make_scoped_ptr( | 28 return make_scoped_ptr( |
| 23 new PluginInstanceThrottlerImpl(frame, plugin_url, power_saver_enabled)); | 29 new PluginInstanceThrottlerImpl(frame, plugin_url, power_saver_enabled)); |
| 24 } | 30 } |
| 25 | 31 |
| 32 // static | |
| 33 void PluginInstanceThrottler::RecordUnthrottleMethodMetric( | |
| 34 PluginInstanceThrottlerImpl::PowerSaverUnthrottleMethod method) { | |
| 35 UMA_HISTOGRAM_ENUMERATION( | |
| 36 kPowerSaverUnthrottleHistogram, method, | |
| 37 PluginInstanceThrottler::UNTHROTTLE_METHOD_NUM_ITEMS); | |
| 38 } | |
| 39 | |
| 26 } // namespace content | 40 } // namespace content |
|
Bernhard Bauer
2015/01/23 11:24:59
Now that I look at this: The contents of this file
tommycli
2015/01/23 18:05:59
Done.
| |
| OLD | NEW |