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

Unified Diff: content/renderer/pepper/ppb_audio_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/ppb_audio_impl.h
diff --git a/content/renderer/pepper/ppb_audio_impl.h b/content/renderer/pepper/ppb_audio_impl.h
index 3348527028e7e327418c3bf2ed306adb3bd4cf3d..6c0af8f90fbf3222f73c5e188463e6a600ec270b 100644
--- a/content/renderer/pepper/ppb_audio_impl.h
+++ b/content/renderer/pepper/ppb_audio_impl.h
@@ -9,6 +9,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/shared_memory.h"
#include "base/sync_socket.h"
+#include "content/public/renderer/plugin_instance_throttler.h"
#include "content/renderer/pepper/audio_helper.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/ppb_audio.h"
@@ -28,7 +29,8 @@ class PepperPlatformAudioOutput;
// to look more like typical HostResource implementations.
class PPB_Audio_Impl : public ppapi::Resource,
public ppapi::PPB_Audio_Shared,
- public AudioHelper {
+ public AudioHelper,
+ public PluginInstanceThrottler::Observer {
public:
explicit PPB_Audio_Impl(PP_Instance instance);
@@ -52,6 +54,12 @@ class PPB_Audio_Impl : public ppapi::Resource,
size_t shared_memory_size_,
base::SyncSocket::Handle socket) override;
+ // PluginInstanceThrottler::Observer implementation.
+ void OnThrottleStateChange() override;
+
+ // Starts the deferred playback and unsubscribes from the throttler.
+ void StartDeferredPlayback();
+
// AudioConfig used for creating this Audio object. We own a ref.
ppapi::ScopedPPResource config_;
@@ -59,6 +67,9 @@ class PPB_Audio_Impl : public ppapi::Resource,
// own this pointer but are responsible for calling Shutdown on it.
PepperPlatformAudioOutput* audio_;
+ // Stream is playing, but throttled due to Plugin Power Saver.
+ bool playback_throttled_;
+
DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Impl);
};
« no previous file with comments | « content/renderer/pepper/plugin_instance_throttler_impl.cc ('k') | content/renderer/pepper/ppb_audio_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698