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

Unified Diff: content/browser/browser_main_loop.h

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: fixes content_browsertests and content_unittests Created 3 years, 9 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/browser_main_loop.h
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h
index 7755d8c1630b9eed826c1fa79631a69ae6da6753..374f9487a9e97a243af5c5c565fef9c812138578 100644
--- a/content/browser/browser_main_loop.h
+++ b/content/browser/browser_main_loop.h
@@ -14,7 +14,6 @@
#include "build/build_config.h"
#include "content/browser/browser_process_sub_thread.h"
#include "content/public/browser/browser_main_runner.h"
-#include "media/audio/audio_manager.h"
#include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
#if defined(USE_AURA)
@@ -41,6 +40,7 @@ class DiscardableSharedMemoryManager;
}
namespace media {
+class AudioManager;
class AudioSystem;
#if defined(OS_WIN)
class SystemMessageWindowWin;
@@ -194,6 +194,8 @@ class CONTENT_EXPORT BrowserMainLoop {
void EndStartupTracing();
void CreateAudioManager();
+ void DestroyAudioManager();
+
bool UsingInProcessGpu() const;
void InitializeMemoryManagementComponent();
@@ -295,9 +297,10 @@ class CONTENT_EXPORT BrowserMainLoop {
// |user_input_monitor_| has to outlive |audio_manager_|, so declared first.
std::unique_ptr<media::UserInputMonitor> user_input_monitor_;
- // AudioThread needs to outlive |audio_manager_|.
+ std::unique_ptr<media::AudioManager> audio_manager_;
+ // |audio_thread_| must be stopped before |audio_manager_| is deleted so
+ // that tasks referering to the |audio_manager_| cannot be posted.
std::unique_ptr<AudioManagerThread> audio_thread_;
- media::ScopedAudioManagerPtr audio_manager_;
// Calls to |audio_system_| must not be posted to the audio thread if it
// differs from the UI one.
std::unique_ptr<media::AudioSystem> audio_system_;

Powered by Google App Engine
This is Rietveld 408576698