0
Commit Graph

11 Commits

Author SHA1 Message Date
Etienne Pierre-doray
c3c341b7e0 [blink] Update docs/threading_and_tasks_testing.md for blink::test::TaskEnvironment
Bug: 1315595
Change-Id: Ic1fbba8e6483a0a594e29a56643ce1d5db7016ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5122818
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1240184}
2023-12-21 16:57:30 +00:00
Hong Xu
294f45153e Add missing FROM_HERE to the threading doc
Bug: None
Change-Id: Ic9c5a7db79f8beb2b450b23eb242176ffe2075c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4960780
Auto-Submit: Hong Xu <xuhong@google.com>
Commit-Queue: Vignesh Shenvi <vshenvi@google.com>
Commit-Queue: Hong Xu <xuhong@google.com>
Reviewed-by: Vignesh Shenvi <vshenvi@google.com>
Cr-Commit-Position: refs/heads/main@{#1213052}
2023-10-21 01:13:10 +00:00
Sean Maher
03efef1173 Task Posting v3: migrate (Sequenced|Thread)TaskRunnerHandle
To migrate to v3 task posting API, this CL moves moves
(Sequenced|Thread)TaskRunnerHandle::Get() to
(Sequenced|SingleThread)TaskRunner::GetCurrentDefault()
and related classes. For more detail on this migration, refer to
https://docs.google.com/document/d/1tssusPykvx3g0gvbvU4HxGyn3MjJlIylnsH13-Tv6s4/edit#bookmark=id.1umyn7v5a4p

The blink codebase's presubmits were substantially changed. This was
done because the presubmit did not parse in-class identifiers, and so
there was no way of banning inner classes/methods/identifiers of a
class which is allowed.

The reason this was needed for this CL is that
base::(Sequenced|SingleThread)TaskRunners are permitted in blink, but
we need to ban (Sequenced|SingleThread)TaskRunner::GetCurrentDefault()
and [...]::CurrentDefaultHandle to ensure that tasks in blink remain
properly labeled.

To this end, a new type of identifier (in-class identifiers, such as
nested::namespace::ClassName::EnumClassName) is parsed by the
presubmit, and a new kind of rule can be added to the _CONFIG file to
allow/deny them. They are parsed very similarly to the existing
identifiers, but crucially, they are allowed by default, whereas
ClassNames are denied by default.

In addition, the tests for the presubmit were mostly rewritten to
properly test whether the identifiers in the test are actually
allowed/disallowed. Instead of simply testing to see whether an
identifier is present in _CONFIG in the presubmit file, the
presubmit's functions are called in the same way as happens during the
presubmit to make sure the code being run actually works.

Finally, it also tests that the identifiers tested are fully parsed
(a handful of them weren't because they were either preceded by '::'
or in-class) by the presubmit.

The task runner handle classes still exist in the codebase, and no
existing Chromium code has been modified, as semantics have been
preserved despite the implementation change.

The implementation migration will then take place in future CLs.
Because the two APIs expose the same functionality, the codebase
can be incrementally migrated.

Bug: 1026641
Change-Id: I7ea7bb36f30ecd3cdefedcffd8bae16118b0f3d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3804911
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: Sean Maher <spvw@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1050813}
2022-09-23 22:43:13 +00:00
Gabriel Charette
9b6c0407ac [base] Cleanup remaining mentions of post_task.h
Bug: 1026641
Change-Id: I2bbd0822ad045651d10bd66ce81fe0fb99ff3de2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3565099
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Owners-Override: Francois Pierre Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/main@{#988170}
2022-04-01 23:22:46 +00:00
Peter Kasting
e5a38eddbd Migrate "base::TimeDelta::FromX" to "base:X".
All changes were done automatically with git grep, sed, xargs, etc.

No-Presubmit: true
No-Try: true
Bug: 1243777
Change-Id: I7cc197e9027f7837cd36afc67a209079f85ec364
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3198824
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#927512}
2021-10-02 03:06:35 +00:00
Gabriel Charette
3ae250ed7b Add mention of Blink to threading_and_task_testing.md
R=altimin@chromium.org

Bug: 1002654
Change-Id: Iaa1c7911326bb0280766b2df045f5401b1f5110c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849127
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754947}
2020-03-31 16:04:56 +00:00
Trent Begin
be87142426 docs: fix example parameter name in threading_and_tasks_testing
The parameter name passed to the DoSomethingAndReply example function
does not match the name of the callback given to PostTask.

Bug: none
Change-Id: I7899a22880adb0ea98f717e6415a3ce562853ef6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2121349
Auto-Submit: Trent Begin <tbegin@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753423}
2020-03-25 23:06:54 +00:00
Gabriel Charette
1138d6022d [ThreadPool] Fix docs to match new API
R=etiennep@chromium.org

Bug: 1026641
Change-Id: I68c6e40f080ac5808cd9c67e227695ca921e1691
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2026714
Auto-Submit: Gabriel Charette <gab@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736281}
2020-01-29 08:51:52 +00:00
Raphael Kubo da Costa
9d32d0f25d Add syntax highlighting to the threading_and_tasks_testing.md examples.
Change-Id: Ib9710772ce534e49d42f51dd8c4b374d85659127
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1823852
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700318}
2019-09-26 17:39:48 +00:00
Matt Mueller
aec1fa669c Add base::TaskEnvironment::AdvanceClock() which advances the mock time without running tasks.
Change-Id: Ide200b9cd0cf7f483381eeb63a8fafbee14df34e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814640
Commit-Queue: Matt Mueller <mattm@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698600}
2019-09-20 20:24:56 +00:00
Gabriel Charette
0b20ee6ca6 Add "Testing Components Which Post Tasks" docs
This is the complimentary testing docs to the Threading and Tasks usage
docs.

Updated in-code comments to reflect the current reality better too.

R=fdoray@chromium.org

Bug: 1002654
Change-Id: Ic9f4227e462ddc7180a1a6f3005935f1203ff064
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1798985
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697592}
2019-09-18 14:06:12 +00:00