| 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 "content/renderer/pepper/plugin_instance_throttler_impl.h" | 5 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 7 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 9 #include "content/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
| 10 #include "content/public/renderer/render_thread.h" | 11 #include "content/public/renderer/render_thread.h" |
| 11 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 12 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 12 #include "content/renderer/render_frame_impl.h" | 13 #include "content/renderer/render_frame_impl.h" |
| 13 #include "ppapi/shared_impl/ppapi_constants.h" | 14 #include "ppapi/shared_impl/ppapi_constants.h" |
| 14 #include "third_party/WebKit/public/platform/WebRect.h" | 15 #include "third_party/WebKit/public/platform/WebRect.h" |
| 15 #include "third_party/WebKit/public/web/WebInputEvent.h" | 16 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 16 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 33 // video frames. We use this timeout to prevent waiting forever for a good | 34 // video frames. We use this timeout to prevent waiting forever for a good |
| 34 // poster image. Chosen arbitrarily. | 35 // poster image. Chosen arbitrarily. |
| 35 const int kAudioThrottledFrameTimeoutMilliseconds = 500; | 36 const int kAudioThrottledFrameTimeoutMilliseconds = 500; |
| 36 | 37 |
| 37 } // namespace | 38 } // namespace |
| 38 | 39 |
| 39 // static | 40 // static |
| 40 const int PluginInstanceThrottlerImpl::kMaximumFramesToExamine = 150; | 41 const int PluginInstanceThrottlerImpl::kMaximumFramesToExamine = 150; |
| 41 | 42 |
| 42 // static | 43 // static |
| 43 scoped_ptr<PluginInstanceThrottler> PluginInstanceThrottler::Create() { | 44 std::unique_ptr<PluginInstanceThrottler> PluginInstanceThrottler::Create() { |
| 44 return make_scoped_ptr(new PluginInstanceThrottlerImpl); | 45 return base::WrapUnique(new PluginInstanceThrottlerImpl); |
| 45 } | 46 } |
| 46 | 47 |
| 47 // static | 48 // static |
| 48 void PluginInstanceThrottler::RecordUnthrottleMethodMetric( | 49 void PluginInstanceThrottler::RecordUnthrottleMethodMetric( |
| 49 PluginInstanceThrottlerImpl::PowerSaverUnthrottleMethod method) { | 50 PluginInstanceThrottlerImpl::PowerSaverUnthrottleMethod method) { |
| 50 UMA_HISTOGRAM_ENUMERATION( | 51 UMA_HISTOGRAM_ENUMERATION( |
| 51 "Plugin.PowerSaver.Unthrottle", method, | 52 "Plugin.PowerSaver.Unthrottle", method, |
| 52 PluginInstanceThrottler::UNTHROTTLE_METHOD_NUM_ITEMS); | 53 PluginInstanceThrottler::UNTHROTTLE_METHOD_NUM_ITEMS); |
| 53 } | 54 } |
| 54 | 55 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 215 |
| 215 // Release our reference to the underlying pixel data. | 216 // Release our reference to the underlying pixel data. |
| 216 last_received_frame_.reset(); | 217 last_received_frame_.reset(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 state_ = THROTTLER_STATE_PLUGIN_THROTTLED; | 220 state_ = THROTTLER_STATE_PLUGIN_THROTTLED; |
| 220 FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange()); | 221 FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange()); |
| 221 } | 222 } |
| 222 | 223 |
| 223 } // namespace content | 224 } // namespace content |
| OLD | NEW |