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

Unified Diff: content/browser/renderer_host/media/audio_renderer_host.h

Issue 2125143003: Add back RenderFrameHost sanity-check to AudioRendererHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only when DCHECKs are on. Created 4 years, 5 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/media/audio_renderer_host.h
diff --git a/content/browser/renderer_host/media/audio_renderer_host.h b/content/browser/renderer_host/media/audio_renderer_host.h
index 7252086657dc01d89cff53846874d7cf4201b9f0..8640111ea93bc6d606aa918c7b048782e59031c7 100644
--- a/content/browser/renderer_host/media/audio_renderer_host.h
+++ b/content/browser/renderer_host/media/audio_renderer_host.h
@@ -129,6 +129,14 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
const AudioOutputDeviceInfo& device_info)>
OutputDeviceInfoCB;
+ // Function that is run on the UI thread to check whether the routing IDs
+ // reference a valid RenderFrameHost. The function then runs |callback| on the
+ // IO thread with true/false if valid/invalid.
+ using ValidateRenderFrameIdFunction =
+ void (*)(int render_process_id,
+ int render_frame_id,
+ const base::Callback<void(bool)>& callback);
+
~AudioRendererHost() override;
// Methods called on IO thread ----------------------------------------------
@@ -186,7 +194,8 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
void DoCreateStream(int stream_id,
int render_frame_id,
const media::AudioParameters& params,
- const std::string& device_unique_id);
+ const std::string& device_unique_id,
+ bool render_frame_is_valid);
// Complete the process of creating an audio stream. This will set up the
// shared memory or shared socket in low latency mode and send the
@@ -237,6 +246,13 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// |stream_id| has started.
bool IsAuthorizationStarted(int stream_id);
+ // Called from AudioRendererHostTest to override the function that checks for
+ // the existence of the render frame at stream creation time.
+ void set_render_frame_id_validate_function_for_testing(
+ ValidateRenderFrameIdFunction function) {
+ validate_render_frame_id_function_ = function;
+ }
+
// ID of the RenderProcessHost that owns this instance.
const int render_process_id_;
@@ -267,6 +283,10 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// host. Reported as UMA stat at shutdown.
size_t max_simultaneous_streams_;
+ // Function to use to validate render frame IDs. This is only overridden for
+ // testing.
+ ValidateRenderFrameIdFunction validate_render_frame_id_function_;
+
DISALLOW_COPY_AND_ASSIGN(AudioRendererHost);
};

Powered by Google App Engine
This is Rietveld 408576698