Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: content/renderer/pepper/plugin_instance_throttler_impl.h

Issue 879403002: Plugin Power Saver: Mute throttled plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove hack used for testing. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/plugin_instance_throttler_impl.h
diff --git a/content/renderer/pepper/plugin_instance_throttler_impl.h b/content/renderer/pepper/plugin_instance_throttler_impl.h
index b223cd26b613c65c5de327ad5676ec3b2e98e553..0bcad2f60dcade53727b175c2fac0b4ac3694803 100644
--- a/content/renderer/pepper/plugin_instance_throttler_impl.h
+++ b/content/renderer/pepper/plugin_instance_throttler_impl.h
@@ -8,9 +8,11 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
+#include "base/timer/timer.h"
#include "content/common/content_export.h"
#include "content/public/renderer/plugin_instance_throttler.h"
#include "ppapi/shared_impl/ppb_view_shared.h"
+#include "third_party/skia/include/core/SkBitmap.h"
namespace blink {
class WebInputEvent;
@@ -36,6 +38,7 @@ class CONTENT_EXPORT PluginInstanceThrottlerImpl
void MarkPluginEssential(PowerSaverUnthrottleMethod method) override;
void SetHiddenForPlaceholder(bool hidden) override;
blink::WebPlugin* GetWebPlugin() const override;
+ void NotifyAudioThrottled() override;
void SetWebPlugin(blink::WebPlugin* web_plugin);
@@ -80,6 +83,7 @@ class CONTENT_EXPORT PluginInstanceThrottlerImpl
// simply suspend the plugin where it's at. Chosen arbitrarily.
static const int kMaximumFramesToExamine;
+ void AudioThrottledFrameTimeout();
void EngageThrottle();
ThrottlerState state_;
@@ -88,12 +92,21 @@ class CONTENT_EXPORT PluginInstanceThrottlerImpl
blink::WebPlugin* web_plugin_;
+ // Holds a reference to the last received frame. This doesn't actually copy
+ // the pixel data, but rather increments the reference count to the pixels.
+ SkBitmap last_received_frame_;
+
// Number of consecutive interesting frames we've encountered.
int consecutive_interesting_frames_;
// Number of frames we've examined to find a keyframe.
int frames_examined_;
+ // Video plugins with throttled audio often stop generating frames.
+ // This timer is so we don't wait forever for candidate poster frames.
+ bool audio_throttled_;
+ base::DelayTimer<PluginInstanceThrottlerImpl> audio_throttled_frame_timeout_;
+
ObserverList<Observer> observer_list_;
base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_;
« no previous file with comments | « content/public/renderer/plugin_instance_throttler.h ('k') | content/renderer/pepper/plugin_instance_throttler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698