Chromium Code Reviews| 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..e525512c81883f87cb582c4d37d3e1fd20516d05 100644 |
| --- a/content/browser/renderer_host/media/audio_renderer_host.h |
| +++ b/content/browser/renderer_host/media/audio_renderer_host.h |
| @@ -49,6 +49,7 @@ |
| #include "base/atomic_ref_count.h" |
| #include "base/gtest_prod_util.h" |
| +#include "base/logging.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/process/process.h" |
| @@ -129,6 +130,14 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter { |
| const AudioOutputDeviceInfo& device_info)> |
| OutputDeviceInfoCB; |
| + // The type of a 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 = |
|
o1ka
2016/07/11 10:35:50
probably #ifdef this as well?
miu
2016/07/14 21:36:12
Based on past experience, we generally don't condi
|
| + void (*)(int render_process_id, |
| + int render_frame_id, |
| + const base::Callback<void(bool)>& callback); |
| + |
| ~AudioRendererHost() override; |
| // Methods called on IO thread ---------------------------------------------- |
| @@ -186,7 +195,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_id_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 +247,15 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter { |
| // |stream_id| has started. |
| bool IsAuthorizationStarted(int stream_id); |
| +#if DCHECK_IS_ON() |
| + // Called from AudioRendererHostTest to override the function that checks for |
| + // the existence of the RenderFrameHost at stream creation time. |
| + void set_render_frame_id_validate_function_for_testing( |
| + ValidateRenderFrameIdFunction function) { |
| + validate_render_frame_id_function_ = function; |
| + } |
| +#endif // DCHECK_IS_ON() |
| + |
| // ID of the RenderProcessHost that owns this instance. |
| const int render_process_id_; |
| @@ -263,6 +282,13 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter { |
| // The second element contains the unique ID of the authorized device. |
| std::map<int, std::pair<bool, std::string>> authorizations_; |
| +#if DCHECK_IS_ON() |
| + // When DCHECKs are turned on, AudioRendererHost will call this function on |
| + // the UI thread to validate render frame IDs. A default is set by the |
| + // constructor, but this can be overridden by unit tests. |
| + ValidateRenderFrameIdFunction validate_render_frame_id_function_; |
|
o1ka
2016/07/11 10:35:50
AudioRendererHost is exported from content.
Is a s
miu
2016/07/14 21:36:12
This shouldn't be an issue in the Chromium project
|
| +#endif // DCHECK_IS_ON() |
| + |
| // The maximum number of simultaneous streams during the lifetime of this |
| // host. Reported as UMA stat at shutdown. |
| size_t max_simultaneous_streams_; |