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

Unified Diff: content/browser/renderer_host/render_process_host_impl.h

Issue 2655413004: Strip out stream counting from AudioRendererHost. (Closed)
Patch Set: Created 3 years, 11 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/browser/renderer_host/render_process_host_impl.h
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index dc269f22f81e0de9e99767e95c6d651588c93ff4..df64f9219bde3ea510acad90a5765668b666f9a8 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -32,6 +32,7 @@
#include "content/public/common/service_manager_connection.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_platform_file.h"
+#include "media/audio/audio_streams_tracker.h"
#include "media/media_features.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/associated_binding_set.h"
@@ -123,7 +124,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
void WidgetRestored() override;
void WidgetHidden() override;
int VisibleWidgetCount() const override;
- void AudioStateChanged() override;
bool IsForGuestsOnly() const override;
StoragePartition* GetStoragePartition() const override;
bool Shutdown(int exit_code, bool wait) override;
@@ -287,6 +287,15 @@ class CONTENT_EXPORT RenderProcessHostImpl
void RecomputeAndUpdateWebKitPreferences();
+ // Called when an audio stream is added or removed and used to determine if
+ // the process should be backgrounded or not.
+ //
+ // TODO(dalecurtis, maxmorin): Currently this only checks if a stream is
+ // playing or not, but instead it should be based on if the stream is audible
+ // or not.
+ void OnAudioStreamAdded();
+ void OnAudioStreamRemoved();
+
protected:
// A proxy for our IPC::Channel that lives on the IO thread.
std::unique_ptr<IPC::ChannelProxy> channel_;
@@ -599,6 +608,10 @@ class CONTENT_EXPORT RenderProcessHostImpl
mojom::RouteProviderAssociatedPtr remote_route_provider_;
mojom::RendererAssociatedPtr renderer_interface_;
+ // Tracks active audio streams within the render process; used to determine if
+ // if a process should be backgrounded.
+ media::AudioStreamsTracker audio_streams_tracker_;
+
// A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend
// WeakPtrs which are invalidated any time the RPHI is recycled.
std::unique_ptr<base::WeakPtrFactory<RenderProcessHostImpl>>

Powered by Google App Engine
This is Rietveld 408576698