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

Unified Diff: content/renderer/media/render_media_client.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/renderer/media/render_media_client.cc
diff --git a/content/renderer/media/render_media_client.cc b/content/renderer/media/render_media_client.cc
index 3c8d9e1d53e6922f3cef9e5f7090e8c611f874b7..b720b4e9da9d675d61abb10e7e7034c55cbff94e 100644
--- a/content/renderer/media/render_media_client.cc
+++ b/content/renderer/media/render_media_client.cc
@@ -4,7 +4,6 @@
#include "content/renderer/media/render_media_client.h"
-#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/time/default_tick_clock.h"
#include "content/public/common/content_client.h"
@@ -12,11 +11,8 @@
namespace content {
-static base::LazyInstance<RenderMediaClient>::Leaky g_render_media_client =
- LAZY_INSTANCE_INITIALIZER;
-
void RenderMediaClient::Initialize() {
- g_render_media_client.Get();
+ GetInstance();
}
RenderMediaClient::RenderMediaClient()
@@ -120,13 +116,10 @@ void RenderMediaClient::SetTickClockForTesting(
tick_clock_.swap(tick_clock);
}
-// This functions is for testing purpose only. The declaration in the
-// header file is guarded by "#if defined(UNIT_TEST)" so that it can be used
-// by tests but not non-test code. However, this .cc file is compiled as part of
-// "content" where "UNIT_TEST" is not defined. So we need to specify
-// "CONTENT_EXPORT" here again so that it is visible to tests.
-CONTENT_EXPORT RenderMediaClient* GetRenderMediaClientInstanceForTesting() {
- return g_render_media_client.Pointer();
+// static
+RenderMediaClient* RenderMediaClient::GetInstance() {
+ static RenderMediaClient* client = new RenderMediaClient();
+ return client;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698