Bug 186570

Summary: Eliminate static initializers in libwebrtc.dylib
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, ddkilzer, eric.carlson, joepeck, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Fix memory error issue none

youenn fablet
Reported 2018-06-12 11:33:37 PDT
Eliminate static initializers in libwebrtc.dylib
Attachments
Patch (8.13 KB, patch)
2018-06-12 17:46 PDT, youenn fablet
no flags
Patch (8.29 KB, patch)
2018-06-12 19:11 PDT, youenn fablet
no flags
Patch (8.46 KB, patch)
2018-06-12 19:16 PDT, youenn fablet
no flags
Patch (8.72 KB, patch)
2018-06-13 11:20 PDT, youenn fablet
no flags
Fix memory error issue (1.69 KB, patch)
2018-06-14 10:22 PDT, youenn fablet
no flags
Radar WebKit Bug Importer
Comment 1 2018-06-12 11:40:12 PDT
youenn fablet
Comment 2 2018-06-12 17:46:31 PDT
youenn fablet
Comment 3 2018-06-12 19:11:42 PDT
youenn fablet
Comment 4 2018-06-12 19:16:14 PDT
Darin Adler
Comment 5 2018-06-12 23:34:19 PDT
Comment on attachment 342620 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=342620&action=review > Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc:110 > + static CriticalSection g_log_crit; It would be nice to eliminate not just static constructors, but also static destructors. Can we do that? Would need something like NeverDestroyed here.
Darin Adler
Comment 6 2018-06-12 23:35:03 PDT
Comment on attachment 342620 [details] Patch Should also turn on the compiler option to make it an error if we have any, so we notice if someone accidentally adds one in the future.
youenn fablet
Comment 7 2018-06-13 11:20:33 PDT
youenn fablet
Comment 8 2018-06-13 15:33:51 PDT
(In reply to Darin Adler from comment #5) > Comment on attachment 342620 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=342620&action=review > > > Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc:110 > > + static CriticalSection g_log_crit; > > It would be nice to eliminate not just static constructors, but also static > destructors. Can we do that? Would need something like NeverDestroyed here. Done > Should also turn on the compiler option to make it an error if we have any, > so we notice if someone accidentally adds one in the future. Let's do that as a follow-up
Darin Adler
Comment 9 2018-06-13 20:05:41 PDT
(In reply to Darin Adler from comment #6) > Should also turn on the compiler option to make it an error if we have any, > so we notice if someone accidentally adds one in the future. The options are -Wexit-time-destructors -and Wglobal-constructors. These are both already specified in ThirdParty/libwebrtc/Configurations/Base.xcconfig, but disabled by libwebrtc.xcconfig, which overrides WARNING_CFLAGS with another warning setting without using $(inherited). It seems like that mistake led to us having these without noticing. It seems that other .xcconfig files in the libwebrtc directories are making the same mistake. Also, there are lots more warnings enabled in WebCore's Base.xconfig and it would be nice to enable more here.
youenn fablet
Comment 10 2018-06-13 20:46:30 PDT
> The options are -Wexit-time-destructors -and Wglobal-constructors. OK > Also, there are lots more warnings enabled in WebCore's > Base.xconfig and it would be nice to enable more here. Sure. We want to stay as close as possible to upstream libwebrtc to limit the cost of bumping revision. If we do that cleaning work once, we need to ensure we will not do that again and again.
WebKit Commit Bot
Comment 11 2018-06-13 21:14:57 PDT
Comment on attachment 342678 [details] Patch Clearing flags on attachment: 342678 Committed r232827: <https://trac.webkit.org/changeset/232827>
WebKit Commit Bot
Comment 12 2018-06-13 21:14:59 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 13 2018-06-13 22:46:40 PDT
There are still static initializers for: LogMessage::streams_ in logging.cc NonlinearBeamformer::kHalfBeamWidthRadians in nonlinear_beamformer.cc PI in virtualsocketserver.cc
youenn fablet
Comment 14 2018-06-14 08:28:04 PDT
I did some follow-up work yesterday at https://bugs.webkit.org/show_bug.cgi?id=186615 to enable these flags. It seems this current set of changes is breaking GTK, https://bugs.webkit.org/show_bug.cgi?id=186619
Darin Adler
Comment 15 2018-06-14 09:19:21 PDT
Comment on attachment 342678 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=342678&action=review > Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h:158 > + c_type FLAG_##name = (default); \ I think that "static" is missing here.
Darin Adler
Comment 16 2018-06-14 09:19:41 PDT
(In reply to youenn fablet from comment #14) > It seems this current set of changes is breaking GTK, > https://bugs.webkit.org/show_bug.cgi?id=186619 Maybe because of the "static" thing I commented on above?
youenn fablet
Comment 17 2018-06-14 10:21:01 PDT
(In reply to Darin Adler from comment #16) > (In reply to youenn fablet from comment #14) > > It seems this current set of changes is breaking GTK, > > https://bugs.webkit.org/show_bug.cgi?id=186619 > > Maybe because of the "static" thing I commented on above? Makes sense, I'll fix it asap.
youenn fablet
Comment 18 2018-06-14 10:22:45 PDT
Reopening to attach new patch.
youenn fablet
Comment 19 2018-06-14 10:22:46 PDT
Created attachment 342738 [details] Fix memory error issue
WebKit Commit Bot
Comment 20 2018-06-14 11:04:40 PDT
Comment on attachment 342738 [details] Fix memory error issue Clearing flags on attachment: 342738 Committed r232846: <https://trac.webkit.org/changeset/232846>
WebKit Commit Bot
Comment 21 2018-06-14 11:04:42 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.