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

Side by Side Diff: docs/threading_and_tasks.md

Issue 2959563002: Sequence[d]TaskRunner (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « docs/task_scheduler_migration.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Threading and Tasks in Chrome 1 # Threading and Tasks in Chrome
2 2
3 [TOC] 3 [TOC]
4 4
5 ## Overview 5 ## Overview
6 6
7 ### Threads 7 ### Threads
8 8
9 Every Chrome process has 9 Every Chrome process has
10 10
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 649
650 Dependency injection of TaskRunners can still seldomly be useful to unit test a 650 Dependency injection of TaskRunners can still seldomly be useful to unit test a
651 component when triggering a specific race in a specific way is essential to the 651 component when triggering a specific race in a specific way is essential to the
652 test. For such cases the preferred approach is the following: 652 test. For such cases the preferred approach is the following:
653 653
654 ```cpp 654 ```cpp
655 class FooWithCustomizableTaskRunnerForTesting { 655 class FooWithCustomizableTaskRunnerForTesting {
656 public: 656 public:
657 657
658 void SetBackgroundTaskRunnerForTesting( 658 void SetBackgroundTaskRunnerForTesting(
659 scoped_refptr<base::SequenceTaskRunner> background_task_runner); 659 scoped_refptr<base::SequencedTaskRunner> background_task_runner);
660 660
661 private: 661 private:
662 scoped_refptr<base::SequenceTaskRunner> background_task_runner_ = 662 scoped_refptr<base::SequencedTaskRunner> background_task_runner_ =
663 base::CreateSequenceTaskRunnerWithTraits( 663 base::CreateSequencedTaskRunnerWithTraits(
664 {base::MayBlock(), base::TaskPriority::BACKGROUND}); 664 {base::MayBlock(), base::TaskPriority::BACKGROUND});
665 } 665 }
666 ``` 666 ```
667 667
668 Note that this still allows removing all layers of plumbing between //chrome and 668 Note that this still allows removing all layers of plumbing between //chrome and
669 that component since unit tests will use the leaf layer directly. 669 that component since unit tests will use the leaf layer directly.
OLDNEW
« no previous file with comments | « docs/task_scheduler_migration.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698