WebKit Bugzilla
Attachment 342615 Details for
Bug 186570
: Eliminate static initializers in libwebrtc.dylib
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186570-20180612174630.patch (text/plain), 8.13 KB, created by
youenn fablet
on 2018-06-12 17:46:31 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-06-12 17:46:31 PDT
Size:
8.13 KB
patch
obsolete
>Subversion Revision: 232754 >diff --git a/Source/ThirdParty/libwebrtc/ChangeLog b/Source/ThirdParty/libwebrtc/ChangeLog >index 946554233f206bb463e8043431592904c3334675..6a31761fd4fbd1ad342893c1f73c1031f09f020a 100644 >--- a/Source/ThirdParty/libwebrtc/ChangeLog >+++ b/Source/ThirdParty/libwebrtc/ChangeLog >@@ -1,3 +1,16 @@ >+2018-06-12 Youenn Fablet <youenn@apple.com> >+ >+ Eliminate static initializers in libwebrtc.dylib >+ https://bugs.webkit.org/show_bug.cgi?id=186570 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Source/webrtc/rtc_base/flags.h: Changed macro to create the static into a function. >+ * Source/webrtc/rtc_base/logging.cc: Ditto. >+ Made sure that the scope is created on instantiation of the first Log instance that might use it. >+ * Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm: >+ * Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc: >+ > 2018-06-09 Dan Bernstein <mitz@apple.com> > > [Xcode] Clean up and modernize some build setting definitions >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h >index 5a07b1a73740fa8232ac599ee867c0490fffb499..568e9bc3f7028214710cf7043dfa9c381f612cd4 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h >@@ -151,19 +151,25 @@ class Flag { > > > // Internal use only. >-#define DEFINE_FLAG(type, c_type, name, default, comment) \ >- /* define and initialize the flag */ \ >- c_type FLAG_##name = (default); \ >- /* register the flag */ \ >- static rtc::Flag Flag_##name(__FILE__, #name, (comment), \ >- rtc::Flag::type, &FLAG_##name, \ >- rtc::FlagValue::New_##type(default)) > >+#define DEFINE_FLAG(type, c_type, name, default, comment) \ >+ static std::pair<std::reference_wrapper<c_type>, std::reference_wrapper<rtc::Flag>> name() { \ >+ /* define and initialize the flag */ \ >+ c_type FLAG_##name = (default); \ >+ /* register the flag */ \ >+ static rtc::Flag Flag_##name(__FILE__, #name, (comment), \ >+ rtc::Flag::type, &FLAG_##name, \ >+ rtc::FlagValue::New_##type(default)); \ >+ return std::make_pair<std::reference_wrapper<c_type>, std::reference_wrapper<rtc::Flag>>(FLAG_##name, Flag_##name); \ >+ } \ >+ c_type& FLAG_##name() { \ >+ return name().first; \ >+ } > > // Internal use only. > #define DECLARE_FLAG(c_type, name) \ >- /* declare the external flag */ \ >- extern c_type FLAG_##name >+ /* declare the flag getter */ \ >+ c_type& FLAG_##name(); > > > // Use the following macros to define a new flag: >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >index f468fdd42092c757a1beb97345df738560e5d521..9df966388617a0f5285175edd7b767f6e6c98d45 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >@@ -103,15 +103,20 @@ LoggingSeverity LogMessage::dbg_sev_ = LS_NONE; > bool LogMessage::log_to_stderr_ = true; > > namespace { >+ > // Global lock for log subsystem, only needed to serialize access to streams_. >-CriticalSection g_log_crit; >+CriticalSection& logCriticalScope() { >+ static CriticalSection g_log_crit; >+ return g_log_crit; >+} >+ > } // namespace > > // The list of logging streams currently configured. > // Note: we explicitly do not clean this up, because of the uncertain ordering > // of destructors at program exit. Let the person who sets the stream trigger > // cleanup by setting to null, or let it leak (safe at program exit). >-LogMessage::StreamList LogMessage::streams_ RTC_GUARDED_BY(g_log_crit); >+LogMessage::StreamList LogMessage::streams_ RTC_GUARDED_BY(logCriticalScope()); > > // Boolean options default to false (0) > bool LogMessage::thread_, LogMessage::timestamp_; >@@ -123,6 +128,10 @@ LogMessage::LogMessage(const char* file, > int err, > const char* module) > : severity_(sev), tag_(kLibjingle) { >+ >+ static std::once_flag callLogCriticalScopeOnce; >+ std::call_once(callLogCriticalScopeOnce,[] { logCriticalScope(); }); >+ > if (timestamp_) { > // Use SystemTimeMillis so that even if tests use fake clocks, the timestamp > // in log messages represents the real system time. >@@ -207,7 +216,7 @@ LogMessage::~LogMessage() { > OutputToDebug(str, severity_, tag_); > } > >- CritScope cs(&g_log_crit); >+ CritScope cs(&logCriticalScope()); > for (auto& kv : streams_) { > if (severity_ >= kv.second) { > kv.first->OnLogMessage(str); >@@ -235,7 +244,7 @@ void LogMessage::LogTimestamps(bool on) { > > void LogMessage::LogToDebug(LoggingSeverity min_sev) { > dbg_sev_ = min_sev; >- CritScope cs(&g_log_crit); >+ CritScope cs(&logCriticalScope()); > UpdateMinLogSeverity(); > } > >@@ -244,7 +253,7 @@ void LogMessage::SetLogToStderr(bool log_to_stderr) { > } > > int LogMessage::GetLogToStream(LogSink* stream) { >- CritScope cs(&g_log_crit); >+ CritScope cs(&logCriticalScope()); > LoggingSeverity sev = LS_NONE; > for (auto& kv : streams_) { > if (!stream || stream == kv.first) { >@@ -255,13 +264,13 @@ int LogMessage::GetLogToStream(LogSink* stream) { > } > > void LogMessage::AddLogToStream(LogSink* stream, LoggingSeverity min_sev) { >- CritScope cs(&g_log_crit); >+ CritScope cs(&logCriticalScope()); > streams_.push_back(std::make_pair(stream, min_sev)); > UpdateMinLogSeverity(); > } > > void LogMessage::RemoveLogToStream(LogSink* stream) { >- CritScope cs(&g_log_crit); >+ CritScope cs(&logCriticalScope()); > for (StreamList::iterator it = streams_.begin(); it != streams_.end(); ++it) { > if (stream == it->first) { > streams_.erase(it); >@@ -334,7 +343,7 @@ void LogMessage::ConfigureLogging(const char* params) { > } > > void LogMessage::UpdateMinLogSeverity() >- RTC_EXCLUSIVE_LOCKS_REQUIRED(g_log_crit) { >+ RTC_EXCLUSIVE_LOCKS_REQUIRED(logCriticalScope()) { > LoggingSeverity min_sev = dbg_sev_; > for (auto& kv : streams_) { > min_sev = std::min(dbg_sev_, kv.second); >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm >index 4a5d45062ae8de515ee2d58a87e94311cda4a2b8..c784ad0512b6fb255094059b03ed7a765bd0dbd7 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm >@@ -16,9 +16,9 @@ > > #include "media/base/mediaconstants.h" > >-NSString *const kRTCVideoCodecVp8Name = @(cricket::kVp8CodecName); >-NSString *const kRTCVideoCodecVp9Name = @(cricket::kVp9CodecName); >-NSString *const kRTCVideoCodecH264Name = @(cricket::kH264CodecName); >+NSString *const kRTCVideoCodecVp8Name = @"VP8"; >+NSString *const kRTCVideoCodecVp9Name = @"VP9"; >+NSString *const kRTCVideoCodecH264Name = @"H264"; > NSString *const kRTCLevel31ConstrainedHigh = @"640c1f"; > NSString *const kRTCLevel31ConstrainedBaseline = @"42e01f"; > >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc >index 31a3ff7f4e12f75632756dd61c09978204c21d25..d0e2e0de19212907ac424a42197842f0870da7b8 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc >@@ -23,7 +23,7 @@ namespace runtime_enabled_features { > > bool IsFeatureEnabled(std::string feature_name) { > if (feature_name == kDualStreamModeFeatureName) >- return flags::FLAG_enable_dual_stream_mode; >+ return flags::FLAG_enable_dual_stream_mode(); > return false; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186570
:
342615
|
342619
|
342620
|
342678
|
342738