From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- third_party/libwebrtc/api/metronome/BUILD.gn | 2 +- third_party/libwebrtc/api/metronome/metronome.h | 2 +- third_party/libwebrtc/api/metronome/test/BUILD.gn | 9 +-------- .../libwebrtc/api/metronome/test/fake_metronome.cc | 10 +++++----- .../libwebrtc/api/metronome/test/fake_metronome.h | 17 +++++------------ 5 files changed, 13 insertions(+), 27 deletions(-) (limited to 'third_party/libwebrtc/api/metronome') diff --git a/third_party/libwebrtc/api/metronome/BUILD.gn b/third_party/libwebrtc/api/metronome/BUILD.gn index 3d3d876df0..f879d5f2fb 100644 --- a/third_party/libwebrtc/api/metronome/BUILD.gn +++ b/third_party/libwebrtc/api/metronome/BUILD.gn @@ -13,7 +13,7 @@ rtc_source_set("metronome") { sources = [ "metronome.h" ] deps = [ "../../rtc_base/system:rtc_export", - "../task_queue", "../units:time_delta", ] + absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ] } diff --git a/third_party/libwebrtc/api/metronome/metronome.h b/third_party/libwebrtc/api/metronome/metronome.h index a312b1c862..4d50a3ecd0 100644 --- a/third_party/libwebrtc/api/metronome/metronome.h +++ b/third_party/libwebrtc/api/metronome/metronome.h @@ -11,7 +11,7 @@ #ifndef API_METRONOME_METRONOME_H_ #define API_METRONOME_METRONOME_H_ -#include "api/task_queue/task_queue_base.h" +#include "absl/functional/any_invocable.h" #include "api/units/time_delta.h" #include "rtc_base/system/rtc_export.h" diff --git a/third_party/libwebrtc/api/metronome/test/BUILD.gn b/third_party/libwebrtc/api/metronome/test/BUILD.gn index f415d98a0b..94ecf9f727 100644 --- a/third_party/libwebrtc/api/metronome/test/BUILD.gn +++ b/third_party/libwebrtc/api/metronome/test/BUILD.gn @@ -16,15 +16,8 @@ rtc_library("fake_metronome") { ] deps = [ "..:metronome", - "../..:priority", - "../..:sequence_checker", - "../../../rtc_base:macromagic", - "../../../rtc_base:rtc_event", - "../../../rtc_base:rtc_task_queue", - "../../../rtc_base/synchronization:mutex", - "../../../rtc_base/task_utils:repeating_task", - "../../../test:test_support", "../../task_queue", "../../units:time_delta", ] + absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ] } diff --git a/third_party/libwebrtc/api/metronome/test/fake_metronome.cc b/third_party/libwebrtc/api/metronome/test/fake_metronome.cc index 025f7ce5a6..bd54d5b0ba 100644 --- a/third_party/libwebrtc/api/metronome/test/fake_metronome.cc +++ b/third_party/libwebrtc/api/metronome/test/fake_metronome.cc @@ -13,13 +13,9 @@ #include #include -#include "api/priority.h" -#include "api/sequence_checker.h" +#include "absl/functional/any_invocable.h" #include "api/task_queue/task_queue_base.h" -#include "api/task_queue/task_queue_factory.h" #include "api/units/time_delta.h" -#include "rtc_base/event.h" -#include "rtc_base/task_utils/repeating_task.h" namespace webrtc::test { @@ -49,6 +45,10 @@ void ForcedTickMetronome::Tick() { FakeMetronome::FakeMetronome(TimeDelta tick_period) : tick_period_(tick_period) {} +void FakeMetronome::SetTickPeriod(TimeDelta tick_period) { + tick_period_ = tick_period; +} + void FakeMetronome::RequestCallOnNextTick( absl::AnyInvocable callback) { TaskQueueBase* current = TaskQueueBase::Current(); diff --git a/third_party/libwebrtc/api/metronome/test/fake_metronome.h b/third_party/libwebrtc/api/metronome/test/fake_metronome.h index 73c938e9cd..9702062cf6 100644 --- a/third_party/libwebrtc/api/metronome/test/fake_metronome.h +++ b/third_party/libwebrtc/api/metronome/test/fake_metronome.h @@ -11,18 +11,12 @@ #ifndef API_METRONOME_TEST_FAKE_METRONOME_H_ #define API_METRONOME_TEST_FAKE_METRONOME_H_ -#include -#include +#include #include +#include "absl/functional/any_invocable.h" #include "api/metronome/metronome.h" -#include "api/task_queue/task_queue_base.h" -#include "api/task_queue/task_queue_factory.h" #include "api/units/time_delta.h" -#include "rtc_base/synchronization/mutex.h" -#include "rtc_base/task_queue.h" -#include "rtc_base/task_utils/repeating_task.h" -#include "rtc_base/thread_annotations.h" namespace webrtc::test { @@ -48,19 +42,18 @@ class ForcedTickMetronome : public Metronome { // FakeMetronome is a metronome that ticks based on a repeating task at the // `tick_period` provided in the constructor. It is designed for use with // simulated task queues for unit tests. -// -// `Stop()` must be called before destruction, as it cancels the metronome tick -// on the proper task queue. class FakeMetronome : public Metronome { public: explicit FakeMetronome(TimeDelta tick_period); + void SetTickPeriod(TimeDelta tick_period); + // Metronome implementation. void RequestCallOnNextTick(absl::AnyInvocable callback) override; TimeDelta TickPeriod() const override; private: - const TimeDelta tick_period_; + TimeDelta tick_period_; std::vector> callbacks_; }; -- cgit v1.2.3