Commit 12c36936 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

Use base::NoDestructor for net::SslIndexSingleton.

The goal of this CL is to provide a sample call site for
base::NoDestructor.

SslIndexSingleton does nothing in its destructor, so not registering
with AtExitManager doesn't affect behavior.

Change-Id: I19c334faa7148c8f0340c370c854272023fc3950
Reviewed-on: https://chromium-review.googlesource.com/879103Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarBuck Krasic <ckrasic@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531979}
parent 8ce7a58b
......@@ -4,7 +4,7 @@
#include "net/quic/core/tls_handshaker.h"
#include "base/memory/singleton.h"
#include "base/no_destructor.h"
#include "net/quic/core/quic_crypto_stream.h"
#include "net/quic/core/tls_client_handshaker.h"
#include "net/quic/core/tls_server_handshaker.h"
......@@ -23,11 +23,12 @@ namespace {
class SslIndexSingleton {
public:
static SslIndexSingleton* GetInstance() {
return base::Singleton<SslIndexSingleton>::get();
static const SslIndexSingleton* GetInstance() {
static const base::NoDestructor<SslIndexSingleton> instance;
return instance.get();
}
int HandshakerIndex() { return ssl_ex_data_index_handshaker_; }
int HandshakerIndex() const { return ssl_ex_data_index_handshaker_; }
private:
SslIndexSingleton() {
......@@ -36,7 +37,7 @@ class SslIndexSingleton {
CHECK_LE(0, ssl_ex_data_index_handshaker_);
}
friend struct base::DefaultSingletonTraits<SslIndexSingleton>;
friend class base::NoDestructor<SslIndexSingleton>;
int ssl_ex_data_index_handshaker_;
......
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