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

Unified Diff: media/audio/simple_sources.cc

Issue 2668813002: Remove LazyInstance usage from media/ (Closed)
Patch Set: Fix presubmit comments. Created 3 years, 10 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.cc ('k') | media/base/android/media_drm_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/simple_sources.cc
diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc
index 44fee723cad7dfcc5936e17ba2c8eceb25ae4cb4..b3d75704a3200e99c5b5696ae8938f260662fdee 100644
--- a/media/audio/simple_sources.cc
+++ b/media/audio/simple_sources.cc
@@ -12,7 +12,6 @@
#include <cmath>
#include "base/files/file.h"
-#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "media/audio/sounds/wav_audio_handler.h"
@@ -94,8 +93,11 @@ class BeepContext {
bool automatic_beep_;
};
-static base::LazyInstance<BeepContext>::Leaky g_beep_context =
- LAZY_INSTANCE_INITIALIZER;
+BeepContext* GetBeepContext() {
+ static BeepContext* context = new BeepContext();
+ return context;
+}
+
} // namespace
//////////////////////////////////////////////////////////////////////////////
@@ -270,7 +272,7 @@ int BeepingSource::OnMoreData(base::TimeDelta /* delay */,
memset(buffer_.get(), 0, buffer_size_);
bool should_beep = false;
- BeepContext* beep_context = g_beep_context.Pointer();
+ BeepContext* beep_context = GetBeepContext();
if (beep_context->automatic_beep()) {
base::TimeDelta delta = interval_from_last_beep_ -
base::TimeDelta::FromMilliseconds(kAutomaticBeepIntervalInMs);
@@ -317,7 +319,7 @@ void BeepingSource::OnError(AudioOutputStream* stream) {
}
void BeepingSource::BeepOnce() {
- g_beep_context.Pointer()->SetBeepOnce(true);
+ GetBeepContext()->SetBeepOnce(true);
}
} // namespace media
« no previous file with comments | « media/audio/audio_manager.cc ('k') | media/base/android/media_drm_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698