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

Unified Diff: content/browser/media/capture/audio_mirroring_manager.h

Issue 499483003: AudioMirroringManager becomes a global LazyInstance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/media/capture/audio_mirroring_manager.h
diff --git a/content/browser/media/capture/audio_mirroring_manager.h b/content/browser/media/capture/audio_mirroring_manager.h
index fe7db7ad52e7f68aebbba14377da49270cf10f32..86a715e319c6510c00398dcc5ba94a4804b4e2a4 100644
--- a/content/browser/media/capture/audio_mirroring_manager.h
+++ b/content/browser/media/capture/audio_mirroring_manager.h
@@ -5,7 +5,7 @@
// AudioMirroringManager is a singleton object that maintains a set of active
// audio mirroring destinations and auto-connects/disconnects audio streams
// to/from those destinations. It is meant to be used exclusively on the IO
-// BrowserThread.
+// thread.
//
// How it works:
//
@@ -31,6 +31,7 @@
#include <utility>
#include "base/basictypes.h"
+#include "base/threading/thread_checker.h"
#include "content/common/content_export.h"
#include "media/audio/audio_source_diverter.h"
@@ -60,10 +61,13 @@ class CONTENT_EXPORT AudioMirroringManager {
virtual ~MirroringDestination() {}
};
+ // Note: Use GetInstance() for non-test code.
AudioMirroringManager();
-
virtual ~AudioMirroringManager();
+ // Returns the global instance.
+ static AudioMirroringManager* GetInstance();
+
// Add/Remove a diverter for an audio stream with a known RenderView target
// (represented by |render_process_id| + |render_view_id|). Multiple
// diverters may be added for the same target. |diverter| must live until
@@ -100,6 +104,9 @@ class CONTENT_EXPORT AudioMirroringManager {
// Currently-active mirroring sessions.
SessionMap sessions_;
+ // Used to check that all AudioMirroringManager code runs on the same thread.
+ base::ThreadChecker thread_checker_;
+
DISALLOW_COPY_AND_ASSIGN(AudioMirroringManager);
};

Powered by Google App Engine
This is Rietveld 408576698