Commit graph

64 commits

Author SHA1 Message Date
Danil Chapovalov
9e09a1f327 Replace Thread::Invoke with Thread::BlockingCall
BlockingCall doesn't take rtc::Location parameter and thus most of the dependencies on location can be removed

Bug: webrtc:11318
Change-Id: I91a17e342dd9a9e3e2c8f7fbe267474c98a8d0e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274620
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38045}
2022-09-09 10:44:17 +00:00
Danil Chapovalov
7c323ad47c in rtc::Thread introduce Invoke without rtc::Location parameter
To reduce usage of rtc::MessageHandler, hide rtc::Thread::Send into private section with intention to deprecate it in favor of the new Invoke function.

Bug: webrtc:9702, webrtc:11318
Change-Id: Ib4c26f9abc361e05a45b2a91929af58ab160b3f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274166
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38036}
2022-09-08 15:00:40 +00:00
Markus Handell
9a21c49337 SocketServer: Migrate Wait/kForever to TimeDelta.
Bug: webrtc:13756
Change-Id: Ie36ca38b1ab336742231b101ef7bb5ccf3735659
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272102
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37903}
2022-08-25 13:01:34 +00:00
Markus Handell
2cfc1af78a Update rtc::Event::Wait call sites to use TimeDelta.
Bug: webrtc:14366
Change-Id: I949c1d26f030696b18153afef977633c9a5bd4cf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272003
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37835}
2022-08-19 10:07:28 +00:00
Markus Handell
1d5be49ff2 rtc::Event: Add TimeDelta support.
This CL adds TimeDelta support to the rtc::Event, and updates
the Wait implementations to work with the improved precision.

Bug: webrtc:14366
Change-Id: Iefeb638b18176a34f4ed2a5131754a7b7e6c9e99
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272002
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37831}
2022-08-19 07:11:06 +00:00
Danil Chapovalov
2aaef45876 Replace Invoke in tests with SendTask test helper
Bug: webrtc:11318
Change-Id: I14e3fbc694d41c785a61c88d8207005c681576c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271540
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37774}
2022-08-12 23:42:16 +00:00
Mirko Bonadei
3b205da7e4 Increase precision of SimulatedTaskQueue (from ms to us).
Bug: b/239155933
Change-Id: I1b90a969b9f781fe2902aa822020590683a04b7d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/270923
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Victor Boivie <boivie@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37719}
2022-08-09 11:34:18 +00:00
Danil Chapovalov
9c125c6603 Migrate test/ to absl::AnyInvocable based TaskQueueBase interface
Bug: webrtc:14245
Change-Id: Ib410d1b03a23e5f00927456f7239c0dc7e68b824
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268184
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37497}
2022-07-08 14:24:54 +00:00
Danil Chapovalov
24b0543ee0 Delete ProcessThread creation from test TimeController as unused
Bug: webrtc:7219
Change-Id: Ia34f24a804b8a1e06b089774e37cac6e6d749e82
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266366
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37311}
2022-06-23 09:41:43 +00:00
Artem Titov
c374d11fac Move to_queued_task.h and pending_task_safety_flag.h into public API
Bug: b/235812579
Change-Id: I9fa3dc4a65044df8b44fff4e9bfeac7233fa381c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266080
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37248}
2022-06-17 09:20:39 +00:00
Markus Handell
9a665402d7 Reland "TaskQueue: unexpose delayed task convenience methods."
This reverts commit 4cd3a0d082.

Reason for revert: Downstream build should be fixed.

Original change's description:
> Revert "TaskQueue: unexpose delayed task convenience methods."
>
> This reverts commit 08bb6295ea.
>
> Reason for revert: Breaks downstream tests
>
> Original change's description:
> > TaskQueue: unexpose delayed task convenience methods.
> >
> > Bug: webrtc:14165
> > Change-Id: Ieb8580670e9e521580afd68cca6ff631fb6df3f8
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265400
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Auto-Submit: Markus Handell <handellm@webrtc.org>
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#37166}
>
> Bug: webrtc:14165
> Change-Id: Ia7368cf205622be448ec0ead5d22f211aa071a29
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265411
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Björn Terelius <terelius@webrtc.org>
> Auto-Submit: Björn Terelius <terelius@webrtc.org>
> Commit-Queue: Björn Terelius <terelius@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#37167}

Bug: webrtc:14165
Change-Id: I3d963d272e8a1431103a5d5fb4568ccacd81119c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265395
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37186}
2022-06-13 07:27:37 +00:00
Björn Terelius
4cd3a0d082 Revert "TaskQueue: unexpose delayed task convenience methods."
This reverts commit 08bb6295ea.

Reason for revert: Breaks downstream tests

Original change's description:
> TaskQueue: unexpose delayed task convenience methods.
>
> Bug: webrtc:14165
> Change-Id: Ieb8580670e9e521580afd68cca6ff631fb6df3f8
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265400
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Auto-Submit: Markus Handell <handellm@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#37166}

Bug: webrtc:14165
Change-Id: Ia7368cf205622be448ec0ead5d22f211aa071a29
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265411
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Björn Terelius <terelius@webrtc.org>
Auto-Submit: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37167}
2022-06-09 15:48:23 +00:00
Markus Handell
08bb6295ea TaskQueue: unexpose delayed task convenience methods.
Bug: webrtc:14165
Change-Id: Ieb8580670e9e521580afd68cca6ff631fb6df3f8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265400
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Markus Handell <handellm@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37166}
2022-06-09 14:08:54 +00:00
Florent Castelli
c3e6e3a3e8 Remove dependency on rtc_base_approved from most targets
Bug: webrtc:9838
Change-Id: Ibd0199803597eff48ca139a5cecdc3209c62c5d2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259873
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36643}
2022-04-25 12:15:30 +00:00
Florent Castelli
aa6d05d268 Move location out of rtc_base_approved
Bug: webrtc:9838
Change-Id: I3510f3d01df532cb228a6cc14be830f6ab81a8e1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258764
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36576}
2022-04-19 21:57:48 +00:00
Florent Castelli
45a0599978 Remove platform_thread from //rtc_base:rtc_base_approved public_deps
While the target has a restricted visibility, since it was in rtc_base_approved
public deps, a lot of targets were able to bypass the visibility check.
So we remove the visibility restrictions and use the dependency explicitely
everywhere instead.

Bug: webrtc:8603
Change-Id: I94a03fdf7f94c54ab72081a58dd648e2cca73d17
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258944
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36566}
2022-04-18 23:12:52 +00:00
Florent Castelli
33d31fbc48 Remove //rtc_base:rtc_event from public deps
Bug: webrtc:8603
Change-Id: Ib99f43043da17723c939b0fe2aa9f3e515462c93
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257911
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36450}
2022-04-05 17:34:09 +00:00
Florent Castelli
4467ad7835 Remove //rtc_base:macromagic from public deps
Bug: webrtc:8603
Change-Id: I9708df48c9bde9f86ba2d1a92a278bb0d09f3865
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257909
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36444}
2022-04-05 12:36:12 +00:00
Henrik Boström
2deee4bbb2 Mark rtc::Thread's versions of PostTask/PostDelayedTask deprecated.
Because rtc::Thread inherits from TaskQueueBase, it already implements
a pair of PostTask/PostDelayedTask methods that we want to keep. But in
addition to those, rtc::Thread defines its own PostTask/PostDelayedTask
using templates. These are the versions that we want to deprecate.

They were originally implemented prior to rtc::Thread inheriting from
TaskQueueBase. We want to deprecate them because...
- We don't want to have multiple code paths that do the same thing.
- We want to move away from rtc::Thread to TaskQueueBase long-term.
- These versions are not overridable in Chromium.
- These versions don't have high/low precision versions of PDT.

Helper methods are added to rtc::Thread so that callers don't have to
wrap every lambda in webrtc::ToQueuedTask() and update dependencies.

Bug: webrtc:13582
Change-Id: I58702c53f4cb3705681bd9f1ea16b7aaa5052c18
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247660
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Markus Handell <handellm@google.com>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35750}
2022-01-20 12:59:27 +00:00
Artem Titov
d3251968d1 Prepare to rename RTC_NOTREACHED to RTC_DCHECK_NOTREACHED
Add implementation of RTC_DCHECK_NOTREACHED equal to the RTC_NOTREACHED.
The new macros will replace the old one when old one's usage will be
removed. The idea of the renaming to provide a clear signal that this
is debug build only macros and will be stripped in the production build.

Bug: webrtc:9065
Change-Id: I4c35d8b03e74a4b3fd1ae75dba2f9c05643101db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237802
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35348}
2021-11-15 21:44:59 +00:00
Niels Möller
d0b8879770 Delete AsyncSocket class, merge into Socket class
Bug: webrtc:13065
Change-Id: I13afee2386ea9c4de0e4fa95133f0c4d3ec826e8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227031
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34787}
2021-08-17 15:39:25 +00:00
Artem Titov
1ee563d5e0 Use backticks not vertical bars to denote variables in comments for /test
Bug: webrtc:12338
Change-Id: I2a33903a79194bb092a17ea1e1505bf2a3377d8b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227027
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34558}
2021-07-27 12:50:31 +00:00
Mirko Bonadei
ea9ae5b8bc Destroy threads and TaskQueue at the end of tests.
On ASan, SimulatedRealTimeControllerConformanceTest is flaky and
triggers `stack-use-after-scope` because on some occasions, the delayed
callback gets invoked when the test is tearing down (the callback
holds a reference to an object allocated on the test function stack).

This CL ensures threads and TaskQueues are stopped when the tests
scope is exited. Some flakiness might remain on realtime tests but
that can only be addressed by increasing the wait.

Bug: webrtc:12954
Change-Id: I4ac1a6682e18bb144a3aeb03921a805e3fb39b2d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225422
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34437}
2021-07-08 12:00:01 +00:00
Markus Handell
049ed447b0 ModuleRtpRtcpImpl2: update test code.
This change prepares for later CLs that partly replaces
logic in the module that depends on the Module system
for logic that depends on task queues.

The change also changes SendTransport::SendRTCP
to schedule packet reception with the simulated time
controller. This fixes the problem that SendRTCP itself
updates the simulated time which makes it hard to
understand the tests.

Finally, GlobalSimulatedTimeController was updated
to support addition of custom SimulatedSequenceRunners
like SendTransport.

Bug: webrtc:11581
Change-Id: I0aa310ad0a10526479ad8c28affc38a413363ffd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222602
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34348}
2021-06-21 23:36:49 +00:00
Artem Titov
d15a575ec3 Use SequenceChecker from public API
Bug: webrtc:12419
Change-Id: I00cca16a0ec70246156ba00b97aa7ae5ccbf5364
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205323
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33220}
2021-02-10 15:04:55 +00:00
Artem Titov
c8421c4c3e Replace rtc::ThreadChecker with webrtc::SequenceChecker
Bug: webrtc:12419
Change-Id: I825c014cc1c4b1dcba5ef300409d44859e971144
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205002
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33136}
2021-02-02 14:56:27 +00:00
Mirko Bonadei
e5f4c6b8d2 Reland "Refactor rtc_base build targets."
This is a reland of 69241a93fb

Fix: The problem was related to NO_MAIN_THREAD_WRAPPING, which
affects https://source.chromium.org/chromium/chromium/src/+/master:third_party/webrtc/rtc_base/thread.cc;l=257-263;drc=7acc2d9fe3a6e3c4d8881d2bdfc9b8968a724cd5.
The original CL didn't attach the definition of the macro
NO_MAIN_THREAD_WRAPPING when building for Chromium (which doesn't have
to be related to //rtc_base anymore but to //rtc_base:threading).

Original change's description:
> Refactor rtc_base build targets.
>
> The "//rtc_base:rtc_base" build target has historically been one of the
> biggest targets in the WebRTC build. Big targets are the main source of
> circular dependencies and non-API types leakage.
>
> This CL is a step forward into splitting "//rtc_base:rtc_base" into
> smaller targets (as originally started in 2018).
>
> The only non-automated changes are (like re-wiring the build system):
> * The creation of //rtc_base/async_resolver.{h,cc} which allows to
>   break a circular dependency (is has been extracted from
>   //rtc_base/net_helpers.{h,cc}).
> * The creation of //rtc_base/internal/default_socket_server.{h,cc} to
>   break another circular dependency.
>
> Bug: webrtc:9987
> Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32941}

Bug: webrtc:9987
Change-Id: I7cdf49d2aac8357f1f50f90010bf2c2f62fa19f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/202021
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33001}
2021-01-15 17:00:05 +00:00
Mirko Bonadei
7acc2d9fe3 Revert "Refactor rtc_base build targets."
This reverts commit 69241a93fb.

Reason for revert: Breaks WebRTC roll into Chromium.

Original change's description:
> Refactor rtc_base build targets.
>
> The "//rtc_base:rtc_base" build target has historically been one of the
> biggest targets in the WebRTC build. Big targets are the main source of
> circular dependencies and non-API types leakage.
>
> This CL is a step forward into splitting "//rtc_base:rtc_base" into
> smaller targets (as originally started in 2018).
>
> The only non-automated changes are (like re-wiring the build system):
> * The creation of //rtc_base/async_resolver.{h,cc} which allows to
>   break a circular dependency (is has been extracted from
>   //rtc_base/net_helpers.{h,cc}).
> * The creation of //rtc_base/internal/default_socket_server.{h,cc} to
>   break another circular dependency.
>
> Bug: webrtc:9987
> Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32941}

TBR=mbonadei@webrtc.org,hta@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

No-Try: True
Bug: webrtc:9987
Change-Id: I1e36ad64cc60092f38d6886153a94f1a58339256
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201840
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32986}
2021-01-14 21:27:38 +00:00
Mirko Bonadei
69241a93fb Refactor rtc_base build targets.
The "//rtc_base:rtc_base" build target has historically been one of the
biggest targets in the WebRTC build. Big targets are the main source of
circular dependencies and non-API types leakage.

This CL is a step forward into splitting "//rtc_base:rtc_base" into
smaller targets (as originally started in 2018).

The only non-automated changes are (like re-wiring the build system):
* The creation of //rtc_base/async_resolver.{h,cc} which allows to
  break a circular dependency (is has been extracted from
  //rtc_base/net_helpers.{h,cc}).
* The creation of //rtc_base/internal/default_socket_server.{h,cc} to
  break another circular dependency.

Bug: webrtc:9987
Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32941}
2021-01-11 18:32:30 +00:00
Niels Möller
7c85d395d7 Delete unneeded includes of system_wrappers/include/sleep.h
Non-test usage is in modules/audio_device and modules/desktop_capture.

Bug: None
Change-Id: Ie7dd89aa40e6dcfa9e49e1956b87b50fd9f1c227
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190140
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32484}
2020-10-26 09:55:26 +00:00
Artem Titov
7ade6591f7 Add time controller conformance test and fix conformance bug
Bug: webrtc:11799
Change-Id: I13f79f3ab025c105e56dcb93da5b7631893850e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180125
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31787}
2020-07-25 10:26:29 +00:00
Markus Handell
e56976d2db Reland "Migrate test/time_controller to webrtc::Mutex."
This is a reland of 52fd96fb73

Original change's description:
> Migrate test/time_controller to webrtc::Mutex.
>
> Bug: webrtc:11567
> Change-Id: I26fb07bf84ed197ce667290aa0bf4816bc9c5c06
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178818
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Markus Handell <handellm@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31660}

Bug: webrtc:11567
Change-Id: I4979b6be8ac5ec661e0f18cca4d0c185916233bb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178876
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31687}
2020-07-09 12:52:06 +00:00
Markus Handell
563d497e00 SimulatedTaskQueue: release lock before destroying tasks.
SimulatedTaskQueue::Delete() was unintentionally holding SimulatedTaskQueue::lock_ while destroying the tasks, which led to SimulatedTimeController::lock_ getting taken. The problem is fixed by destroying the tasks outside the lock.

After landing https://webrtc-review.googlesource.com/c/src/+/178818, a downstream test detected a potential deadlock between SimulatedTaskQueue and SimulatedTimeController. While the test deadlock detector did not disclose complete details, it's believed that the deadlock detector reacted because it observed another locking order than it had previously throughout the execution of the test.

Bug: webrtc:11567
Change-Id: If6eafe89e2421f0c5acc6aede3419bd4fe470599
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178875
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31679}
2020-07-08 15:10:30 +00:00
Markus Handell
122fadc608 Revert "Migrate test/time_controller to webrtc::Mutex."
This reverts commit 52fd96fb73.

Reason for revert: previously undetected lock recursions happening in downstream project.

Original change's description:
> Migrate test/time_controller to webrtc::Mutex.
> 
> Bug: webrtc:11567
> Change-Id: I26fb07bf84ed197ce667290aa0bf4816bc9c5c06
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178818
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Markus Handell <handellm@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31660}

TBR=srte@webrtc.org,handellm@webrtc.org

Change-Id: Icccfa32ac21412bc46f75ac7aca76641f5593096
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:11567
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178872
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31668}
2020-07-08 10:17:02 +00:00
Markus Handell
52fd96fb73 Migrate test/time_controller to webrtc::Mutex.
Bug: webrtc:11567
Change-Id: I26fb07bf84ed197ce667290aa0bf4816bc9c5c06
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178818
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31660}
2020-07-08 08:36:47 +00:00
Mirko Bonadei
2dcf348011 Use absl_deps in order to preapre to the Abseil component build release.
Bug: webrtc:1046390
Change-Id: Ia35545599de23b1a2c2d8be2d53469af7ac16f1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176502
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31463}
2020-06-08 12:59:40 +00:00
Markus Handell
222598d1bf SimulatedTimeController: remove lock recursions.
This change removes lock recursions and adds thread annotations.

Bug: webrtc:11567
Change-Id: If6c86adddf006367eefedf10cce819e776e6afc2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175111
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31294}
2020-05-18 07:42:46 +00:00
Danil Chapovalov
14273de88b Make ProcessThread be a TaskQueue implementation
That would allow to switch components from relying on ProcessThreads to
relying on TaskQueue one by one, without introducing new threads.

Bug: webrtc:6289
Change-Id: I18fe5d679d4d4d0ddf4a11900c9814eb570284d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167533
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30631}
2020-02-27 14:29:03 +00:00
Danil Chapovalov
0c626afcf3 Use newer version of TimeDelta and TimeStamp factories in webrtc
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Micros<\(.*\)>()/TimeDelta::Micros(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Millis<\(.*\)>()/TimeDelta::Millis(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Seconds<\(.*\)>()/TimeDelta::Seconds(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::us/TimeDelta::Micros/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::ms/TimeDelta::Millis/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::seconds/TimeDelta::Seconds/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Micros<\(.*\)>()/Timestamp::Micros(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Millis<\(.*\)>()/Timestamp::Millis(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Seconds<\(.*\)>()/Timestamp::Seconds(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::us/Timestamp::Micros/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::ms/Timestamp::Millis/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::seconds/Timestamp::Seconds/g"
git cl format

Bug: None
Change-Id: I87469d2e4a38369654da839ab7c838215a7911e7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168402
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30491}
2020-02-10 12:21:17 +00:00
Sebastian Jansson
8e998f17e0 Fixes stall in SimulatedProcessThread
A previous refactoring introduced an issues in SimulatedProcessThread
causing stalls when task are posted. This CL fixes this and cleans up
the code to make it easier to see that it's correct.

Bug: webrtc:11255
Change-Id: I33d7daa993ad2a4cfe2b63f674692455c2e09d05
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167380
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30429}
2020-01-30 17:37:36 +00:00
philipel
52c62df2ed Don't condition the time_controller target on rtc_include_tests.
Bug: none
Change-Id: Ifb3f811c71a778a447c41593902c417614ae9824
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167723
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30400}
2020-01-29 09:59:34 +00:00
Sebastian Jansson
6ce033a863 Moves ownership of time controller into NetworkEmulationManager.
This makes it easier to maintain consistency between real time
and simulated time modes.

The RealTimeController is updated to use an explicit main thread,
this ensures that pending destruction tasks are run as the network
emulator goes out of scope.

Bug: webrtc:11255
Change-Id: Ie73ab778c78a68d7c58c0f857f14a8d8ac027c67
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166164
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30342}
2020-01-22 11:12:27 +00:00
Sebastian Jansson
274cc7fadf Adds current thread to yielders in SimulatedThread::SendTask.
Bug: webrtc:11255
Change-Id: Ib65b902b60b15f402fac51269c74ac46b56cabc5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166462
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30304}
2020-01-17 15:08:53 +00:00
Sebastian Jansson
fc8279d66c Reland "Using simulated rtc::Thread for peer connection scenario tests."
This is a reland of b70c5c5ce9

Original change's description:
> Using simulated rtc::Thread for peer connection scenario tests.
> 
> Bug: webrtc:11255
> Change-Id: I5d29e997a7209ffc64595082358cca9b2115d07a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165689
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#30258}

Bug: webrtc:11255
Change-Id: If65cd56b59158cebec5609407a721fbdb47cfd1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166046
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30294}
2020-01-17 09:22:18 +00:00
Sebastian Jansson
f1173f46e5 Revert "Using simulated rtc::Thread for peer connection scenario tests."
This reverts commit b70c5c5ce9.

Reason for revert: Interferes with other tests in same binary.

Original change's description:
> Using simulated rtc::Thread for peer connection scenario tests.
> 
> Bug: webrtc:11255
> Change-Id: I5d29e997a7209ffc64595082358cca9b2115d07a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165689
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#30258}

TBR=steveanton@webrtc.org,srte@webrtc.org

Change-Id: If2e60edae264a4bb0dee3abf66ba2078fd85f493
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:11255
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166045
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30259}
2020-01-15 10:10:07 +00:00
Sebastian Jansson
b70c5c5ce9 Using simulated rtc::Thread for peer connection scenario tests.
Bug: webrtc:11255
Change-Id: I5d29e997a7209ffc64595082358cca9b2115d07a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165689
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30258}
2020-01-15 09:35:40 +00:00
Sebastian Jansson
53cd9e2645 Separates simulated TaskQueue and simulated ProcessThread.
The overlap in functionality is quite limited and separating the
functionality makes it a bit easier to follow each. This prepares
for adding a SimulatedThread class in a follow up CL.

Bug: webrtc:11255
Change-Id: I83c754bd570113dfb582098bb4d39e27bb4f4d87
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165688
Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30229}
2020-01-13 11:26:42 +00:00
philipel
d572748885 Run delay tasks on time when using GlobalSimulatedTimeController.
This change means tasks scheduled at the end time reached when making a call to GlobalSimulatedTimeController::AdvanceTime will also be executed.

In other words, with this change, if you schedule a task in X milliseconds and then call AdvanceTime(TimeDelta::ms(X)) the scheduled task will be executed.

Bug: none
Change-Id: I337e574a88b235639e82ffcacf1484daa6cf3172
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/164522
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30146}
2020-01-03 16:37:42 +00:00
Sebastian Jansson
340af975e9 Always enter yield policy scope using simulated TimeControllers.
This makes the class easier to use at a minor cost of making it slightly
more magic.

Bug: webrtc:9883
Change-Id: If807cfbf046615333c3bcd3b58a001813102a9f9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161231
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30008}
2019-12-04 17:16:32 +00:00
Markus Handell
486cc55a02 TimeController: Rename Sleep to AdvanceTime.
This change renames TimeController's Sleep method to AdvanceTime, unifying
the same name with the same semantic as for downstream projects.

Bug: webrtc:11154
Change-Id: Id79bcf0eafcd0b47a76407ba220479d84df5a736
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161092
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29989}
2019-12-03 16:08:54 +00:00