Commit 8b09db7a authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Convert from base::{LazyInstance,Singleton} to base::NoDestructor

The class base::NoDestructor is a simpler way to define a static
global value (aka a singleton) than base::{LazyInstance,Singleton}
and is the recommended pattern to use.

The changes were automated using a custom one-shot script, then
fine tuned by hand (to remove unnecessary classes, ...).

This fixes usages in src/ios/chrome/browser/update_client.

This CL was uploaded by git cl split.

Bug: none
Change-Id: I3eb76f475aa91dd3af90b69c17a1620b5bbbe0cc
Reviewed-on: https://chromium-review.googlesource.com/c/1426697
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625448}
parent 6e4945b0
......@@ -4,19 +4,12 @@
#include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h"
#include "base/lazy_instance.h"
#include "base/no_destructor.h"
#include "base/strings/stringprintf.h"
#include "components/version_info/version_info.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/common/channel_info.h"
namespace {
base::LazyInstance<IOSChromeUpdateQueryParamsDelegate>::DestructorAtExit
g_delegate = LAZY_INSTANCE_INITIALIZER;
} // namespace
IOSChromeUpdateQueryParamsDelegate::IOSChromeUpdateQueryParamsDelegate() {}
IOSChromeUpdateQueryParamsDelegate::~IOSChromeUpdateQueryParamsDelegate() {}
......@@ -24,7 +17,8 @@ IOSChromeUpdateQueryParamsDelegate::~IOSChromeUpdateQueryParamsDelegate() {}
// static
IOSChromeUpdateQueryParamsDelegate*
IOSChromeUpdateQueryParamsDelegate::GetInstance() {
return g_delegate.Pointer();
static base::NoDestructor<IOSChromeUpdateQueryParamsDelegate> instance;
return instance.get();
}
std::string IOSChromeUpdateQueryParamsDelegate::GetExtraParams() {
......
......@@ -16,7 +16,7 @@ class IOSChromeUpdateQueryParamsDelegate
IOSChromeUpdateQueryParamsDelegate();
~IOSChromeUpdateQueryParamsDelegate() override;
// Gets the LazyInstance for IOSChromeUpdateQueryParamsDelegate.
// Gets the instance for IOSChromeUpdateQueryParamsDelegate.
static IOSChromeUpdateQueryParamsDelegate* GetInstance();
// update_client::UpdateQueryParamsDelegate:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment