Move function_view.h to webrtc namespace

Bug: webrtc:42232595
Change-Id: Ife772922012d1022769d5b969e1733e788eda073
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/380881
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44097}
diff --git a/api/function_view.h b/api/function_view.h
index f853ddb..17f1300 100644
--- a/api/function_view.h
+++ b/api/function_view.h
@@ -37,7 +37,7 @@
 // copyable, so it's probably cheaper to pass it by value than by const
 // reference.
 
-namespace rtc {
+namespace webrtc {
 
 template <typename T>
 class FunctionView;  // Undefined.
@@ -126,6 +126,12 @@
   RetT (*call_)(VoidUnion, ArgT...);
 };
 
+}  //  namespace webrtc
+
+// Re-export symbols from the webrtc namespace for backwards compatibility.
+// TODO(bugs.webrtc.org/4222596): Remove once all references are updated.
+namespace rtc {
+using ::webrtc::FunctionView;
 }  // namespace rtc
 
 #endif  // API_FUNCTION_VIEW_H_
diff --git a/api/function_view_unittest.cc b/api/function_view_unittest.cc
index 156ea5c..8c5f176 100644
--- a/api/function_view_unittest.cc
+++ b/api/function_view_unittest.cc
@@ -15,11 +15,11 @@
 
 #include "test/gtest.h"
 
-namespace rtc {
+namespace webrtc {
 
 namespace {
 
-int CallWith33(rtc::FunctionView<int(int)> fv) {
+int CallWith33(FunctionView<int(int)> fv) {
   return fv ? fv(33) : -1;
 }
 
@@ -40,7 +40,7 @@
 TEST(FunctionViewTest, IntIntLambdaWithoutState) {
   auto f = [](int x) { return x + 1; };
   EXPECT_EQ(18, f(17));
-  rtc::FunctionView<int(int)> fv(f);
+  FunctionView<int(int)> fv(f);
   EXPECT_TRUE(fv);
   EXPECT_EQ(18, fv(17));
 }
@@ -48,7 +48,7 @@
 TEST(FunctionViewTest, IntVoidLambdaWithState) {
   int x = 13;
   auto f = [x]() mutable { return ++x; };
-  rtc::FunctionView<int()> fv(f);
+  FunctionView<int()> fv(f);
   EXPECT_TRUE(fv);
   EXPECT_EQ(14, f());
   EXPECT_EQ(15, fv());
@@ -57,30 +57,30 @@
 }
 
 TEST(FunctionViewTest, IntIntFunction) {
-  rtc::FunctionView<int(int)> fv(Add33);
+  FunctionView<int(int)> fv(Add33);
   EXPECT_TRUE(fv);
   EXPECT_EQ(50, fv(17));
 }
 
 TEST(FunctionViewTest, IntIntFunctionPointer) {
-  rtc::FunctionView<int(int)> fv(&Add33);
+  FunctionView<int(int)> fv(&Add33);
   EXPECT_TRUE(fv);
   EXPECT_EQ(50, fv(17));
 }
 
 TEST(FunctionViewTest, Null) {
   // These two call constructors that statically construct null FunctionViews.
-  EXPECT_FALSE(rtc::FunctionView<int()>());
-  EXPECT_FALSE(rtc::FunctionView<int()>(nullptr));
+  EXPECT_FALSE(FunctionView<int()>());
+  EXPECT_FALSE(FunctionView<int()>(nullptr));
 
   // This calls the constructor for function pointers.
-  EXPECT_FALSE(rtc::FunctionView<int()>(reinterpret_cast<int (*)()>(0)));
+  EXPECT_FALSE(FunctionView<int()>(reinterpret_cast<int (*)()>(0)));
 }
 
 // Ensure that FunctionView handles move-only arguments and return values.
 TEST(FunctionViewTest, UniquePtrPassthrough) {
   auto f = [](std::unique_ptr<int> x) { return x; };
-  rtc::FunctionView<std::unique_ptr<int>(std::unique_ptr<int>)> fv(f);
+  FunctionView<std::unique_ptr<int>(std::unique_ptr<int>)> fv(f);
   std::unique_ptr<int> x(new int);
   int* x_addr = x.get();
   auto y = fv(std::move(x));
@@ -89,25 +89,25 @@
 
 TEST(FunctionViewTest, CopyConstructor) {
   auto f17 = [] { return 17; };
-  rtc::FunctionView<int()> fv1(f17);
-  rtc::FunctionView<int()> fv2(fv1);
+  FunctionView<int()> fv1(f17);
+  FunctionView<int()> fv2(fv1);
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(17, fv2());
 }
 
 TEST(FunctionViewTest, MoveConstructorIsCopy) {
   auto f17 = [] { return 17; };
-  rtc::FunctionView<int()> fv1(f17);
-  rtc::FunctionView<int()> fv2(std::move(fv1));  // NOLINT
+  FunctionView<int()> fv1(f17);
+  FunctionView<int()> fv2(std::move(fv1));  // NOLINT
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(17, fv2());
 }
 
 TEST(FunctionViewTest, CopyAssignment) {
   auto f17 = [] { return 17; };
-  rtc::FunctionView<int()> fv1(f17);
+  FunctionView<int()> fv1(f17);
   auto f23 = [] { return 23; };
-  rtc::FunctionView<int()> fv2(f23);
+  FunctionView<int()> fv2(f23);
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(23, fv2());
   fv2 = fv1;
@@ -117,9 +117,9 @@
 
 TEST(FunctionViewTest, MoveAssignmentIsCopy) {
   auto f17 = [] { return 17; };
-  rtc::FunctionView<int()> fv1(f17);
+  FunctionView<int()> fv1(f17);
   auto f23 = [] { return 23; };
-  rtc::FunctionView<int()> fv2(f23);
+  FunctionView<int()> fv2(f23);
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(23, fv2());
   fv2 = std::move(fv1);  // NOLINT
@@ -129,9 +129,9 @@
 
 TEST(FunctionViewTest, Swap) {
   auto f17 = [] { return 17; };
-  rtc::FunctionView<int()> fv1(f17);
+  FunctionView<int()> fv1(f17);
   auto f23 = [] { return 23; };
-  rtc::FunctionView<int()> fv2(f23);
+  FunctionView<int()> fv2(f23);
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(23, fv2());
   using std::swap;
@@ -145,8 +145,8 @@
 // the old one).
 TEST(FunctionViewTest, CopyConstructorChaining) {
   auto f17 = [] { return 17; };
-  rtc::FunctionView<int()> fv1(f17);
-  rtc::FunctionView<int()> fv2(fv1);
+  FunctionView<int()> fv1(f17);
+  FunctionView<int()> fv2(fv1);
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(17, fv2());
   auto f23 = [] { return 23; };
@@ -159,8 +159,8 @@
 // copy (as opposed to making the second FunctionView point to the first one).
 TEST(FunctionViewTest, CopyAssignmentChaining) {
   auto f17 = [] { return 17; };
-  rtc::FunctionView<int()> fv1(f17);
-  rtc::FunctionView<int()> fv2;
+  FunctionView<int()> fv1(f17);
+  FunctionView<int()> fv2;
   EXPECT_TRUE(fv1);
   EXPECT_EQ(17, fv1());
   EXPECT_FALSE(fv2);
@@ -173,4 +173,4 @@
   EXPECT_EQ(17, fv2());
 }
 
-}  // namespace rtc
+}  // namespace webrtc
diff --git a/api/sequence_checker_unittest.cc b/api/sequence_checker_unittest.cc
index 3579fa1..adf5bd0 100644
--- a/api/sequence_checker_unittest.cc
+++ b/api/sequence_checker_unittest.cc
@@ -47,7 +47,7 @@
   ::webrtc::SequenceChecker sequence_checker_;
 };
 
-void RunOnDifferentThread(rtc::FunctionView<void()> run) {
+void RunOnDifferentThread(FunctionView<void()> run) {
   rtc::Event thread_has_run_event;
   rtc::PlatformThread::SpawnJoinable(
       [&] {
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 7b000341..75f512f 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -144,9 +144,9 @@
   void SetEncoder(int payload_type,
                   const SdpAudioFormat& encoder_format,
                   std::unique_ptr<AudioEncoder> encoder) override;
-  void ModifyEncoder(rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)>
-                         modifier) override;
-  void CallEncoder(rtc::FunctionView<void(AudioEncoder*)> modifier) override;
+  void ModifyEncoder(
+      FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) override;
+  void CallEncoder(FunctionView<void(AudioEncoder*)> modifier) override;
 
   // API methods
   void StartSend() override;
@@ -620,14 +620,14 @@
 }
 
 void ChannelSend::ModifyEncoder(
-    rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) {
+    FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) {
   // This method can be called on the worker thread, module process thread
   // or network thread. Audio coding is thread safe, so we do not need to
   // enforce the calling thread.
   audio_coding_->ModifyEncoder(modifier);
 }
 
-void ChannelSend::CallEncoder(rtc::FunctionView<void(AudioEncoder*)> modifier) {
+void ChannelSend::CallEncoder(FunctionView<void(AudioEncoder*)> modifier) {
   ModifyEncoder([modifier](std::unique_ptr<AudioEncoder>* encoder_ptr) {
     if (*encoder_ptr) {
       modifier(encoder_ptr->get());
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 8cd5b4e..86d5427 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -71,8 +71,8 @@
                           const SdpAudioFormat& encoder_format,
                           std::unique_ptr<AudioEncoder> encoder) = 0;
   virtual void ModifyEncoder(
-      rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) = 0;
-  virtual void CallEncoder(rtc::FunctionView<void(AudioEncoder*)> modifier) = 0;
+      FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) = 0;
+  virtual void CallEncoder(FunctionView<void(AudioEncoder*)> modifier) = 0;
 
   // Use 0 to indicate that the extension should not be registered.
   virtual void SetRTCP_CNAME(absl::string_view c_name) = 0;
diff --git a/audio/mock_voe_channel_proxy.h b/audio/mock_voe_channel_proxy.h
index 31d9984..da55650 100644
--- a/audio/mock_voe_channel_proxy.h
+++ b/audio/mock_voe_channel_proxy.h
@@ -136,11 +136,11 @@
   MOCK_METHOD(
       void,
       ModifyEncoder,
-      (rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier),
+      (webrtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier),
       (override));
   MOCK_METHOD(void,
               CallEncoder,
-              (rtc::FunctionView<void(AudioEncoder*)> modifier),
+              (webrtc::FunctionView<void(AudioEncoder*)> modifier),
               (override));
   MOCK_METHOD(void, SetRTCP_CNAME, (absl::string_view c_name), (override));
   MOCK_METHOD(void,
diff --git a/modules/audio_coding/acm2/audio_coding_module.cc b/modules/audio_coding/acm2/audio_coding_module.cc
index efd7dc4..84b7bf1 100644
--- a/modules/audio_coding/acm2/audio_coding_module.cc
+++ b/modules/audio_coding/acm2/audio_coding_module.cc
@@ -49,8 +49,8 @@
   //   Sender
   //
 
-  void ModifyEncoder(rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)>
-                         modifier) override;
+  void ModifyEncoder(
+      FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) override;
 
   // Register a transport callback which will be
   // called to deliver the encoded buffers.
@@ -300,7 +300,7 @@
 }
 
 void AudioCodingModuleImpl::ModifyEncoder(
-    rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) {
+    FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) {
   MutexLock lock(&acm_mutex_);
   modifier(&encoder_stack_);
 }
diff --git a/modules/audio_coding/include/audio_coding_module.h b/modules/audio_coding/include/audio_coding_module.h
index 0ecfc8a..d4a6a39 100644
--- a/modules/audio_coding/include/audio_coding_module.h
+++ b/modules/audio_coding/include/audio_coding_module.h
@@ -69,7 +69,7 @@
   // access to the unique_ptr; it may call the encoder, steal the encoder and
   // replace it with another encoder or with nullptr, etc.
   virtual void ModifyEncoder(
-      rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) = 0;
+      FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) = 0;
 
   // Utility method for simply replacing the existing encoder with a new one.
   void SetEncoder(std::unique_ptr<AudioEncoder> new_encoder) {
diff --git a/modules/audio_processing/agc2/noise_level_estimator_unittest.cc b/modules/audio_processing/agc2/noise_level_estimator_unittest.cc
index 9d42bfc..eef6da9 100644
--- a/modules/audio_processing/agc2/noise_level_estimator_unittest.cc
+++ b/modules/audio_processing/agc2/noise_level_estimator_unittest.cc
@@ -30,7 +30,7 @@
 
 // Runs the noise estimator on audio generated by 'sample_generator'
 // for kNumIterations. Returns the last noise level estimate.
-float RunEstimator(rtc::FunctionView<float()> sample_generator,
+float RunEstimator(FunctionView<float()> sample_generator,
                    NoiseLevelEstimator& estimator,
                    int sample_rate_hz) {
   const int samples_per_channel =
diff --git a/modules/audio_processing/agc2/rnn_vad/rnn_fc.cc b/modules/audio_processing/agc2/rnn_vad/rnn_fc.cc
index 689e490..3b16d5f 100644
--- a/modules/audio_processing/agc2/rnn_vad/rnn_fc.cc
+++ b/modules/audio_processing/agc2/rnn_vad/rnn_fc.cc
@@ -52,7 +52,7 @@
   return w;
 }
 
-rtc::FunctionView<float(float)> GetActivationFunction(
+FunctionView<float(float)> GetActivationFunction(
     ActivationFunction activation_function) {
   switch (activation_function) {
     case ActivationFunction::kTansigApproximated:
diff --git a/modules/audio_processing/agc2/rnn_vad/rnn_fc.h b/modules/audio_processing/agc2/rnn_vad/rnn_fc.h
index d23957a..e7a1661 100644
--- a/modules/audio_processing/agc2/rnn_vad/rnn_fc.h
+++ b/modules/audio_processing/agc2/rnn_vad/rnn_fc.h
@@ -61,7 +61,7 @@
   const std::vector<float> bias_;
   const std::vector<float> weights_;
   const VectorMath vector_math_;
-  rtc::FunctionView<float(float)> activation_function_;
+  FunctionView<float(float)> activation_function_;
   // Over-allocated array with size equal to `output_size_`.
   std::array<float, kFullyConnectedLayerMaxUnits> output_;
 };
diff --git a/modules/desktop_capture/full_screen_window_detector.cc b/modules/desktop_capture/full_screen_window_detector.cc
index 956a0b4..008df34 100644
--- a/modules/desktop_capture/full_screen_window_detector.cc
+++ b/modules/desktop_capture/full_screen_window_detector.cc
@@ -33,7 +33,7 @@
 
 void FullScreenWindowDetector::UpdateWindowListIfNeeded(
     DesktopCapturer::SourceId original_source_id,
-    rtc::FunctionView<bool(DesktopCapturer::SourceList*)> get_sources) {
+    FunctionView<bool(DesktopCapturer::SourceList*)> get_sources) {
   const bool skip_update = previous_source_id_ != original_source_id;
   previous_source_id_ = original_source_id;
 
diff --git a/modules/desktop_capture/full_screen_window_detector.h b/modules/desktop_capture/full_screen_window_detector.h
index 998b720..c62cb95 100644
--- a/modules/desktop_capture/full_screen_window_detector.h
+++ b/modules/desktop_capture/full_screen_window_detector.h
@@ -55,7 +55,7 @@
   // update internal state no often than twice per second
   void UpdateWindowListIfNeeded(
       DesktopCapturer::SourceId original_source_id,
-      rtc::FunctionView<bool(DesktopCapturer::SourceList*)> get_sources);
+      FunctionView<bool(DesktopCapturer::SourceList*)> get_sources);
 
   static rtc::scoped_refptr<FullScreenWindowDetector>
   CreateFullScreenWindowDetector();
diff --git a/modules/desktop_capture/linux/x11/window_list_utils.cc b/modules/desktop_capture/linux/x11/window_list_utils.cc
index ff2d467..41de4f8 100644
--- a/modules/desktop_capture/linux/x11/window_list_utils.cc
+++ b/modules/desktop_capture/linux/x11/window_list_utils.cc
@@ -120,8 +120,7 @@
   return window_state.is_valid() ? *window_state.data() : WithdrawnState;
 }
 
-bool GetWindowList(XAtomCache* cache,
-                   rtc::FunctionView<bool(::Window)> on_window) {
+bool GetWindowList(XAtomCache* cache, FunctionView<bool(::Window)> on_window) {
   RTC_DCHECK(cache);
   RTC_DCHECK(on_window);
   ::Display* const display = cache->display();
diff --git a/modules/desktop_capture/linux/x11/window_list_utils.h b/modules/desktop_capture/linux/x11/window_list_utils.h
index 923842d..d141b8e 100644
--- a/modules/desktop_capture/linux/x11/window_list_utils.h
+++ b/modules/desktop_capture/linux/x11/window_list_utils.h
@@ -28,8 +28,7 @@
 // native APIs failed. If multiple screens are attached to the `display`, this
 // function returns false only when native APIs failed on all screens. Menus,
 // panels and minimized windows will be ignored.
-bool GetWindowList(XAtomCache* cache,
-                   rtc::FunctionView<bool(::Window)> on_window);
+bool GetWindowList(XAtomCache* cache, FunctionView<bool(::Window)> on_window);
 
 // Returns WM_STATE property of the `window`. This function returns
 // WithdrawnState if the `window` is missing.
diff --git a/modules/desktop_capture/screen_drawer_unittest.cc b/modules/desktop_capture/screen_drawer_unittest.cc
index 584770d..165a39e 100644
--- a/modules/desktop_capture/screen_drawer_unittest.cc
+++ b/modules/desktop_capture/screen_drawer_unittest.cc
@@ -33,7 +33,7 @@
 namespace {
 
 void TestScreenDrawerLock(
-    rtc::FunctionView<std::unique_ptr<ScreenDrawerLock>()> ctor) {
+    FunctionView<std::unique_ptr<ScreenDrawerLock>()> ctor) {
   constexpr int kLockDurationMs = 100;
 
   std::atomic<bool> created(false);
@@ -43,7 +43,7 @@
    public:
     Task(std::atomic<bool>* created,
          const std::atomic<bool>& ready,
-         rtc::FunctionView<std::unique_ptr<ScreenDrawerLock>()> ctor)
+         FunctionView<std::unique_ptr<ScreenDrawerLock>()> ctor)
         : created_(created), ready_(ready), ctor_(ctor) {}
 
     ~Task() = default;
@@ -73,7 +73,7 @@
    private:
     std::atomic<bool>* const created_;
     const std::atomic<bool>& ready_;
-    const rtc::FunctionView<std::unique_ptr<ScreenDrawerLock>()> ctor_;
+    const FunctionView<std::unique_ptr<ScreenDrawerLock>()> ctor_;
   } task(&created, ready, ctor);
 
   auto lock_thread = rtc::PlatformThread::SpawnJoinable(
diff --git a/modules/rtp_rtcp/source/rtcp_packet.h b/modules/rtp_rtcp/source/rtcp_packet.h
index 07deb0f..164173f 100644
--- a/modules/rtp_rtcp/source/rtcp_packet.h
+++ b/modules/rtp_rtcp/source/rtcp_packet.h
@@ -54,7 +54,7 @@
   // max_length bytes, it will be fragmented and multiple calls to this
   // callback will be made.
   using PacketReadyCallback =
-      rtc::FunctionView<void(rtc::ArrayView<const uint8_t> packet)>;
+      FunctionView<void(rtc::ArrayView<const uint8_t> packet)>;
 
   virtual ~RtcpPacket() = default;
 
diff --git a/modules/rtp_rtcp/source/rtcp_packet/congestion_control_feedback_unittest.cc b/modules/rtp_rtcp/source/rtcp_packet/congestion_control_feedback_unittest.cc
index 497f96d..0830560 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/congestion_control_feedback_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/congestion_control_feedback_unittest.cc
@@ -131,7 +131,7 @@
 
   rtc::Buffer buf(fb.BlockLength());
   size_t position = 0;
-  rtc::FunctionView<void(rtc::ArrayView<const uint8_t> packet)> callback;
+  FunctionView<void(rtc::ArrayView<const uint8_t> packet)> callback;
   EXPECT_TRUE(fb.Create(buf.data(), &position, buf.capacity(), callback));
 }
 
diff --git a/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc b/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
index 29de7d8..b610d3e 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
@@ -366,7 +366,7 @@
 }
 
 void TransportFeedback::ForAllPackets(
-    rtc::FunctionView<void(uint16_t, TimeDelta)> handler) const {
+    FunctionView<void(uint16_t, TimeDelta)> handler) const {
   TimeDelta delta_since_base = TimeDelta::Zero();
   auto received_it = received_packets_.begin();
   const uint16_t last_seq_num = base_seq_no_ + num_seq_no_;
diff --git a/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h b/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h
index 4d17b54..b2e47d4 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h
+++ b/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h
@@ -72,8 +72,8 @@
   // `BaseTime()`. For missed packets calls `handler` with `delta_since_base =
   // PlusInfinity()`.
   void ForAllPackets(
-      rtc::FunctionView<void(uint16_t sequence_number,
-                             TimeDelta delta_since_base)> handler) const;
+      FunctionView<void(uint16_t sequence_number, TimeDelta delta_since_base)>
+          handler) const;
 
   uint16_t GetBaseSequence() const;
 
diff --git a/modules/rtp_rtcp/source/rtp_packet_history.cc b/modules/rtp_rtcp/source/rtp_packet_history.cc
index 86ba03a..3aa9ee6 100644
--- a/modules/rtp_rtcp/source/rtp_packet_history.cc
+++ b/modules/rtp_rtcp/source/rtp_packet_history.cc
@@ -151,7 +151,7 @@
 
 std::unique_ptr<RtpPacketToSend> RtpPacketHistory::GetPacketAndMarkAsPending(
     uint16_t sequence_number,
-    rtc::FunctionView<std::unique_ptr<RtpPacketToSend>(const RtpPacketToSend&)>
+    FunctionView<std::unique_ptr<RtpPacketToSend>(const RtpPacketToSend&)>
         encapsulate) {
   MutexLock lock(&lock_);
   if (mode_ == StorageMode::kDisabled) {
@@ -245,7 +245,7 @@
 }
 
 std::unique_ptr<RtpPacketToSend> RtpPacketHistory::GetPayloadPaddingPacket(
-    rtc::FunctionView<std::unique_ptr<RtpPacketToSend>(const RtpPacketToSend&)>
+    FunctionView<std::unique_ptr<RtpPacketToSend>(const RtpPacketToSend&)>
         encapsulate) {
   MutexLock lock(&lock_);
   if (mode_ == StorageMode::kDisabled) {
diff --git a/modules/rtp_rtcp/source/rtp_packet_history.h b/modules/rtp_rtcp/source/rtp_packet_history.h
index 8f34222..e7898b3 100644
--- a/modules/rtp_rtcp/source/rtp_packet_history.h
+++ b/modules/rtp_rtcp/source/rtp_packet_history.h
@@ -91,8 +91,8 @@
   // packet will not be marked as pending.
   std::unique_ptr<RtpPacketToSend> GetPacketAndMarkAsPending(
       uint16_t sequence_number,
-      rtc::FunctionView<std::unique_ptr<RtpPacketToSend>(
-          const RtpPacketToSend&)> encapsulate);
+      FunctionView<std::unique_ptr<RtpPacketToSend>(const RtpPacketToSend&)>
+          encapsulate);
 
   // Updates the send time for the given packet and increments the transmission
   // counter. Marks the packet as no longer being in the pacer queue.
@@ -113,8 +113,8 @@
   // container, or to abort getting the packet if the function returns
   // nullptr.
   std::unique_ptr<RtpPacketToSend> GetPayloadPaddingPacket(
-      rtc::FunctionView<std::unique_ptr<RtpPacketToSend>(
-          const RtpPacketToSend&)> encapsulate);
+      FunctionView<std::unique_ptr<RtpPacketToSend>(const RtpPacketToSend&)>
+          encapsulate);
 
   // Cull packets that have been acknowledged as received by the remote end.
   void CullAcknowledgedPackets(rtc::ArrayView<const uint16_t> sequence_numbers);
diff --git a/pc/peer_connection_wrapper.cc b/pc/peer_connection_wrapper.cc
index 030c4de..10bce74 100644
--- a/pc/peer_connection_wrapper.cc
+++ b/pc/peer_connection_wrapper.cc
@@ -154,7 +154,7 @@
 }
 
 std::unique_ptr<SessionDescriptionInterface> PeerConnectionWrapper::CreateSdp(
-    rtc::FunctionView<void(CreateSessionDescriptionObserver*)> fn,
+    FunctionView<void(CreateSessionDescriptionObserver*)> fn,
     std::string* error_out) {
   auto observer = rtc::make_ref_counted<MockCreateSessionDescriptionObserver>();
   fn(observer.get());
@@ -216,7 +216,7 @@
 }
 
 bool PeerConnectionWrapper::SetSdp(
-    rtc::FunctionView<void(SetSessionDescriptionObserver*)> fn,
+    FunctionView<void(SetSessionDescriptionObserver*)> fn,
     std::string* error_out) {
   auto observer = rtc::make_ref_counted<MockSetSessionDescriptionObserver>();
   fn(observer.get());
diff --git a/pc/peer_connection_wrapper.h b/pc/peer_connection_wrapper.h
index d87324f..a72f2a0 100644
--- a/pc/peer_connection_wrapper.h
+++ b/pc/peer_connection_wrapper.h
@@ -194,9 +194,9 @@
 
  private:
   std::unique_ptr<SessionDescriptionInterface> CreateSdp(
-      rtc::FunctionView<void(CreateSessionDescriptionObserver*)> fn,
+      FunctionView<void(CreateSessionDescriptionObserver*)> fn,
       std::string* error_out);
-  bool SetSdp(rtc::FunctionView<void(SetSessionDescriptionObserver*)> fn,
+  bool SetSdp(FunctionView<void(SetSessionDescriptionObserver*)> fn,
               std::string* error_out);
 
   rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_;
diff --git a/pc/test/svc_e2e_tests.cc b/pc/test/svc_e2e_tests.cc
index 19a6a5d..eba19b0 100644
--- a/pc/test/svc_e2e_tests.cc
+++ b/pc/test/svc_e2e_tests.cc
@@ -76,8 +76,8 @@
                   TimeController& time_controller,
                   std::pair<EmulatedNetworkManagerInterface*,
                             EmulatedNetworkManagerInterface*> network_links,
-                  rtc::FunctionView<void(PeerConfigurer*)> alice_configurer,
-                  rtc::FunctionView<void(PeerConfigurer*)> bob_configurer,
+                  FunctionView<void(PeerConfigurer*)> alice_configurer,
+                  FunctionView<void(PeerConfigurer*)> bob_configurer,
                   std::unique_ptr<VideoQualityAnalyzerInterface>
                       video_quality_analyzer = nullptr) {
   auto fixture = webrtc_pc_e2e::CreatePeerConnectionE2EQualityTestFixture(
diff --git a/rtc_base/callback_list.cc b/rtc_base/callback_list.cc
index c452c79..e938f96 100644
--- a/rtc_base/callback_list.cc
+++ b/rtc_base/callback_list.cc
@@ -67,8 +67,7 @@
   }
 }
 
-void CallbackListReceivers::Foreach(
-    rtc::FunctionView<void(UntypedFunction&)> fv) {
+void CallbackListReceivers::Foreach(FunctionView<void(UntypedFunction&)> fv) {
   RTC_CHECK(!send_in_progress_);
   bool removals_detected = false;
   send_in_progress_ = true;
diff --git a/rtc_base/callback_list.h b/rtc_base/callback_list.h
index a9d71a6..73a6974 100644
--- a/rtc_base/callback_list.h
+++ b/rtc_base/callback_list.h
@@ -49,7 +49,7 @@
 
   void RemoveReceivers(const void* removal_tag);
 
-  void Foreach(rtc::FunctionView<void(UntypedFunction&)> fv);
+  void Foreach(FunctionView<void(UntypedFunction&)> fv);
 
  private:
   // Special protected pointer value that's used as a removal_tag for
diff --git a/rtc_base/task_queue_for_test.h b/rtc_base/task_queue_for_test.h
index b54b1da..c0f7aad 100644
--- a/rtc_base/task_queue_for_test.h
+++ b/rtc_base/task_queue_for_test.h
@@ -23,8 +23,7 @@
 
 namespace webrtc {
 
-inline void SendTask(TaskQueueBase* task_queue,
-                     rtc::FunctionView<void()> task) {
+inline void SendTask(TaskQueueBase* task_queue, FunctionView<void()> task) {
   if (task_queue->IsCurrent()) {
     task();
     return;
@@ -73,9 +72,7 @@
 
   // A convenience, test-only method that blocks the current thread while
   // a task executes on the task queue.
-  void SendTask(rtc::FunctionView<void()> task) {
-    ::webrtc::SendTask(Get(), task);
-  }
+  void SendTask(FunctionView<void()> task) { ::webrtc::SendTask(Get(), task); }
 
   // Wait for the completion of all tasks posted prior to the
   // WaitForPreviouslyPostedTasks() call.
diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc
index a091de82..a082627 100644
--- a/rtc_base/thread.cc
+++ b/rtc_base/thread.cc
@@ -723,7 +723,7 @@
   Join();
 }
 
-void Thread::BlockingCallImpl(rtc::FunctionView<void()> functor,
+void Thread::BlockingCallImpl(webrtc::FunctionView<void()> functor,
                               const webrtc::Location& /* location */) {
   TRACE_EVENT0("webrtc", "Thread::BlockingCall");
 
diff --git a/rtc_base/thread.h b/rtc_base/thread.h
index 1f48b6d..b126da0 100644
--- a/rtc_base/thread.h
+++ b/rtc_base/thread.h
@@ -310,7 +310,7 @@
   // NOTE: Blocking calls are DISCOURAGED, consider if what you're doing can
   // be achieved with PostTask() and callbacks instead.
   void BlockingCall(
-      FunctionView<void()> functor,
+      webrtc::FunctionView<void()> functor,
       const webrtc::Location& location = webrtc::Location::Current()) {
     BlockingCallImpl(std::move(functor), location);
   }
@@ -423,7 +423,7 @@
                            const PostDelayedTaskTraits& traits,
                            const webrtc::Location& location) override;
 
-  virtual void BlockingCallImpl(FunctionView<void()> functor,
+  virtual void BlockingCallImpl(webrtc::FunctionView<void()> functor,
                                 const webrtc::Location& location);
 
   // Perform initialization, subclasses must call this from their constructor
diff --git a/rtc_tools/rtc_event_log_visualizer/analyze_audio.cc b/rtc_tools/rtc_event_log_visualizer/analyze_audio.cc
index 967b2eb..b6c6e08 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyze_audio.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyze_audio.cc
@@ -363,9 +363,9 @@
     const ParsedRtcEventLog& parsed_log,
     const AnalyzerConfig& config,
     const NetEqStatsGetterMap& neteq_stats,
-    rtc::FunctionView<const std::vector<std::pair<int64_t, NetEqStatsType>>*(
+    FunctionView<const std::vector<std::pair<int64_t, NetEqStatsType>>*(
         const test::NetEqStatsGetter*)> data_extractor,
-    rtc::FunctionView<float(const NetEqStatsType&)> stats_extractor,
+    FunctionView<float(const NetEqStatsType&)> stats_extractor,
     const std::string& plot_name,
     Plot* plot) {
   std::map<uint32_t, TimeSeries> time_series;
@@ -398,7 +398,7 @@
     const ParsedRtcEventLog& parsed_log,
     const AnalyzerConfig& config,
     const NetEqStatsGetterMap& neteq_stats,
-    rtc::FunctionView<float(const NetEqNetworkStatistics&)> stats_extractor,
+    FunctionView<float(const NetEqNetworkStatistics&)> stats_extractor,
     const std::string& plot_name,
     Plot* plot) {
   CreateNetEqStatsGraphInternal<NetEqNetworkStatistics>(
@@ -413,7 +413,7 @@
     const ParsedRtcEventLog& parsed_log,
     const AnalyzerConfig& config,
     const NetEqStatsGetterMap& neteq_stats,
-    rtc::FunctionView<float(const NetEqLifetimeStatistics&)> stats_extractor,
+    FunctionView<float(const NetEqLifetimeStatistics&)> stats_extractor,
     const std::string& plot_name,
     Plot* plot) {
   CreateNetEqStatsGraphInternal<NetEqLifetimeStatistics>(
diff --git a/rtc_tools/rtc_event_log_visualizer/analyze_audio.h b/rtc_tools/rtc_event_log_visualizer/analyze_audio.h
index 586d6ce..c5132f2 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyze_audio.h
+++ b/rtc_tools/rtc_event_log_visualizer/analyze_audio.h
@@ -60,14 +60,14 @@
     const ParsedRtcEventLog& parsed_log,
     const AnalyzerConfig& config,
     const NetEqStatsGetterMap& neteq_stats_getters,
-    rtc::FunctionView<float(const NetEqNetworkStatistics&)> stats_extractor,
+    FunctionView<float(const NetEqNetworkStatistics&)> stats_extractor,
     const std::string& plot_name,
     Plot* plot);
 void CreateNetEqLifetimeStatsGraph(
     const ParsedRtcEventLog& parsed_log,
     const AnalyzerConfig& config,
     const NetEqStatsGetterMap& neteq_stats_getters,
-    rtc::FunctionView<float(const NetEqLifetimeStatistics&)> stats_extractor,
+    FunctionView<float(const NetEqLifetimeStatistics&)> stats_extractor,
     const std::string& plot_name,
     Plot* plot);
 
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.cc b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
index 1313109..6f8abce 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
@@ -2156,7 +2156,7 @@
 
 void EventLogAnalyzer::CreateSenderAndReceiverReportPlot(
     PacketDirection direction,
-    rtc::FunctionView<float(const rtcp::ReportBlock&)> fy,
+    FunctionView<float(const rtcp::ReportBlock&)> fy,
     std::string title,
     std::string yaxis_label,
     Plot* plot) const {
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.h b/rtc_tools/rtc_event_log_visualizer/analyzer.h
index 5432cb5..5bb0840 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer.h
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer.h
@@ -127,7 +127,7 @@
   void CreateTimestampGraph(PacketDirection direction, Plot* plot) const;
   void CreateSenderAndReceiverReportPlot(
       PacketDirection direction,
-      rtc::FunctionView<float(const rtcp::ReportBlock&)> fy,
+      FunctionView<float(const rtcp::ReportBlock&)> fy,
       std::string title,
       std::string yaxis_label,
       Plot* plot) const;
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_common.h b/rtc_tools/rtc_event_log_visualizer/analyzer_common.h
index 1513ace..d2698f8 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer_common.h
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer_common.h
@@ -103,8 +103,8 @@
 // For each element in data_view, use `f()` to extract a y-coordinate and
 // store the result in a TimeSeries.
 template <typename DataType, typename IterableType>
-void ProcessPoints(rtc::FunctionView<float(const DataType&)> fx,
-                   rtc::FunctionView<std::optional<float>(const DataType&)> fy,
+void ProcessPoints(FunctionView<float(const DataType&)> fx,
+                   FunctionView<std::optional<float>(const DataType&)> fy,
                    const IterableType& data_view,
                    TimeSeries* result) {
   for (size_t i = 0; i < data_view.size(); i++) {
@@ -120,12 +120,11 @@
 // y-coordinate and store the result in a TimeSeries. Note that the x-coordinate
 // will be the time of the second element in the pair.
 template <typename DataType, typename ResultType, typename IterableType>
-void ProcessPairs(
-    rtc::FunctionView<float(const DataType&)> fx,
-    rtc::FunctionView<std::optional<ResultType>(const DataType&,
-                                                const DataType&)> fy,
-    const IterableType& data,
-    TimeSeries* result) {
+void ProcessPairs(FunctionView<float(const DataType&)> fx,
+                  FunctionView<std::optional<ResultType>(const DataType&,
+                                                         const DataType&)> fy,
+                  const IterableType& data,
+                  TimeSeries* result) {
   for (size_t i = 1; i < data.size(); i++) {
     float x = fx(data[i]);
     std::optional<ResultType> y = fy(data[i - 1], data[i]);
@@ -139,9 +138,9 @@
 // will be the time of the second element in the pair.
 template <typename DataType, typename ResultType, typename IterableType>
 void AccumulatePairs(
-    rtc::FunctionView<float(const DataType&)> fx,
-    rtc::FunctionView<std::optional<ResultType>(const DataType&,
-                                                const DataType&)> fy,
+    FunctionView<float(const DataType&)> fx,
+    FunctionView<std::optional<ResultType>(const DataType&, const DataType&)>
+        fy,
     const IterableType& data,
     TimeSeries* result) {
   ResultType sum = 0;
@@ -160,11 +159,10 @@
 // to `end_time`. The value of each data point is the average of the data
 // during the preceding `window_duration_us` microseconds.
 template <typename DataType, typename ResultType, typename IterableType>
-void MovingAverage(
-    rtc::FunctionView<std::optional<ResultType>(const DataType&)> fy,
-    const IterableType& data_view,
-    AnalyzerConfig config,
-    TimeSeries* result) {
+void MovingAverage(FunctionView<std::optional<ResultType>(const DataType&)> fy,
+                   const IterableType& data_view,
+                   AnalyzerConfig config,
+                   TimeSeries* result) {
   size_t window_index_begin = 0;
   size_t window_index_end = 0;
   ResultType sum_in_window = 0;
diff --git a/rtc_tools/unpack_aecdump/unpack.cc b/rtc_tools/unpack_aecdump/unpack.cc
index 7c973e9..ce0762b 100644
--- a/rtc_tools/unpack_aecdump/unpack.cc
+++ b/rtc_tools/unpack_aecdump/unpack.cc
@@ -199,8 +199,8 @@
  public:
   RuntimeSettingWriter(
       std::string name,
-      rtc::FunctionView<bool(const Event)> is_exporter_for,
-      rtc::FunctionView<std::string(const Event)> get_timeline_label)
+      FunctionView<bool(const Event)> is_exporter_for,
+      FunctionView<std::string(const Event)> get_timeline_label)
       : setting_name_(std::move(name)),
         is_exporter_for_(is_exporter_for),
         get_timeline_label_(get_timeline_label) {}
@@ -245,8 +245,8 @@
   FILE* file_ = nullptr;
   int frame_offset_ = 0;
   const std::string setting_name_;
-  const rtc::FunctionView<bool(Event)> is_exporter_for_;
-  const rtc::FunctionView<std::string(Event)> get_timeline_label_;
+  const FunctionView<bool(Event)> is_exporter_for_;
+  const FunctionView<std::string(Event)> get_timeline_label_;
 };
 
 // Returns RuntimeSetting exporters for runtime setting types defined in
diff --git a/test/pc/e2e/peer_connection_e2e_smoke_test.cc b/test/pc/e2e/peer_connection_e2e_smoke_test.cc
index e36e4d7..acfed97 100644
--- a/test/pc/e2e/peer_connection_e2e_smoke_test.cc
+++ b/test/pc/e2e/peer_connection_e2e_smoke_test.cc
@@ -81,7 +81,7 @@
   }
 
   void AddPeer(EmulatedNetworkManagerInterface* network,
-               rtc::FunctionView<void(PeerConfigurer*)> update_configurer) {
+               FunctionView<void(PeerConfigurer*)> update_configurer) {
     auto configurer = std::make_unique<PeerConfigurer>(*network);
     update_configurer(configurer.get());
     fixture_->AddPeer(std::move(configurer));
diff --git a/test/time_controller/simulated_thread.cc b/test/time_controller/simulated_thread.cc
index e8a5a22..80ff830 100644
--- a/test/time_controller/simulated_thread.cc
+++ b/test/time_controller/simulated_thread.cc
@@ -61,7 +61,7 @@
   }
 }
 
-void SimulatedThread::BlockingCallImpl(rtc::FunctionView<void()> functor,
+void SimulatedThread::BlockingCallImpl(FunctionView<void()> functor,
                                        const Location& /*location*/) {
   if (IsQuitting())
     return;
diff --git a/test/time_controller/simulated_thread.h b/test/time_controller/simulated_thread.h
index 8c6c728..77bd701 100644
--- a/test/time_controller/simulated_thread.h
+++ b/test/time_controller/simulated_thread.h
@@ -36,7 +36,7 @@
   TaskQueueBase* GetAsTaskQueue() override { return this; }
 
   // Thread interface
-  void BlockingCallImpl(rtc::FunctionView<void()> functor,
+  void BlockingCallImpl(FunctionView<void()> functor,
                         const Location& location) override;
   void PostTaskImpl(absl::AnyInvocable<void() &&> task,
                     const PostTaskTraits& traits,
diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc
index c4a053e..7365975 100644
--- a/video/pc_full_stack_tests.cc
+++ b/video/pc_full_stack_tests.cc
@@ -55,8 +55,8 @@
                   TimeController& time_controller,
                   std::pair<EmulatedNetworkManagerInterface*,
                             EmulatedNetworkManagerInterface*> network_links,
-                  rtc::FunctionView<void(PeerConfigurer*)> alice_configurer,
-                  rtc::FunctionView<void(PeerConfigurer*)> bob_configurer) {
+                  FunctionView<void(PeerConfigurer*)> alice_configurer,
+                  FunctionView<void(PeerConfigurer*)> bob_configurer) {
   auto fixture = webrtc_pc_e2e::CreatePeerConnectionE2EQualityTestFixture(
       test_case_name, time_controller, /*audio_quality_analyzer=*/nullptr,
       /*video_quality_analyzer=*/nullptr);