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

Unified Diff: media/audio/audio_manager.cc

Issue 1105083004: Switch audio hang monitor to default-off. Enable for non-beta,stable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 8 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 | « media/audio/audio_manager.h ('k') | media/base/media_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_manager.cc
diff --git a/media/audio/audio_manager.cc b/media/audio/audio_manager.cc
index 4cb3278e6297fe519e282f0b0172a6ce7952e0dd..97076affb68de799697226aa81b1ef84d60c1a86 100644
--- a/media/audio/audio_manager.cc
+++ b/media/audio/audio_manager.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/command_line.h"
#include "base/debug/alias.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
@@ -14,6 +15,7 @@
#include "build/build_config.h"
#include "media/audio/audio_manager_factory.h"
#include "media/audio/fake_audio_log_factory.h"
+#include "media/base/media_switches.h"
namespace media {
namespace {
@@ -131,6 +133,8 @@ class AudioManagerHelper : public base::PowerObserver {
DISALLOW_COPY_AND_ASSIGN(AudioManagerHelper);
};
+static bool g_hang_monitor_enabled = false;
+
static base::LazyInstance<AudioManagerHelper>::Leaky g_helper =
LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -177,11 +181,11 @@ AudioManager* AudioManager::CreateWithHangTimer(
AudioLogFactory* audio_log_factory,
const scoped_refptr<base::SingleThreadTaskRunner>& monitor_task_runner) {
AudioManager* manager = Create(audio_log_factory);
- // On OSX the audio thread is the UI thread, for which a hang monitor is not
- // necessary.
-#if !defined(OS_MACOSX)
- g_helper.Pointer()->StartHangTimer(monitor_task_runner);
-#endif
+ if (g_hang_monitor_enabled ||
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableAudioHangMonitor)) {
+ g_helper.Pointer()->StartHangTimer(monitor_task_runner);
+ }
return manager;
}
@@ -191,6 +195,17 @@ AudioManager* AudioManager::CreateForTesting() {
}
// static
+void AudioManager::EnableHangMonitor() {
+ CHECK(!g_last_created);
+// On OSX the audio thread is the UI thread, for which a hang monitor is not
+// necessary or recommended. If it's manually requested, we should allow it
+// to start though.
+#if !defined(OS_MACOSX)
+ g_hang_monitor_enabled = true;
+#endif
+}
+
+// static
AudioManager* AudioManager::Get() {
return g_last_created;
}
« no previous file with comments | « media/audio/audio_manager.h ('k') | media/base/media_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698