Make PendingTaskSafetyFlag compatible with component builds

Bug: chromium:1470992
Change-Id: I06cec9cda36c9de75b970eaf709f9ed3b9f466b4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/317620
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40618}
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index 65bb1ae..527fac4 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -130,6 +130,7 @@
     "../../api:sequence_checker",
     "../../rtc_base:checks",
     "../../rtc_base/system:no_unique_address",
+    "../../rtc_base/system:rtc_export",
   ]
   absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
 }
diff --git a/api/task_queue/pending_task_safety_flag.h b/api/task_queue/pending_task_safety_flag.h
index 3b948ca..7f6a592 100644
--- a/api/task_queue/pending_task_safety_flag.h
+++ b/api/task_queue/pending_task_safety_flag.h
@@ -19,6 +19,7 @@
 #include "api/sequence_checker.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/system/no_unique_address.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -58,7 +59,7 @@
 //
 //   my_task_queue_->PostTask(SafeTask(safety_flag_, [this] { MyMethod(); }));
 //
-class PendingTaskSafetyFlag final
+class RTC_EXPORT PendingTaskSafetyFlag final
     : public rtc::RefCountedNonVirtual<PendingTaskSafetyFlag> {
  public:
   static rtc::scoped_refptr<PendingTaskSafetyFlag> Create();
@@ -116,7 +117,7 @@
 // This should be used by the class that wants tasks dropped after destruction.
 // The requirement is that the instance has to be constructed and destructed on
 // the same thread as the potentially dropped tasks would be running on.
-class ScopedTaskSafety final {
+class RTC_EXPORT ScopedTaskSafety final {
  public:
   ScopedTaskSafety() = default;
   explicit ScopedTaskSafety(rtc::scoped_refptr<PendingTaskSafetyFlag> flag)
@@ -140,7 +141,7 @@
 
 // Like ScopedTaskSafety, but allows construction on a different thread than
 // where the flag will be used.
-class ScopedTaskSafetyDetached final {
+class RTC_EXPORT ScopedTaskSafetyDetached final {
  public:
   ScopedTaskSafetyDetached() = default;
   ~ScopedTaskSafetyDetached() { flag_->SetNotAlive(); }