commit 69c9544d3e1be09d281adf9e70401cc2a372652b
parent 963d609160cd35102db07fccd3c369b2b7b12a42
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Wed, 5 Nov 2025 18:43:18 +0000
Bug 1997865 - Make std::unique_ptr global variables MOZ_CONSTINIT r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D271021
Diffstat:
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dom/quota/test/gtest/TestEncryptedStream.cpp b/dom/quota/test/gtest/TestEncryptedStream.cpp
@@ -264,11 +264,13 @@ class DOM_Quota_EncryptedStream : public ::testing::Test {
struct NSSInitContextDeleter {
void operator()(NSSInitContext* p) { NSS_ShutdownContext(p); }
};
- MOZ_RUNINIT inline static std::unique_ptr<NSSInitContext,
- NSSInitContextDeleter>
- sNssContext;
+ static std::unique_ptr<NSSInitContext, NSSInitContextDeleter> sNssContext;
};
+MOZ_CONSTINIT std::unique_ptr<NSSInitContext,
+ DOM_Quota_EncryptedStream::NSSInitContextDeleter>
+ DOM_Quota_EncryptedStream::sNssContext;
+
enum struct FlushMode { AfterEachChunk, Never };
enum struct ChunkSize { SingleByte, Unaligned, DataSize };
diff --git a/dom/quota/test/gtest/TestStorageConnection.cpp b/dom/quota/test/gtest/TestStorageConnection.cpp
@@ -183,10 +183,11 @@ class TestStorageConnection : public QuotaManagerDependencyFixture {
struct NSSInitContextDeleter {
void operator()(NSSInitContext* p) { NSS_ShutdownContext(p); }
};
- MOZ_RUNINIT inline static std::unique_ptr<NSSInitContext,
- NSSInitContextDeleter>
- sNssContext;
+ static std::unique_ptr<NSSInitContext, NSSInitContextDeleter> sNssContext;
};
+MOZ_CONSTINIT std::unique_ptr<NSSInitContext,
+ TestStorageConnection::NSSInitContextDeleter>
+ TestStorageConnection::sNssContext;
TEST_F(TestStorageConnection, BaseVFS) {
// XXX This call can't be wrapped with ASSERT_NO_FATAL_FAILURE because
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
@@ -350,7 +350,7 @@ MOZ_CONSTINIT nsString gProcessStartupShortcut;
#endif
#if defined(MOZ_WAYLAND)
-MOZ_RUNINIT std::unique_ptr<WaylandProxy> gWaylandProxy;
+MOZ_CONSTINIT std::unique_ptr<WaylandProxy> gWaylandProxy;
#endif
#include "BinaryPath.h"