From 8994c8bab315fa34b75a8e79b78bb99c86f69966 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Sat, 23 Nov 2019 10:01:46 +0100 Subject: [PATCH] Reland "Make webrtc_fuzzer_main depend on webrtc_component in Chromium." This is a reland of 2148e9a931ea1a8a2ac0bfffd56e12370f8bf18c Original change's description: > Make webrtc_fuzzer_main depend on webrtc_component in Chromium. > > This is needed in order to land [1] and restrict visibility of some > //third_party/webrtc_overrides targets. > > [1] - https://chromium-review.googlesource.com/c/chromium/src/+/1930801 > > Bug: chromium:896154 > Change-Id: Ie71c44ee9a0203a85d77a1199acdcb8581dfb71b > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160308 > Reviewed-by: Karl Wiberg > Commit-Queue: Mirko Bonadei > Cr-Commit-Position: refs/heads/master@{#29875} No-Try: True No-Tree-Checks: true TBR: kwiberg@webrtc.org Bug: chromium:896154 Change-Id: I157bd4f90528a38ac16f17dd17af2f255dbd5ec9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160401 Commit-Queue: Mirko Bonadei Reviewed-by: Mirko Bonadei Cr-Commit-Position: refs/heads/master@{#29888} --- system_wrappers/BUILD.gn | 2 ++ system_wrappers/include/field_trial.h | 6 ++++-- system_wrappers/include/metrics.h | 28 ++++++++++++++------------- test/fuzzers/BUILD.gn | 11 +++-------- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/system_wrappers/BUILD.gn b/system_wrappers/BUILD.gn index f32cafe6d0..3522193c99 100644 --- a/system_wrappers/BUILD.gn +++ b/system_wrappers/BUILD.gn @@ -96,6 +96,7 @@ rtc_library("field_trial") { deps = [ "../rtc_base:checks", "../rtc_base:logging", + "../rtc_base/system:rtc_export", "//third_party/abseil-cpp/absl/strings", ] } @@ -128,6 +129,7 @@ rtc_library("metrics") { deps = [ "../rtc_base:checks", "../rtc_base:rtc_base_approved", + "../rtc_base/system:rtc_export", ] } diff --git a/system_wrappers/include/field_trial.h b/system_wrappers/include/field_trial.h index 1d0cef447d..1b5be7b110 100644 --- a/system_wrappers/include/field_trial.h +++ b/system_wrappers/include/field_trial.h @@ -13,6 +13,8 @@ #include +#include "rtc_base/system/rtc_export.h" + // Field trials allow webrtc clients (such as Chrome) to turn on feature code // in binaries out in the field and gather information with that. // @@ -61,7 +63,7 @@ namespace field_trial { // if the trial does not exists. // // Note: To keep things tidy append all the trial names with WebRTC. -std::string FindFullName(const std::string& name); +RTC_EXPORT std::string FindFullName(const std::string& name); // Convenience method, returns true iff FindFullName(name) return a string that // starts with "Enabled". @@ -80,7 +82,7 @@ inline bool IsDisabled(const char* name) { // This method can be called at most once before any other call into webrtc. // E.g. before the peer connection factory is constructed. // Note: trials_string must never be destroyed. -void InitFieldTrialsFromString(const char* trials_string); +RTC_EXPORT void InitFieldTrialsFromString(const char* trials_string); const char* GetFieldTrialString(); diff --git a/system_wrappers/include/metrics.h b/system_wrappers/include/metrics.h index 18c97574b1..a9debea84d 100644 --- a/system_wrappers/include/metrics.h +++ b/system_wrappers/include/metrics.h @@ -19,6 +19,7 @@ #include "rtc_base/atomic_ops.h" #include "rtc_base/checks.h" +#include "rtc_base/system/rtc_export.h" // Macros for allowing WebRTC clients (e.g. Chrome) to gather and aggregate // statistics. @@ -253,29 +254,30 @@ class Histogram; // histogram). // Get histogram for counters. -Histogram* HistogramFactoryGetCounts(const std::string& name, - int min, - int max, - int bucket_count); +RTC_EXPORT Histogram* HistogramFactoryGetCounts(const std::string& name, + int min, + int max, + int bucket_count); // Get histogram for counters with linear bucket spacing. -Histogram* HistogramFactoryGetCountsLinear(const std::string& name, - int min, - int max, - int bucket_count); +RTC_EXPORT Histogram* HistogramFactoryGetCountsLinear(const std::string& name, + int min, + int max, + int bucket_count); // Get histogram for enumerators. // |boundary| should be above the max enumerator sample. -Histogram* HistogramFactoryGetEnumeration(const std::string& name, - int boundary); +RTC_EXPORT Histogram* HistogramFactoryGetEnumeration(const std::string& name, + int boundary); // Get sparse histogram for enumerators. // |boundary| should be above the max enumerator sample. -Histogram* SparseHistogramFactoryGetEnumeration(const std::string& name, - int boundary); +RTC_EXPORT Histogram* SparseHistogramFactoryGetEnumeration( + const std::string& name, + int boundary); // Function for adding a |sample| to a histogram. -void HistogramAdd(Histogram* histogram_pointer, int sample); +RTC_EXPORT void HistogramAdd(Histogram* histogram_pointer, int sample); struct SampleInfo { SampleInfo(const std::string& name, int min, int max, size_t bucket_count); diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index a063d6a62c..deb4fcc050 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -15,17 +15,12 @@ rtc_library("webrtc_fuzzer_main") { "webrtc_fuzzer_main.cc", ] deps = [ - "../../rtc_base:rtc_base_approved", "//testing/libfuzzer:libfuzzer_main", ] - - # When WebRTC fuzzer tests are built on Chromium bots they need to link - # with Chromium's implementation of metrics and field trial. if (build_with_chromium) { - deps += [ - "../../../webrtc_overrides:field_trial", - "../../../webrtc_overrides:metrics", - ] + deps += [ "//third_party/webrtc_overrides:webrtc_component" ] + } else { + deps += [ "../../rtc_base:rtc_base_approved" ] } }