@@ -63,10 +63,9 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueueBase {
6363 // Note that this guarantee does not apply to delayed tasks.
6464 //
6565 // May be called on any thread or task queue, including this task queue.
66- // TODO(crbug.com/1416199): Remove virtual and pass location of the caller
67- // once subclasses migrated.
68- virtual void PostTask (absl::AnyInvocable<void () &&> task) {
69- PostTaskImpl (std::move (task), PostTaskTraits{}, Location::Current ());
66+ void PostTask (absl::AnyInvocable<void () &&> task,
67+ const Location& location = Location::Current()) {
68+ PostTaskImpl (std::move (task), PostTaskTraits{}, location);
7069 }
7170
7271 // Prefer PostDelayedTask() over PostDelayedHighPrecisionTask() whenever
@@ -92,13 +91,12 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueueBase {
9291 // https://crbug.com/webrtc/13583 for more information.
9392 //
9493 // May be called on any thread or task queue, including this task queue.
95- // TODO(crbug.com/1416199): Remove virtual and pass location of the caller
96- // once subclasses migrated.
97- virtual void PostDelayedTask (absl::AnyInvocable<void () &&> task,
98- TimeDelta delay) {
94+ void PostDelayedTask (absl::AnyInvocable<void () &&> task,
95+ TimeDelta delay,
96+ const Location& location = Location::Current()) {
9997 PostDelayedTaskImpl (std::move (task), delay,
10098 PostDelayedTaskTraits{.high_precision = false },
101- Location::Current () );
99+ location );
102100 }
103101
104102 // Prefer PostDelayedTask() over PostDelayedHighPrecisionTask() whenever
@@ -117,26 +115,28 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueueBase {
117115 // battery, when the timer precision can be as poor as 15 ms.
118116 //
119117 // May be called on any thread or task queue, including this task queue.
120- // TODO(crbug.com/1416199): Remove virtual and pass location of the caller
121- // once subclasses migrated.
122- virtual void PostDelayedHighPrecisionTask (absl::AnyInvocable< void () &&> task ,
123- TimeDelta delay ) {
118+ void PostDelayedHighPrecisionTask (
119+ absl::AnyInvocable< void () &&> task,
120+ TimeDelta delay ,
121+ const Location& location = Location::Current() ) {
124122 PostDelayedTaskImpl (std::move (task), delay,
125123 PostDelayedTaskTraits{.high_precision = true },
126- Location::Current () );
124+ location );
127125 }
128126
129127 // As specified by `precision`, calls either PostDelayedTask() or
130128 // PostDelayedHighPrecisionTask().
131- void PostDelayedTaskWithPrecision (DelayPrecision precision,
132- absl::AnyInvocable<void () &&> task,
133- TimeDelta delay) {
129+ void PostDelayedTaskWithPrecision (
130+ DelayPrecision precision,
131+ absl::AnyInvocable<void () &&> task,
132+ TimeDelta delay,
133+ const Location& location = Location::Current()) {
134134 switch (precision) {
135135 case DelayPrecision::kLow :
136- PostDelayedTask (std::move (task), delay);
136+ PostDelayedTask (std::move (task), delay, location );
137137 break ;
138138 case DelayPrecision::kHigh :
139- PostDelayedHighPrecisionTask (std::move (task), delay);
139+ PostDelayedHighPrecisionTask (std::move (task), delay, location );
140140 break ;
141141 }
142142 }
@@ -173,19 +173,17 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueueBase {
173173
174174 // Subclasses should implement this method to support the behavior defined in
175175 // the PostTask and PostTaskTraits docs above.
176- // TODO(crbug.com/1416199): make pure virtual once subclasses migrate.
177176 virtual void PostTaskImpl (absl::AnyInvocable<void () &&> task,
178177 const PostTaskTraits& traits,
179- const Location& location) {}
178+ const Location& location) = 0;
180179
181180 // Subclasses should implement this method to support the behavior defined in
182181 // the PostDelayedTask/PostHighPrecisionDelayedTask and PostDelayedTaskTraits
183182 // docs above.
184- // TODO(crbug.com/1416199): make pure virtual once subclasses migrate.
185183 virtual void PostDelayedTaskImpl (absl::AnyInvocable<void () &&> task,
186184 TimeDelta delay,
187185 const PostDelayedTaskTraits& traits,
188- const Location& location) {}
186+ const Location& location) = 0;
189187
190188 // Users of the TaskQueue should call Delete instead of directly deleting
191189 // this object.
0 commit comments