Mirko Bonadei c35333d1fd Add RTC_EXPORT_TEMPLATE_{DECLARE,DEFINE} macros.
This CL adds macros to correctly export template instantiation
declarations and definitions. These macros have been borrowed from
Chromium's //base/export_template.h [1] and are supposed to be used
together with RTC_EXPORT [2].

The goal is to start using explicit template instatiation declarations
(introduced in C++11) [3] and remove workarounds that are not compatible
with all the compilers. An example can be found in [4], where in order
to workaround crbug.com/1018579, another workaround was almost created
before being stopped at code review time.

[1] - https://cs.chromium.org/chromium/src/base/export_template.h
[2] - https://cs.chromium.org/chromium/src/third_party/webrtc/rtc_base/system/rtc_export.h
[3] - https://en.cppreference.com/w/cpp/language/class_template#Explicit_instantiation
[4] - https://webrtc-review.googlesource.com/c/src/+/158674

Bug: webrtc:9419
Change-Id: I2e9287a15e28f619462e0b9a5deb0b672be248c6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158742
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29661}
2019-10-31 11:12:52 +00:00

112 lines
2.1 KiB
Plaintext

# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../../webrtc.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
rtc_source_set("arch") {
sources = [
"arch.h",
]
}
rtc_source_set("asm_defines") {
sources = [
"asm_defines.h",
]
}
rtc_source_set("fallthrough") {
sources = [
"fallthrough.h",
]
}
rtc_library("file_wrapper") {
sources = [
"file_wrapper.cc",
"file_wrapper.h",
]
deps = [
"..:checks",
"..:criticalsection",
"..:safe_conversions",
]
}
rtc_source_set("ignore_warnings") {
sources = [
"ignore_warnings.h",
]
}
rtc_source_set("inline") {
sources = [
"inline.h",
]
}
rtc_source_set("unused") {
sources = [
"unused.h",
]
}
rtc_source_set("rtc_export") {
sources = [
"rtc_export.h",
"rtc_export_template.h",
]
}
if (is_mac || is_ios) {
rtc_library("cocoa_threading") {
sources = [
"cocoa_threading.h",
"cocoa_threading.mm",
]
deps = [
"..:checks",
]
libs = [ "Foundation.framework" ]
}
}
rtc_source_set("thread_registry") {
sources = [
"thread_registry.h",
]
deps = [
"..:rtc_base_approved",
]
if (is_android && !build_with_chromium) {
sources += [ "thread_registry.cc" ]
deps += [
"../../sdk/android:native_api_stacktrace",
"//third_party/abseil-cpp/absl/base:core_headers",
]
}
}
rtc_source_set("warn_current_thread_is_deadlocked") {
sources = [
"warn_current_thread_is_deadlocked.h",
]
deps = []
if (is_android && !build_with_chromium) {
sources += [ "warn_current_thread_is_deadlocked.cc" ]
deps += [
"..:logging",
"../../sdk/android:native_api_stacktrace",
]
}
}