Add rtc_enable_symbol_export to incrementally create a WebRTC component.

In order to implement a WebRTC component in Chromium, WebRTC needs to
export some symbols.

If RTC_EXPORT relies on COMPONENT_BUILD to mark symbols as exported
or imported, it will not be possible to incrementally add RTC_EXPORT
because the Chromium build will break (two Chromium components that
export a symbol or no component that exports it).

By using `rtc_enable_symbol_export` (which makes GN define
WEBRTC_ENABLE_SYMBOL_EXPORT), WebRTC will be able to incrementally mark
symbols with RTC_EXPORT and flip the value of `rtc_enable_symbol_export`
in the Chromium build when everything will be ready.

Bug: webrtc:9419
Change-Id: I57ab63c53545c500eaaefd75c112b4674aa7cf19
Reviewed-on: https://webrtc-review.googlesource.com/c/104980
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25087}
This commit is contained in:
Mirko Bonadei 2018-10-10 12:19:02 +02:00 committed by Commit Bot
parent b686396ec6
commit 028248cbd7
3 changed files with 10 additions and 2 deletions

View File

@ -97,6 +97,10 @@ config("common_inherited_config") {
cflags = []
ldflags = []
if (rtc_enable_symbol_export) {
defines = [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
}
if (build_with_mozilla) {
defines += [ "WEBRTC_MOZILLA_BUILD" ]
}

View File

@ -16,7 +16,7 @@
// When WebRTC is built as a static library the RTC_EXPORT macro expands to
// nothing.
#ifdef COMPONENT_BUILD
#ifdef WEBRTC_ENABLE_SYMBOL_EXPORT
#ifdef WEBRTC_WIN
@ -34,7 +34,7 @@
#endif // WEBRTC_WIN
#endif // COMPONENT_BUILD
#endif // WEBRTC_ENABLE_SYMBOL_EXPORT
#ifndef RTC_EXPORT
#define RTC_EXPORT

View File

@ -35,6 +35,10 @@ if (is_mac) {
}
declare_args() {
# Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
# expand to code that will manage symbols visibility.
rtc_enable_symbol_export = false
# Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
# will tell the pre-processor to remove the default definition of symbols
# needed to use field_trial. In that case a new implementation needs to be