Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5bc2efc authored by Wei-Luan Wang's avatar Wei-Luan Wang Committed by Jakub Pawłowski
Browse files

Migrate legacy base::Bind/Closure APIs for SchedulePeriodic

base::Bind and base::Callback are deprecated. Migrate the usages to
proper replacements.

The function |RepeatingTimer::SchedulePeriodic| schedule a job that runs
the |task| periodically so the type of |task| should be a
base::RepeatingClosure. Use base::BindReapting accordingly.

Bug: 272116782
Test: m .
Flag: EXEMPT mechanical refactor
Change-Id: I793f79bcdd9f446724703138ee8e631b0b3d542a
parent 068dbba1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -129,7 +129,8 @@ void start_audio_ticks() {

  wakelock_acquire();
  audio_timer.SchedulePeriodic(
      get_main_thread()->GetWeakPtr(), FROM_HERE, base::Bind(&send_audio_data),
      get_main_thread()->GetWeakPtr(), FROM_HERE,
      base::BindRepeating(&send_audio_data),
#if BASE_VER < 931007
      base::TimeDelta::FromMilliseconds(data_interval_ms));
#else
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ void SourceImpl::StartAudioTicks() {
  wakelock_acquire();
  audio_timer_.SchedulePeriodic(
      worker_thread_->GetWeakPtr(), FROM_HERE,
      base::Bind(&SourceImpl::SendAudioData, base::Unretained(this)),
      base::BindRepeating(&SourceImpl::SendAudioData, base::Unretained(this)),
#if BASE_VER < 931007
      base::TimeDelta::FromMicroseconds(source_codec_config_.data_interval_us));
#else
+1 −1
Original line number Diff line number Diff line
@@ -818,7 +818,7 @@ static void btif_a2dp_source_audio_tx_start_event(void) {
  wakelock_acquire();
  btif_a2dp_source_cb.media_alarm.SchedulePeriodic(
      btif_a2dp_source_thread.GetWeakPtr(), FROM_HERE,
      base::Bind(&btif_a2dp_source_audio_handle_timer),
      base::BindRepeating(&btif_a2dp_source_audio_handle_timer),
#if BASE_VER < 931007
      base::TimeDelta::FromMilliseconds(
#else
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ RepeatingTimer::~RepeatingTimer() {
// This runs on user thread
bool RepeatingTimer::SchedulePeriodic(
    const base::WeakPtr<MessageLoopThread>& thread,
    const base::Location& from_here, base::Closure task,
    const base::Location& from_here, base::RepeatingClosure task,
    base::TimeDelta period) {
  if (period < kMinimumPeriod) {
    LOG(ERROR) << __func__ << ": period must be at least " << kMinimumPeriod;