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

Unified Diff: content/browser/media/media_web_contents_observer.cc

Issue 2668813002: Remove LazyInstance usage from media/ (Closed)
Patch Set: Created 3 years, 11 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/media_web_contents_observer.cc
diff --git a/content/browser/media/media_web_contents_observer.cc b/content/browser/media/media_web_contents_observer.cc
index a1fe8da2bcf8abafb0f0d02e92bfb048dbe103d6..87d7670d71aa4ac5aae1a5a5e0ae738b00d66eec 100644
--- a/content/browser/media/media_web_contents_observer.cc
+++ b/content/browser/media/media_web_contents_observer.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "base/lazy_instance.h"
#include "build/build_config.h"
#include "content/browser/media/audible_metrics.h"
#include "content/browser/media/audio_stream_monitor.h"
@@ -21,8 +20,10 @@ namespace content {
namespace {
-static base::LazyInstance<AudibleMetrics>::Leaky g_audible_metrics =
- LAZY_INSTANCE_INITIALIZER;
+AudibleMetrics* GetAudibleMetrics() {
+ static AudibleMetrics* metrics = new AudibleMetrics();
+ return metrics;
+}
} // anonymous namespace
@@ -33,7 +34,7 @@ MediaWebContentsObserver::MediaWebContentsObserver(WebContents* web_contents)
MediaWebContentsObserver::~MediaWebContentsObserver() {}
void MediaWebContentsObserver::WebContentsDestroyed() {
- g_audible_metrics.Get().UpdateAudibleWebContentsState(web_contents(), false);
+ GetAudibleMetrics()->UpdateAudibleWebContentsState(web_contents(), false);
}
void MediaWebContentsObserver::RenderFrameDeleted(
@@ -53,7 +54,7 @@ void MediaWebContentsObserver::MaybeUpdateAudibleState() {
audio_power_save_blocker_.reset();
}
- g_audible_metrics.Get().UpdateAudibleWebContentsState(
+ GetAudibleMetrics()->UpdateAudibleWebContentsState(
web_contents(), audio_stream_monitor->IsCurrentlyAudible());
}

Powered by Google App Engine
This is Rietveld 408576698