diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 28ff7fd53c..32ef93e5c5 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -407,6 +407,10 @@ rtc_library("timeutils") { ":stringutils", "system:rtc_export", ] + if (rtc_exclude_system_time) { + defines = [ "WEBRTC_EXCLUDE_SYSTEM_TIME" ] + } + libs = [] if (is_win) { libs += [ "winmm.lib" ] diff --git a/rtc_base/system_time.cc b/rtc_base/system_time.cc index bcd4e6c628..9efe76e3a6 100644 --- a/rtc_base/system_time.cc +++ b/rtc_base/system_time.cc @@ -8,6 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ +// If WEBRTC_EXCLUDE_SYSTEM_TIME is set, an implementation of +// rtc::SystemTimeNanos() must be provided externally. +#ifndef WEBRTC_EXCLUDE_SYSTEM_TIME + #include #include @@ -90,3 +94,4 @@ int64_t SystemTimeNanos() { } } // namespace rtc +#endif // WEBRTC_EXCLUDE_SYSTEM_TIME diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn index f6352d8742..202095789c 100644 --- a/rtc_tools/BUILD.gn +++ b/rtc_tools/BUILD.gn @@ -136,6 +136,12 @@ rtc_executable("frame_analyzer") { "//third_party/abseil-cpp/absl/flags:parse", "//third_party/abseil-cpp/absl/strings", ] + + if (build_with_chromium) { + # When building from Chromium, WebRTC's metrics and field trial + # implementations need to be replaced by the Chromium ones. + deps += [ "//third_party/webrtc_overrides:webrtc_component" ] + } } # TODO(bugs.webrtc.org/11474): Enable this on win if needed. For now it diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index af7a4b7e7c..44387ad3f4 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -18,11 +18,12 @@ rtc_library("webrtc_fuzzer_main") { ] # When WebRTC fuzzer tests are built on Chromium bots they need to link - # with Chromium's implementation of metrics and field trial. + # with Chromium's implementation of metrics, field trial, and system time. if (build_with_chromium) { deps += [ "../../../webrtc_overrides:field_trial", "../../../webrtc_overrides:metrics", + "../../../webrtc_overrides:system_time", ] } } diff --git a/webrtc.gni b/webrtc.gni index 08b2d661de..c1227bab9d 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -63,7 +63,7 @@ declare_args() { # will tell the pre-processor to remove the default definition of the # SystemTimeNanos() which is defined in rtc_base/system_time.cc. In # that case a new implementation needs to be provided. - rtc_exclude_system_time = false + rtc_exclude_system_time = build_with_chromium # Setting this to false will require the API user to pass in their own # SSLCertificateVerifier to verify the certificates presented from a