Use explicit template decl/def for RTCNonStandardStatsMember.
This should fix the error raised by lld-link while testing the WebRTC
component build (see [1]).
[1] - https://ci.chromium.org/p/chromium/builders/try/win_chromium_compile_dbg_ng/436729
Bug: webrtc:9419
Change-Id: Ia239f544432c55ae69e2da474b8284143c94a003
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159697
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29786}
diff --git a/api/stats/rtc_stats.h b/api/stats/rtc_stats.h
index 044fada..5f5bb41 100644
--- a/api/stats/rtc_stats.h
+++ b/api/stats/rtc_stats.h
@@ -387,7 +387,7 @@
// Using inheritance just so that it's obvious from the member's declaration
// whether it's standardized or not.
template <typename T>
-class RTC_EXPORT RTCNonStandardStatsMember : public RTCStatsMember<T> {
+class RTCNonStandardStatsMember : public RTCStatsMember<T> {
public:
explicit RTCNonStandardStatsMember(const char* name)
: RTCStatsMember<T>(name) {}
@@ -401,8 +401,8 @@
explicit RTCNonStandardStatsMember(const RTCNonStandardStatsMember<T>& other)
: RTCStatsMember<T>(other), group_ids_(other.group_ids_) {}
explicit RTCNonStandardStatsMember(RTCNonStandardStatsMember<T>&& other)
- : group_ids_(std::move(other.group_ids_)),
- RTCStatsMember<T>(std::move(other)) {}
+ : RTCStatsMember<T>(std::move(other)),
+ group_ids_(std::move(other.group_ids_)) {}
bool is_standardized() const override { return false; }
@@ -418,6 +418,36 @@
private:
std::vector<NonStandardGroupId> group_ids_;
};
+
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<bool>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<int32_t>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<uint32_t>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<int64_t>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<uint64_t>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<double>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::string>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<bool>>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<int32_t>>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<uint32_t>>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<int64_t>>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<uint64_t>>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<double>>;
+extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<std::string>>;
+
} // namespace webrtc
#endif // API_STATS_RTC_STATS_H_
diff --git a/stats/rtc_stats.cc b/stats/rtc_stats.cc
index 92f64e4..d0a8653 100644
--- a/stats/rtc_stats.cc
+++ b/stats/rtc_stats.cc
@@ -231,4 +231,33 @@
VectorOfStringsToString(value_),
VectorOfStringsToString(value_));
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<bool>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<int32_t>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<uint32_t>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<int64_t>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<uint64_t>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<double>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::string>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<bool>>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<int32_t>>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<uint32_t>>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<int64_t>>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<uint64_t>>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<double>>;
+template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT)
+ RTCNonStandardStatsMember<std::vector<std::string>>;
+
} // namespace webrtc