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

Unified Diff: media/capture/video/linux/video_capture_device_chromeos.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: media/capture/video/linux/video_capture_device_chromeos.cc
diff --git a/media/capture/video/linux/video_capture_device_chromeos.cc b/media/capture/video/linux/video_capture_device_chromeos.cc
index 1d673def2bf62d98d223f703f257509b493fd5fa..7003990ad5ee26c23d5dfc2445e6dc2e49cd5f37 100644
--- a/media/capture/video/linux/video_capture_device_chromeos.cc
+++ b/media/capture/video/linux/video_capture_device_chromeos.cc
@@ -7,7 +7,6 @@
#include <stdint.h>
#include "base/bind.h"
-#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
@@ -18,12 +17,10 @@
namespace media {
-namespace {
-
-base::LazyInstance<CameraConfigChromeOS>::Leaky g_camera_config_ =
- LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
+static CameraConfigChromeOS* GetCameraConfig() {
+ static CameraConfigChromeOS* config = new CameraConfigChromeOS();
+ return config;
+}
// This is a delegate class used to transfer Display change events from the UI
// thread to the media thread.
@@ -109,11 +106,11 @@ VideoCaptureDeviceChromeOS::VideoCaptureDeviceChromeOS(
screen_observer_delegate_(
new ScreenObserverDelegate(this, ui_task_runner)),
lens_facing_(
- g_camera_config_.Get().GetCameraFacing(device_descriptor.device_id,
- device_descriptor.model_id)),
+ GetCameraConfig()->GetCameraFacing(device_descriptor.device_id,
Mark Mentovai 2017/01/31 21:33:56 Since GetCameraConfig() is only called from this o
DaleCurtis 2017/01/31 22:04:33 Class marks those variables as const which is why
+ device_descriptor.model_id)),
camera_orientation_(
- g_camera_config_.Get().GetOrientation(device_descriptor.device_id,
- device_descriptor.model_id)) {}
+ GetCameraConfig()->GetOrientation(device_descriptor.device_id,
+ device_descriptor.model_id)) {}
VideoCaptureDeviceChromeOS::~VideoCaptureDeviceChromeOS() {
screen_observer_delegate_->RemoveObserver();

Powered by Google App Engine
This is Rietveld 408576698