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

Unified Diff: content/browser/media/audio_stream_monitor.h

Issue 1591453005: Add metrics regarding concurrent audible tabs in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: user action and tick Created 4 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/media/audio_stream_monitor.h
diff --git a/content/browser/media/audio_stream_monitor.h b/content/browser/media/audio_stream_monitor.h
index 0eb51475fbff57067602d16127458f6ab68fe312..12f06055c54970fda0d454eae788c1a6346439aa 100644
--- a/content/browser/media/audio_stream_monitor.h
+++ b/content/browser/media/audio_stream_monitor.h
@@ -52,6 +52,11 @@ class CONTENT_EXPORT AudioStreamMonitor {
// the killing of tabs making sounds).
bool WasRecentlyAudible() const;
+ // Returns true if the audio is currently audible from the given WebContents.
+ // The difference from WasRecentlyAudible() is that this method will return
+ // false as soon as the WebContents stop producing sound.
+ bool IsCurrentlyAudible() const;
+
// Starts or stops audio level monitoring respectively for the stream owned by
// the specified renderer. Safe to call from any thread.
//
@@ -139,6 +144,9 @@ class CONTENT_EXPORT AudioStreamMonitor {
// should be turned on.
bool was_recently_audible_;
+ // Whether the WebContents is currently audible.
+ bool is_audible_;
+
// Calls Poll() at regular intervals while |poll_callbacks_| is non-empty.
base::RepeatingTimer poll_timer_;

Powered by Google App Engine
This is Rietveld 408576698