Delete legacy TimeDelta and Timestamp factories

Bug: webrtc:9709
Change-Id: Ic294a6dc324fde06d868a3d00941b0f2fc970935
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168490
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30510}
This commit is contained in:
Danil Chapovalov
2020-02-12 10:27:44 +01:00
committed by Commit Bot
parent 6799d732d5
commit ea820932d8
3 changed files with 5 additions and 64 deletions

View File

@ -50,35 +50,6 @@ class TimeDelta final : public rtc_units_impl::RelativeUnit<TimeDelta> {
TimeDelta() = delete; TimeDelta() = delete;
// TODO(danilchap): Migrate all code to the 3 factories above and delete the
// 6 factories below.
template <int64_t seconds>
static constexpr TimeDelta Seconds() {
return FromFraction(1'000'000, seconds);
}
template <int64_t ms>
static constexpr TimeDelta Millis() {
return FromFraction(1000, ms);
}
template <int64_t us>
static constexpr TimeDelta Micros() {
return FromValue(us);
}
template <typename T>
static constexpr TimeDelta seconds(T seconds) {
static_assert(std::is_arithmetic<T>::value, "");
return FromFraction(1'000'000, seconds);
}
template <typename T>
static constexpr TimeDelta ms(T milliseconds) {
static_assert(std::is_arithmetic<T>::value, "");
return FromFraction(1000, milliseconds);
}
template <typename T>
static constexpr TimeDelta us(T microseconds) {
static_assert(std::is_arithmetic<T>::value, "");
return FromValue(microseconds);
}
template <typename T = int64_t> template <typename T = int64_t>
constexpr T seconds() const { constexpr T seconds() const {
return ToFraction<1000000, T>(); return ToFraction<1000000, T>();

View File

@ -46,36 +46,6 @@ class Timestamp final : public rtc_units_impl::UnitBase<Timestamp> {
Timestamp() = delete; Timestamp() = delete;
// TODO(danilchap): Migrate all code to the 3 factories above and delete the
// 6 factories below.
template <int64_t seconds>
static constexpr Timestamp Seconds() {
return FromFraction(1'000'000, seconds);
}
template <int64_t ms>
static constexpr Timestamp Millis() {
return FromFraction(1000, ms);
}
template <int64_t us>
static constexpr Timestamp Micros() {
return FromValue(us);
}
template <typename T>
static constexpr Timestamp seconds(T seconds) {
static_assert(std::is_arithmetic<T>::value, "");
return FromFraction(1'000'000, seconds);
}
template <typename T>
static constexpr Timestamp ms(T milliseconds) {
static_assert(std::is_arithmetic<T>::value, "");
return FromFraction(1000, milliseconds);
}
template <typename T>
static constexpr Timestamp us(T microseconds) {
static_assert(std::is_arithmetic<T>::value, "");
return FromValue(microseconds);
}
template <typename T = int64_t> template <typename T = int64_t>
constexpr T seconds() const { constexpr T seconds() const {
return ToFraction<1000000, T>(); return ToFraction<1000000, T>();

View File

@ -299,10 +299,10 @@ TEST_F(GoogCcNetworkControllerTest,
auto send_net = auto send_net =
s.CreateMutableSimulationNode([=](NetworkSimulationConfig* c) { s.CreateMutableSimulationNode([=](NetworkSimulationConfig* c) {
c->bandwidth = DataRate::kbps(1000); c->bandwidth = DataRate::kbps(1000);
c->delay = TimeDelta::ms(100); c->delay = TimeDelta::Millis(100);
}); });
auto ret_net = s.CreateSimulationNode( auto ret_net = s.CreateSimulationNode(
[](NetworkSimulationConfig* c) { c->delay = TimeDelta::ms(100); }); [](NetworkSimulationConfig* c) { c->delay = TimeDelta::Millis(100); });
CallClientConfig config; CallClientConfig config;
config.transport.cc_factory = &factory; config.transport.cc_factory = &factory;
// Start high so bandwidth drop has max effect. // Start high so bandwidth drop has max effect.
@ -313,9 +313,9 @@ TEST_F(GoogCcNetworkControllerTest,
auto* client = CreateVideoSendingClient(&s, std::move(config), auto* client = CreateVideoSendingClient(&s, std::move(config),
{send_net->node()}, {ret_net}); {send_net->node()}, {ret_net});
s.RunFor(TimeDelta::seconds(10)); s.RunFor(TimeDelta::Seconds(10));
send_net->PauseTransmissionUntil(s.Now() + TimeDelta::seconds(10)); send_net->PauseTransmissionUntil(s.Now() + TimeDelta::Seconds(10));
s.RunFor(TimeDelta::seconds(3)); s.RunFor(TimeDelta::Seconds(3));
// As the dropframe is set, after 3 seconds without feedback from any sent // As the dropframe is set, after 3 seconds without feedback from any sent
// packets, we expect that the target rate is not reduced by congestion // packets, we expect that the target rate is not reduced by congestion