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

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

Issue 2698813007: Fix teardown of stale AudioStreamMonitor poll callbacks. (Closed)
Patch Set: Always store callbacks, fix tests. Created 3 years, 10 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
« no previous file with comments | « no previous file | content/browser/media/audio_stream_monitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ced46683efbfb3dcf17b91245bd65ac183fde2f4..f925c91ebe13af336480b91c1ad01c43faabb37f 100644
--- a/content/browser/media/audio_stream_monitor.h
+++ b/content/browser/media/audio_stream_monitor.h
@@ -54,6 +54,10 @@ class CONTENT_EXPORT AudioStreamMonitor {
// false as soon as the WebContents stop producing sound.
bool IsCurrentlyAudible() const;
+ // Called by the WebContentsImpl if |render_process_id| dies; used to clear
+ // any outstanding poll callbacks.
+ void RenderProcessGone(int render_process_id);
+
// Starts or stops audio level monitoring respectively for the stream owned by
// the specified renderer. Safe to call from any thread.
//
@@ -142,8 +146,8 @@ class CONTENT_EXPORT AudioStreamMonitor {
// The callbacks to read power levels for each stream. Only playing (i.e.,
// not paused) streams will have an entry in this map.
- typedef std::pair<int, int> StreamID;
- typedef std::map<StreamID, ReadPowerAndClipCallback> StreamPollCallbackMap;
+ using StreamID = std::pair<int, int>;
+ using StreamPollCallbackMap = std::map<StreamID, ReadPowerAndClipCallback>;
StreamPollCallbackMap poll_callbacks_;
// Records the last time at which sound was audible from any stream.
@@ -163,10 +167,6 @@ class CONTENT_EXPORT AudioStreamMonitor {
// future.
base::OneShotTimer off_timer_;
- // Number of active streams to be used as a proxy for audibility when power
- // level monitoring is not available.
- size_t active_streams_;
-
DISALLOW_COPY_AND_ASSIGN(AudioStreamMonitor);
};
« no previous file with comments | « no previous file | content/browser/media/audio_stream_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698