From 7255fef2582afd9ab2a225514816719dc38cdb58 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Tue, 11 Sep 2018 10:49:41 +0200 Subject: [PATCH] Fix no_global_constructors in remote_bitrate_estimator. Bug: webrtc:9693 Change-Id: Ibd8f0e89a7b37ad26d4cb3e73c395f77ed988ac9 Reviewed-on: https://webrtc-review.googlesource.com/98584 Reviewed-by: Karl Wiberg Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/master@{#24682} --- modules/remote_bitrate_estimator/BUILD.gn | 6 ++---- modules/remote_bitrate_estimator/test/bwe_test_logging.cc | 5 ++--- modules/remote_bitrate_estimator/test/bwe_test_logging.h | 1 - 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/remote_bitrate_estimator/BUILD.gn b/modules/remote_bitrate_estimator/BUILD.gn index 0758b0a870..63564a632f 100644 --- a/modules/remote_bitrate_estimator/BUILD.gn +++ b/modules/remote_bitrate_estimator/BUILD.gn @@ -33,10 +33,8 @@ rtc_static_library("remote_bitrate_estimator") { if (rtc_enable_bwe_test_logging) { defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=1" ] - configs += [ - "../..:no_exit_time_destructors", - "../..:no_global_constructors", - ] + + configs += [ "../..:no_exit_time_destructors" ] sources += [ "test/bwe_test_logging.cc" ] } else { defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0" ] diff --git a/modules/remote_bitrate_estimator/test/bwe_test_logging.cc b/modules/remote_bitrate_estimator/test/bwe_test_logging.cc index 1b4cae2f47..0778040eb0 100644 --- a/modules/remote_bitrate_estimator/test/bwe_test_logging.cc +++ b/modules/remote_bitrate_estimator/test/bwe_test_logging.cc @@ -26,8 +26,6 @@ namespace webrtc { namespace testing { namespace bwe { -Logging Logging::g_Logging; - static std::string ToString(uint32_t v) { rtc::StringBuilder ss; ss << v; @@ -58,7 +56,8 @@ Logging::Context::~Context() { } Logging* Logging::GetInstance() { - return &g_Logging; + static Logging* logging = new Logging(); + return logging; } void Logging::SetGlobalContext(uint32_t name) { diff --git a/modules/remote_bitrate_estimator/test/bwe_test_logging.h b/modules/remote_bitrate_estimator/test/bwe_test_logging.h index 20a29cc793..6e0f66a7e4 100644 --- a/modules/remote_bitrate_estimator/test/bwe_test_logging.h +++ b/modules/remote_bitrate_estimator/test/bwe_test_logging.h @@ -346,7 +346,6 @@ class Logging { bool enabled); void PopState(); - static Logging g_Logging; rtc::CriticalSection crit_sect_; ThreadMap thread_map_;