refactor: prefer using base::NoDestructor
to base::{Singleton,LazyInstance}
(#41424)
refactor: prefer using base::NoDestructor to base::{Singleton,LazyInstance} Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
a55f23979e
commit
7331e5dfb1
12 changed files with 44 additions and 18 deletions
|
@ -3,7 +3,7 @@
|
|||
// found in the LICENSE-CHROMIUM file.
|
||||
|
||||
#include "shell/browser/media/media_capture_devices_dispatcher.h"
|
||||
|
||||
// #include "base/no_destructor.h"
|
||||
#include "base/logging.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/media_capture_devices.h"
|
||||
|
@ -13,7 +13,8 @@ using content::BrowserThread;
|
|||
namespace electron {
|
||||
|
||||
MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() {
|
||||
return base::Singleton<MediaCaptureDevicesDispatcher>::get();
|
||||
static base::NoDestructor<MediaCaptureDevicesDispatcher> instance;
|
||||
return instance.get();
|
||||
}
|
||||
|
||||
MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher() {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
|
||||
#define ELECTRON_SHELL_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
|
||||
|
||||
#include "base/memory/singleton.h"
|
||||
#include "components/webrtc/media_stream_device_enumerator_impl.h"
|
||||
#include "content/public/browser/media_observer.h"
|
||||
#include "content/public/browser/media_stream_request.h"
|
||||
|
@ -45,7 +44,7 @@ class MediaCaptureDevicesDispatcher
|
|||
const MediaCaptureDevicesDispatcher&) = delete;
|
||||
|
||||
private:
|
||||
friend struct base::DefaultSingletonTraits<MediaCaptureDevicesDispatcher>;
|
||||
friend base::NoDestructor<MediaCaptureDevicesDispatcher>;
|
||||
|
||||
MediaCaptureDevicesDispatcher();
|
||||
~MediaCaptureDevicesDispatcher() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue