| Index: content/renderer/pepper/plugin_instance_throttler_impl.cc
|
| diff --git a/content/renderer/pepper/plugin_instance_throttler_impl.cc b/content/renderer/pepper/plugin_instance_throttler_impl.cc
|
| index a95f6db47aef47039b6c9696a87917f53b36f5da..d2766611cf195a30a9e814ab79a61cf2ce2f3d2d 100644
|
| --- a/content/renderer/pepper/plugin_instance_throttler_impl.cc
|
| +++ b/content/renderer/pepper/plugin_instance_throttler_impl.cc
|
| @@ -60,6 +60,7 @@ PluginInstanceThrottlerImpl::PluginInstanceThrottlerImpl(
|
| : state_(power_saver_enabled ? POWER_SAVER_ENABLED_AWAITING_KEYFRAME
|
| : POWER_SAVER_DISABLED),
|
| consecutive_interesting_frames_(0),
|
| + keyframe_extraction_timed_out_(false),
|
| weak_factory_(this) {
|
| // To collect UMAs, register peripheral content even if power saver disabled.
|
| if (frame) {
|
| @@ -71,13 +72,15 @@ PluginInstanceThrottlerImpl::PluginInstanceThrottlerImpl(
|
|
|
| if (power_saver_enabled) {
|
| base::MessageLoop::current()->PostDelayedTask(
|
| - FROM_HERE, base::Bind(&PluginInstanceThrottlerImpl::EngageThrottle,
|
| - weak_factory_.GetWeakPtr()),
|
| + FROM_HERE,
|
| + base::Bind(&PluginInstanceThrottlerImpl::TimeoutKeyframeExtraction,
|
| + weak_factory_.GetWeakPtr()),
|
| base::TimeDelta::FromMilliseconds(kThrottleTimeout));
|
| }
|
| }
|
|
|
| PluginInstanceThrottlerImpl::~PluginInstanceThrottlerImpl() {
|
| + FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottlerDestroyed());
|
| if (state_ != PLUGIN_INSTANCE_MARKED_ESSENTIAL)
|
| RecordUnthrottleMethodMetric(UNTHROTTLE_METHOD_NEVER);
|
| }
|
| @@ -107,6 +110,10 @@ void PluginInstanceThrottlerImpl::MarkPluginEssential(
|
| FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange());
|
| }
|
|
|
| +void PluginInstanceThrottlerImpl::SetHiddenForPlaceholder(bool hidden) {
|
| + FOR_EACH_OBSERVER(Observer, observer_list_, OnHiddenForPlaceholder(hidden));
|
| +}
|
| +
|
| void PluginInstanceThrottlerImpl::OnImageFlush(const SkBitmap* bitmap) {
|
| DCHECK(needs_representative_keyframe());
|
| if (!bitmap)
|
| @@ -118,8 +125,11 @@ void PluginInstanceThrottlerImpl::OnImageFlush(const SkBitmap* bitmap) {
|
| else
|
| consecutive_interesting_frames_ = 0;
|
|
|
| - if (consecutive_interesting_frames_ >= kMinimumConsecutiveInterestingFrames)
|
| + if (keyframe_extraction_timed_out_ ||
|
| + consecutive_interesting_frames_ >= kMinimumConsecutiveInterestingFrames) {
|
| + FOR_EACH_OBSERVER(Observer, observer_list_, OnKeyframeExtracted(bitmap));
|
| EngageThrottle();
|
| + }
|
| }
|
|
|
| bool PluginInstanceThrottlerImpl::ConsumeInputEvent(
|
| @@ -150,4 +160,8 @@ void PluginInstanceThrottlerImpl::EngageThrottle() {
|
| FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange());
|
| }
|
|
|
| +void PluginInstanceThrottlerImpl::TimeoutKeyframeExtraction() {
|
| + keyframe_extraction_timed_out_ = true;
|
| +}
|
| +
|
| } // namespace content
|
|
|