Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3305)

Unified Diff: docs/threading_and_tasks.md

Issue 2875943002: Fixes to "Threading and Tasks in Chrome" documentation. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/threading_and_tasks.md
diff --git a/docs/threading_and_tasks.md b/docs/threading_and_tasks.md
index 986d78118cd6172118cdddd7945a13bba7762534..feae7fadd206f675280379d1416c7ebefd6be750 100644
--- a/docs/threading_and_tasks.md
+++ b/docs/threading_and_tasks.md
@@ -75,16 +75,17 @@ base::PostTaskWithTraits(
base::BindOnce(&Task));
```
-## Posting via a TaskRunner
+### Posting via a TaskRunner
A parallel
[`TaskRunner`](https://cs.chromium.org/chromium/src/base/task_runner.h) is an
alternative to calling `base::PostTask*()` directly. This is mainly useful when
it isn’t known in advance whether tasks will be posted in parallel, in sequence,
-or to a single-thread (ref. [Posting a Sequenced Task](#Posting-a-Sequenced-
-Task), [Posting Multiple Tasks to the Same Thread](#Posting-Multiple-Tasks-to-
-the-Same-Thread)). Since `TaskRunner` is the base class of `SequencedTaskRunner`
-and `SingleThreadTaskRunner`, a `scoped_refptr<TaskRunner>` member can hold a
+or to a single-thread (ref.
+[Posting a Sequenced Task](#Posting-a-Sequenced-Task),
+[Posting Multiple Tasks to the Same Thread](#Posting-Multiple-Tasks-to-the-Same-Thread)).
+Since `TaskRunner` is the base class of `SequencedTaskRunner` and
+`SingleThreadTaskRunner`, a `scoped_refptr<TaskRunner>` member can hold a
`TaskRunner`, a `SequencedTaskRunner` or a `SingleThreadTaskRunner`.
```cpp
@@ -217,13 +218,14 @@ content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::IO)
```
The main thread and the IO thread are already super busy. Therefore, prefer
-posting to a general purpose thread when possible (ref. [Posting a Parallel
-Task](#Posting-a-Parallel-Task), [Posting a Sequenced task](#Posting-a
--Sequenced-Task)). Good reasons to post to the main thread are to update the UI
-or access objects that are bound to it (e.g. `Profile`). A good reason to post
-to the IO thread is to access the internals of components that are bound to it
-(e.g. IPCs, network). Note: It is not necessary to have an explicit post task to
-the IO thread to send/receive an IPC or send/receive data on the network.
+posting to a general purpose thread when possible (ref.
+[Posting a Parallel Task](#Posting-a-Parallel-Task),
+[Posting a Sequenced task](#Posting-a-Sequenced-Task)).
+Good reasons to post to the main thread are to update the UI or access objects
+that are bound to it (e.g. `Profile`). A good reason to post to the IO thread is
+to access the internals of components that are bound to it (e.g. IPCs, network).
+Note: It is not necessary to have an explicit post task to the IO thread to
+send/receive an IPC or send/receive data on the network.
### Posting to the Main Thread in a Renderer Process
TODO
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698