[webkit-dev] Objective-C code in libwebrtc already assuming ARC?

Darin Adler darin at apple.com
Wed Jun 6 09:28:08 PDT 2018


Hi folks.

As some of you have probably noticed, I’ve begun making changes with the goal of preparing us to move most Objective-C code in WebKit to ARC. In doing so, I have been exploring the existing code in the tree and the various projects in our source tree. The nine projects with configuration files that I have looked at are:

JavaScriptCore, ANGLE, libwebrtc, WebCore, WebCore/PAL, WebInspectorUI, WebKit, WebKitLegacy/mac, and bmalloc.

These projects all currently have CLANG_ENABLE_OBJC_WEAK in their configuration files, and moving them to ARC involves adding CLANG_ENABLE_OBJC_ARC, and then doing lots of other work to ensure the projects still work properly, including possibly turning off ARC for certain source files that are best keep working with manual retain and release. Some of them such as ANGLE, bmalloc, and WebInspectorUI, have no Objective-C code, or almost none, so they should be easy to “convert".

But when investigating libwebrtc I discovered a non-tribal amount of code that already seems to assume ARC but to be compiled with ARC disabled. One example is these two methods:

-[RTCVideoEncoderFactoryH264 supportedCodecs]
-[RTCVideoDecoderFactoryH264 supportedCodecs]

If we are compiling this without ARC and executing calls to these methods, then I think we will have storage leaks.

As far as I can tell, the only source file in libwebrtc that is currently compiled with ARC enabled is voice_processing_audio_unit.mm but perhaps I am overlooking something.

Do we need to turn ARC on for the entire libwebrtc project?

— Darin


More information about the webkit-dev mailing list