0
Commit Graph

102 Commits

Author SHA1 Message Date
Avi Drissman
401ba97021 Remove unused functions
Bug: 40108370
Change-Id: I38e0179d311b72db1d767fcc54f0023025b38caf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6278736
Reviewed-by: Gabriel Charette <gab@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422615}
2025-02-20 09:07:44 -08:00
Etienne Pierre-doray
ef5dcca880 [task] Delete meaningless timer slack calls
TIMER_SLACK_NONE is the default thus a no-op.
TIMER_SLACK_MAXIMUM only has effect on mac (UI) MessagePump, though
none of the calls to TIMER_SLACK_MAXIMUM run on a thread that supports it;
blink::MainThreadSchedulerImpl used to be the only meaningful case,
but the message pump was replaced by the default one:
https://chromium-review.googlesource.com/c/chromium/src/+/4369441

ThreadType and DelayPolicy are now used to control thread policies
and timer leeway.

Change-Id: I9638ea298d9cd87843c00eda15513541a512608e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4371223
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1168774}
2023-07-11 16:46:27 +00:00
Michael Thiessen
2d864d931a Allow default initializing BrowserTaskTraits
Now that the circular dependency between browser_thread.h and
browser_task_traits.h has been resolved, browser_thread.h can include
browser_task_traits.h and provide a default ({}) for BrowserTaskTraits.

A bunch of includes in other files needed to be updated.

Bug: 1424788, 1026641, 1429044
Change-Id: Ibc44e495f743eee029fb45832b1084f03ca47555
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4402191
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127199}
2023-04-06 15:20:56 +00:00
Michael Thiessen
7f5dfb90a2 Delete task_executor.h and other unused code
Bug: 1424788, 1026641
Change-Id: Ib3467d349edf9030bf3be8db9c6bb80a6b9eae76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4366739
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: Ali Juma <ajuma@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1124261}
2023-03-30 16:50:21 +00:00
Michael Thiessen
ab67d3911d Remove NonNestable from BrowserTaskTraits
NonNestable is no longer used (and we'd like to eventually not support
NonNestable tasks entirely).

Bug: 876272, 1424788
Change-Id: I750dbd29104b7439ee8bc87fe0efcc032f8c2d19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342817
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1117920}
2023-03-16 03:14:53 +00:00
Scott Haseley
72d89b0bb8 SequenceManager: Make priorities configurable (yield API 1/n)
This CL makes SequenceManager priorities configurable through a new
SequenceManager::Settings option, with a single priority being
configured as the default. This is being done in advance of adding new
renderer-specific priorities to support `scheduler.yield()`, as well
as experimenting with downshifting priorities in backgrounded agents.

Configurable priorities have a few advantages:
 - Priority definitions are closer to where they're used, making it
   clear what priority system is being used where. This also enables
   better semantic (re)naming of priorities in the future, where it
   makes sense.
 - It prevents render-specific details from creeping into
   SequenceManager
 - It reduces data structure sizes for sequences that don't use
   priorities (currently only renderer main thread, (blink) workers,
   and browser UI thread).

SequenceManager is already (mostly) set up to handle an arbitrary
number of priorities; the main non-mechanical changes are:
 - A few data structures need to be vectors instead of arrays (this
   was cleaner and simpler than templating SequenceManager).
 - Tracing needs to support multiple priority systems, which is
   implemented with a configurable priority-to-proto-priority
   conversion function, along with expanding the proto enum to be the
   union of browser, renderer, and worker priorities.
 - TaskEnvironment is updated to support configurable priorities in
   its constructor, which BrowserTaskEnvironment uses to set up
   the required settings for the browser task queues.
 - The idle task priority is passed to IdleHelper along with the idle
   queue since it differs between main and non-main renderer threads.
   I'll try to set this set ahead of time in a follow-up, but this
   would have increased the complexity of this CL because of how things
   are constructed.

Bug: 979020
Low-Coverage-Reason: pure refactor / missing coverage predated this
Change-Id: I06b47347838c992bcecfe1fe69518c5e8835cdc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4114556
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1106608}
2023-02-17 03:29:25 +00:00
Avi Drissman
adac219925 Update header includes for /base/functional in /content
bind.h, callback.h, callback_forward.h, and callback_helpers.h
moved into /base/functional/. Update the include paths to
directly include them in their new location.

Bug: 1364441
Change-Id: I32ec425b9c0e52ec4b50047bf3290fecc5c905ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4148554
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091567}
2023-01-11 23:46:39 +00:00
Sean Maher
e672a665ff task posting v3: remove includes of runner handles and IWYU task runners
Turns out there's a lot of includes, so these will have to be removed
before deleting the implementation of the task runner handles.

To allow the deletion of the task runner handle headers, add
the sequenced/thread task runner handles where they are used in
the codebase with scripts.

This was done with an automated change, with a few touchups afterwards.
The code for the mass-refactor changes are here:
python:
https://paste.googleplex.com/5534570878337024
shell:
https://paste.googleplex.com/6466750748033024

In terms of touchups:
- add sequenced/thread task runner handles to
  the third_party/blink/public/DEPS, because multiple files were using
  it transitively anyways.
- rewrite certain parts of the codebase which used
  ThreadTaskRunnerHandles instead of CurrentDefaultHandles.
- fix a compile issue with forward-declaration in
  extensions/browser/extension_file_task_runner.h.

AX-Relnotes: n/a.
Bug: 1026641
Change-Id: I737ef32aee4e77c21eaa3a2bdc403a28322cf1b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4133323
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Sean Maher <spvw@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1090532}
2023-01-09 21:42:28 +00:00
Gabriel Charette
067dc8a885 [base][codehealth] Disallow direct creation of SequenceManagerImpl
This was initially going to be a prereq for crrev.com/c/4060840
as I wanted to capture unbound creation. Turns out this won't be
sufficient but this is still good code health.

The only true use case for owning a SequenceManagerImpl* is in
thread.cc. Special cased that one with a PassKey.

Bug: 1344573
Change-Id: I1fbb4d97320c6048aff29fdab0a189e7f2071d40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4061780
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1078149}
2022-12-01 17:53:29 +00:00
Sean Maher
5b9af51fdd task posting v3: moving away from ThreadTaskRunnerHandle
To continue the migration away from TaskRunnerHandles, the codebase
was refactored using the following scripts:
shell script:
https://paste.googleplex.com/4673967729147904
python:
https://paste.googleplex.com/5824001174667264

This will do a few sed-like modifications, changing calls to methods of
ThreadTaskRunnerHandle to calls to methods of
SingleThreadTaskRunner::CurrentDefaultHandle, and swapping includes.

Bug: 1026641
AX-Relnotes: n/a.
Change-Id: Ia33b6dfebb15937481c619f5c838720ce7bb2676
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4031817
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1074085}
2022-11-21 15:32:47 +00:00
Avi Drissman
4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00
Gabriel Charette
d87f10f467 [base] IWYU for base::Time
This CL is a no-op.

Only fixing instances where base::Time (and Ticks/Delta) is used in
a statement (i.e. not as a parameter to avoid adding includes in mere
overrides). Skipping pointer and reference qualified instances.

i.e. matches this regex:
'(\n *[^/\n][^/\n][^/\n]*base::(Time|Thread)(Ticks|Delta)?\b[^*&][^)]*;)'

and skipping files that have any existing fwd-decl for any of the
variants.

This is a prereq to remove unused base/task/post_task.h includes in
https://chromium-review.googlesource.com/c/chromium/src/+/3555247

Bug: 1026641
Change-Id: I87b43a8dc92bdceb67f4bd59b327b54813aa72a6
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3557354
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#987283}
2022-03-31 00:44:22 +00:00
Minoru Chikamune
a0317568a8 service worker: Introduce service worker specific task queue
This CL introduce a service worker specific task queue, and use it for
ServiceWorkerStorageControl mojo remote instead of
base::SequencedTaskRunnerHandle::Get() if
features::kServiceWorkerStorageControlResponseQueue is
enabled. ServiceWorkerStorageControl is a part of the critical path of
the first navigation. We expect that the high priority task runner
provides better startup performance.

The service worker task queue has a highest priority during startup,
and is updated to have a normal priority after startup.

Bug: 1146713
Change-Id: I1cc782486718d62eb319f68b6430faff1d3215b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3503158
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Minoru Chikamune <chikamune@chromium.org>
Cr-Commit-Position: refs/heads/main@{#983832}
2022-03-22 15:30:21 +00:00
Keishi Hattori
0e45c020c4 Rewrite most Foo* field_ pointer fields to raw_ptr<Foo> field_.
DO NOT REVERT (unless absolutely necessary)! Report build breaks to keishi@(APAC)/glazunov@(EMEA)/sebmarchand@(NA) as soon as you see them. Fixes are expected to be trivial.

This commit was generated automatically, by running the following script: tools/clang/rewrite_raw_ptr_fields/rewrite-multiple-platforms.sh on commit fe74bc434e

For more information, see MiraclePtr One Pager [1], the PSA at chromium-dev@ [2], and the raw_ptr documentation in //base/memory/raw_ptr.md.

FYI This CL does not enable MiraclePtr protection and we expect no behavior change from this.

[1] https://docs.google.com/document/d/1pnnOAIz_DMWDI4oIOFoMAqLnf_MZ2GsrJNb_dbQ3ZBg/edit?usp=sharing
[2] https://groups.google.com/a/chromium.org/g/chromium-dev/c/vAEeVifyf78/m/SkBUc6PhBAAJ

Binary-Size: Increase of around 500kb was approved for MiraclePtr
Include-Ci-Only-Tests: true
No-Tree-Checks: true
No-Presubmit: true
Bug: 1272324, 1073933
Change-Id: I05c86a83bbb4b3f4b017f361dd7f4e7437697f69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3305132
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Owners-Override: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#945735}
2021-11-27 09:25:52 +00:00
Etienne Pierre-doray
40545acfd9 [tasks]: Single TimeDomain in SequenceManager
This CL
(1) splits TimeDomain into 2 classes (extracting some
functionalities into a new interface):
- TimeDomain to provide clock and advancing time
- DelayedWakeUpQueue a queue of (wake ups, TaskQueues) pairs
Reason: Allows us to have a single TimeDomain global to SequenceManager.
This simplifies definition of time; TimeTicks is "consistent" across
all TaskQueues.

(2) Centralizes TimeDoman/TickClock from TaskQueueImpl to
SequenceManagerImpl.
A TimeDomain is a TickClock through inheritance. Note that ownership
is assumed by the user, with the exception or real_time_domain, which
lives in SequenceManagerImpl (this hasn't changed).
Instead of each TaskQueueImpl having its own pointer to
TimeDomain/TickClock, a single pointer to TimeDomain/TickClock is kept
in SequenceManagerImpl, and all TaskQueueImpls access it through
SequenceManagerImpl.
To support multi-threaded access, an atomic pointer to TickClock is
stored in SequenceManagerImpl.
Reason: This let's us update TimeDomain for all TaskQueueImpls at once in
a consistent way instead of iterating and updating each individually.

Note on thread safety: atomic |clock_| sounds dangerous/racy, but it's
ok.
It's safe because all time_domain are expected to never die; except in
some tests but those are done in a single-threaded context.
It's racy (a cross-thread post task may use a stale clock), but
not any more racy than the current implementation. The general
expectation is that time_domain should be switched early on.

DelayedWakeUpQueue is not moved to a new file (yet), so that gerrit can
show the diff properly. Moving to a new file (without any change) will
be done in a follow-up CL.

TimeDomainsAreIndependant unittest is removed because it's no
longer supported to have different TimeDomains on different TaskQueues.

Bug: 857101
Change-Id: Ie220dc135873f147bc2341902179b3942d408198
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2966349
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940744}
2021-11-11 13:34:28 +00:00
Patrick Monette
643cdf6190 Replace base/task/ temporary forward headers with their final locations
Note to QA: This merely changes includes and should not be blamed
for files it touched.

Bug: 1255932
Change-Id: I1ce4e31efd5792ebf2080812e665cae838a54972
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3226943
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#932153}
2021-10-15 19:13:42 +00:00
Patrick Monette
3d7d70920a Replace task-related headers to their equivalent in base/task/
This CL was generated by using tools/git/move_source_file.py to change
the includes for those files:
base/bind_post_task.h
base/deferred_sequenced_task_runner.h
base/post_task_and_reply_with_result_internal.h
base/sequenced_task_runner.h
base/sequenced_task_runner_helpers.h
base/single_thread_task_runner.h
base/task_runner.h
base/task_runner_util.h
base/updateable_sequenced_task_runner.h

Then formatted using "git cl format". DEPS files were fixed with a
simple search and replace script.

Bug: 1255932
Change-Id: I0d9b5ddd9260fde5e4581e6c6e0080bdb0ed2c44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3209175
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#929867}
2021-10-08 20:27:23 +00:00
Peter Boström
828b902994 Replace DISALLOW_COPY_AND_ASSIGN in content/
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).

This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: Iea478401b7580682c7b9f195f7af9cbbdb6ce315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3167292
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#923194}
2021-09-21 02:28:43 +00:00
Olivier Li
89911c40a2 Make base::Thread::Options::delegate be a unique_ptr.
Bug:1208166

R=fdoray@chromium.org

Change-Id: I9e5e4a10bcb106a81c6ade346b80535ae46e98db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2890409
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#898343}
2021-07-02 21:27:02 +00:00
John Abd-El-Malek
f3243dc72e Rename BrowserProcessSubThread to BrowserProcessIOThread to make it clear what it's used for now.
We don't create it in production anymore for UI thread. This wasn't obvious, e.g. see the fix in https://crrev.com/c/2877684.

Bug: 904556
Change-Id: I4e6eaeeafd6144c30c4822a11806dfa24e4363e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2878894
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#880433}
2021-05-07 16:20:01 +00:00
danakj
db9ae7941a Rename includes from bind_helpers.h to callback_helpers.h
R=dcheng@chromium.org
NOPRESUBMIT=true
TBR=
NOTRY=true

Change-Id: I93bc6a9360997fae7adeab8c01f56e08fc025dd2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523543
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826289}
2020-11-11 16:01:35 +00:00
Carlos Caballero
b25fe847c7 Rename MessageLoopCurrent to CurrentThread
Get rid of all references to MessageLoopCurrent(ForIO|ForUI)

This is a mechanical change. Just ran the following commands

mffr.py base/message_loop/message_loop_current base/task/current_thread
mffr.py -f MessageLoopCurrentForUI CurrentUIThread
mffr.py -f MessageLoopCurrentForIO CurrentIOThread
mffr.py -f MessageLoopCurrent CurrentThread
rm base/message_loop/message_loop_current.h

This patch will be reviewed according to
https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#mechanical-changes

TBR=gab@chromium.org

Bug: 891670
Change-Id: If3892558ad71333f93a4698ac5411f141ccd5657
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2279990
Commit-Queue: Carlos Caballero <carlscab@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789421}
2020-07-17 10:27:17 +00:00
Carlos Caballero
4a05092f8e Deprecate MessageLoopCurrent in favor of CurrentThread
Followup patches will migrate code to the new names and header files.

Bug: 891670
Change-Id: I35c3aa51236f8d0934d87d699e6298494ded14b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2270327
Commit-Queue: Carlos Caballero <carlscab@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784774}
2020-07-02 11:43:38 +00:00
Gabriel Charette
e7cdc5cd07 [BrowserThread] Migration callers without full content:: namespace
Note to QA: This CL is purely mechanical and shouldn't be blamed
for future regressions on touched files.

This is a follow-up to https://chromium-review.googlesource.com/c/chromium/src/+/2211138
which already removed all usage using content::BrowserThread.

Hence this script now matches unqualified BrowserThread:: without
risking having "content::" be selected as "traits_before" by the regex
(ran on same revision as step ).

content:: is now always added if outside namespace content {}
(deleting unused using content::BrowserThread; decls)

Script @ https://crbug.com/1026641#c92

(will TBR fdoray@ post-review for mechanical change)
TBR=fdoray@hchromium.org

AX-Relnotes: n/a.
Bug: 1026641
Change-Id: I51ae2f83eb17d19b54563fd9b4fc040d2aa0c948
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212469
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772458}
2020-05-27 23:35:05 +00:00
Gabriel Charette
49e3cd0996 Introduce content::GetUIThreadTaskRunner() and its IO counterpart
As agreed upon in design doc @
https://docs.google.com/document/d/1tssusPykvx3g0gvbvU4HxGyn3MjJlIylnsH13-Tv6s4/edit?ts=5e1c66d5&pli=1#bookmark=id.ll79iqi5rlpp

base::ThreadPool counterpart to move away from post_task.h is @
https://chromium-review.googlesource.com/c/chromium/src/+/1977964

API usage migration will be done in a follow-up mega CL.
This CL at least uses it in its own tests.

See https://chromium-review.googlesource.com/c/chromium/src/+/2015655
for how this will look in practice for a few callsites.

Bug: 1026641
Change-Id: I98771fd68a513bf0a4776672a8d75fcbbb200bea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2014055
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Darin Fisher <darin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735734}
2020-01-28 03:45:27 +00:00
Gabriel Charette
b8c60e8497 [content test] Move TestBrowserThread as an impl detail!
No less than 6.5 years after TestBrowserThread was deprecated!

Moved as-is to browser_task_environment.cc % deletion on an unused constructor.

Only actual change in this CL is in
chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc
to use BrowserTaskEnvironment instead (doesn't alter any logic, just
semantics).

// For minor tweaks to chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc
TBR=lizeb@chromium.org
// To bypass owners on mechanical removal of unused headers.
TBR=avi@chromium.org

Bug: 272091
Change-Id: I174c23ae436c330b32f14bd12ff5f9dc4e23bab2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1978162
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726871}
2019-12-20 18:50:15 +00:00
danakj
151f8fdd0c Convert Callbacks to {Once,Repeating}Callback in content/browser/
Use OnceCallback where possible because the callback is only used once
and RepeatingCallback and BindRepeating otherwise.

Pass RepeatingCallback ownership by value instead of const ref.

R=avi@chromium.org

Bug: 1007760
Change-Id: I18ea04793d877ab91733dc3ecba363c2509ea68a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1961134
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723678}
2019-12-11 03:11:14 +00:00
Alex Clarke
bbf891dc8b Introduce base::CurrentThread trait.
This trait will allow tasks to be posted on the current thread, optionally
overriding other traits such as the base::TaskPriority or
content::BrowserTaskType. A refactor of BrowserTaskExecutor was necessary
to support ase::CurrentThread in a BrowserTaskEnvironment with a fake IO
thread.

BUG: 
Change-Id: If4627c8cec6efd404b483c5a9b789a579c00936b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1835494
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704181}
2019-10-09 14:18:02 +00:00
Karolina Soltys
b083f9364d [scheduler] Registering the BrowserTaskExecutor in TLS.
This is a reland of a689aa50b6

Bug: 872236
Change-Id: I6ab54fe95459c294358913bf6a78a6a73e8cb449
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787606
Commit-Queue: Karolina Soltys <ksolt@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Auto-Submit: Karolina Soltys <ksolt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699818}
2019-09-25 16:18:06 +00:00
Yutaka Hirano
a025aa6c96 Revert "[scheduler] Relanding registering the task executor in TLS."
This reverts commit a689aa50b6.

Reason for revert: suspected to break content_unittests. See https://ci.chromium.org/p/chromium/builders/ci/Linux%20CFI/14863.

Original change's description:
> [scheduler] Relanding registering the task executor in TLS.
> 
> I am attempting to reland
> https://chromium-review.googlesource.com/c/chromium/src/+/1751251
> with a fix. The race condition which triggered the revert is test-only,
> I have now marked it as benign and it shouldn't fail TSAN anymore.
> 
> TBR=alexclarke@chromium.org,tedchoc@chromium.org
> 
> Bug: 968047
> Change-Id: Iafbc31a80144371b22c0cd4ef6547c2ef2adfd62
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1781596
> Reviewed-by: Karolina Soltys <ksolt@chromium.org>
> Reviewed-by: Alex Clarke <alexclarke@chromium.org>
> Commit-Queue: Karolina Soltys <ksolt@chromium.org>
> Auto-Submit: Karolina Soltys <ksolt@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#692708}

TBR=tedchoc@chromium.org,alexclarke@chromium.org,ksolt@chromium.org

Change-Id: I3c65ae5ae5ff3e8ecf3f990bb4464d3c6cab34ea
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 968047
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1784017
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692975}
2019-09-04 02:09:18 +00:00
Karolina Soltys
a689aa50b6 [scheduler] Relanding registering the task executor in TLS.
I am attempting to reland
https://chromium-review.googlesource.com/c/chromium/src/+/1751251
with a fix. The race condition which triggered the revert is test-only,
I have now marked it as benign and it shouldn't fail TSAN anymore.

TBR=alexclarke@chromium.org,tedchoc@chromium.org

Bug: 968047
Change-Id: Iafbc31a80144371b22c0cd4ef6547c2ef2adfd62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1781596
Reviewed-by: Karolina Soltys <ksolt@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Commit-Queue: Karolina Soltys <ksolt@chromium.org>
Auto-Submit: Karolina Soltys <ksolt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692708}
2019-09-03 17:28:49 +00:00
Gabriel Charette
c710874894 Reland "[TaskEnvironment] Complete migration with header rename"
This is a reland of 18947083c7

The move_source_file.py script's formatting rules incorrectly
formatted services/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc
after all. But we also can't rely 100% on git cl format (crbug.com/997063)
so I ended up performing a git cl format && git add -up
(+interactive addition of missing blank line after foo.h when included
from top of foo.cc)

Also added
$ tools/git/move_source_file.py net/test/test_with_scoped_task_environment.h net/test/test_with_task_environment.h

Original change's description:
> [TaskEnvironment] Complete migration with header rename
>
> This is merely:
>
> $ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
> $ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
> $ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
> $ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
> $ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc
>
> and a few manual renames in DEPS files missed by the script
>
> This CL uses --bypass-hooks to avoid having to git cl format because
> many headers are being reordered by git cl format and it's too many to
> figure out in a no-op CL which ones are okay with it.
> windows.h for one should typically be first and another one of the
> reorderings in PS3 even caused a compile failure:
> https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc
>
> TBR=dcheng@chromium.org
>
> Bug: 992483
> Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#689778}

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: I6179dd1329a4d30bf5c65450ea893537f31e6f85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767658
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689794}
2019-08-23 03:31:40 +00:00
Gabriel Charette
b69fcd4f6e Revert "[TaskEnvironment] Complete migration with header rename"
This reverts commit 18947083c7.

Reason for revert: broke Win

Original change's description:
> [TaskEnvironment] Complete migration with header rename
> 
> This is merely:
> 
> $ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
> $ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
> $ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
> $ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
> $ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc
> 
> and a few manual renames in DEPS files missed by the script
> 
> This CL uses --bypass-hooks to avoid having to git cl format because
> many headers are being reordered by git cl format and it's too many to
> figure out in a no-op CL which ones are okay with it.
> windows.h for one should typically be first and another one of the
> reorderings in PS3 even caused a compile failure:
> https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc
> 
> TBR=dcheng@chromium.org
> 
> Bug: 992483
> Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#689778}

TBR=dcheng@chromium.org,gab@chromium.org

Change-Id: I9aa8ff558d1ff78cebe0c25e559c017578ad4f53
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 992483
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767657
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689780}
2019-08-23 02:13:29 +00:00
Gabriel Charette
18947083c7 [TaskEnvironment] Complete migration with header rename
This is merely:

$ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
$ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
$ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
$ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
$ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc

and a few manual renames in DEPS files missed by the script

This CL uses --bypass-hooks to avoid having to git cl format because
many headers are being reordered by git cl format and it's too many to
figure out in a no-op CL which ones are okay with it.
windows.h for one should typically be first and another one of the
reorderings in PS3 even caused a compile failure:
https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689778}
2019-08-23 02:05:33 +00:00
Findit
30f71a78e8 Revert "[scheduler] Registering the executor in TLS."
This reverts commit 1e76b45fba.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 689646 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtLzFlNzZiNDVmYmE0MWZmMTQ5MDRiZjVkZmM5OWEyODk1YTBiZmQ0YjAM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium.memory/Linux%20TSan%20Tests/43203

Sample Failed Step: content_unittests

Original change's description:
> [scheduler] Registering the executor in TLS.
> 
> Bug: 968047
> Change-Id: Idaf9c72f13419ac29804a91e54be86d71ff9b7f7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1751251
> Commit-Queue: Karolina Soltys <ksolt@chromium.org>
> Reviewed-by: Karolina Soltys <ksolt@chromium.org>
> Reviewed-by: Ted Choc <tedchoc@chromium.org>
> Reviewed-by: Alex Clarke <alexclarke@chromium.org>
> Auto-Submit: Karolina Soltys <ksolt@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#689646}


Change-Id: I80b73e5cb9b57e3ffa6d766497a7fdaa89d4d1a4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 968047
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1766782
Cr-Commit-Position: refs/heads/master@{#689690}
2019-08-22 22:02:01 +00:00
Karolina Soltys
1e76b45fba [scheduler] Registering the executor in TLS.
Bug: 968047
Change-Id: Idaf9c72f13419ac29804a91e54be86d71ff9b7f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1751251
Commit-Queue: Karolina Soltys <ksolt@chromium.org>
Reviewed-by: Karolina Soltys <ksolt@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Auto-Submit: Karolina Soltys <ksolt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689646}
2019-08-22 20:35:07 +00:00
Gabriel Charette
694c3c33ca [TaskEnvironment] Mass-migrate away from ScopedTaskEnvironment (1/2)
(well half of them because git cl upload wouldn't let me do
 them all at once...)

This is step  of the mass migration. Some of these will be
backported to SingleThreadTaskEnvironment in a later phase.

scoped_task_environment.h will also only move in a follow-up CL.

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: I44bc376deee9b6c95bafac8d54165174d86a5001
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1756247
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688086}
2019-08-19 14:53:05 +00:00
Gabriel Charette
748577aa7e [test::TaskEnvironment] Rename Thread::TaskEnvironment to avoid confusion
Precursor to https://chromium-review.googlesource.com/c/chromium/src/+/1747171

R=dcheng@chromium.org

Bug: 992483
Change-Id: I0bd990acbfc97ae95b9faaba1ecab682f85150c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1747190
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685964}
2019-08-12 12:53:55 +00:00
Chris Sharp
7840c58097 Reland "Reland "Remove references to MessagePump::Type""
This reverts commit 8f5f3e89a5.

Reason for revert: Revert wasn't needed

Original change's description:
> Revert "Reland "Remove references to MessagePump::Type""
> 
> This reverts commit 1c1d61e5d9.
> 
> Reason for revert: I suspect this is causing a compile failure on the Linux ChromiumOS Full Bot.
> 
> Output:
> FAILED: obj/chromeos/services/assistant/tests/service_unittest.o
> /b/s/w/ir/cache/goma/client/gomacc ../../third_par...
> ../../chromeos/services/assistant/service_unittest.cc:12:10: fatal error: 'ash/public/interfaces/constants.mojom-forward.h' file not found
> #include "ash/public/interfaces/constants.mojom-forward.h"
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> Original change's description:
> > Reland "Remove references to MessagePump::Type"
> > 
> > This is a reland of bfca9d675c
> > 
> > Was reverted because an optional trybot failed due to a missing include in an unrelated file.
> > That was fixed in https://crrev.com/c/1729634 and https://crrev.com/c/1730894
> > 
> > Original change's description:
> > > Remove references to MessagePump::Type
> > >
> > > It is going away soon, replace with the real thing: MessagePumpType
> > >
> > > Had to fix a lot of includes (MessagePumpType is defined in message_pump_type.h).
> > >
> > > This is a mechanical change that will be reviewed according to
> > > https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#mechanical-changes
> > >
> > > Bug: 891670
> > > TBR=gab@chromium.org
> > >
> > > Change-Id: I1c85fce3cc11f7a283153ccaf2596e6e92a638d7
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726058
> > > Commit-Queue: Carlos Caballero <carlscab@google.com>
> > > Reviewed-by: Gabriel Charette <gab@chromium.org>
> > > Cr-Commit-Position: refs/heads/master@{#682731}
> > 
> > TBR=gab@chromium.org
> > 
> > Bug: 891670
> > Change-Id: I7654fb4ff3a5e8c0505aafb33939d2035f28f88b
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730416
> > Commit-Queue: Carlos Caballero <carlscab@google.com>
> > Reviewed-by: Gabriel Charette <gab@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#683592}
> 
> TBR=gab@chromium.org,carlscab@google.com
> 
> Change-Id: Ie479741cf8092d9110a9ee6c5fa81e7e084c6788
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 891670
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733432
> Reviewed-by: Chris Sharp <csharp@chromium.org>
> Commit-Queue: Chris Sharp <csharp@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#683602}

TBR=gab@chromium.org,csharp@chromium.org,carlscab@google.com

Change-Id: Ieb323e7afaf248384c05b8cb0c13d6ec50856c75
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 891670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733434
Reviewed-by: Chris Sharp <csharp@chromium.org>
Commit-Queue: Chris Sharp <csharp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683603}
2019-08-02 15:45:32 +00:00
Chris Sharp
8f5f3e89a5 Revert "Reland "Remove references to MessagePump::Type""
This reverts commit 1c1d61e5d9.

Reason for revert: I suspect this is causing a compile failure on the Linux ChromiumOS Full Bot.

Output:
FAILED: obj/chromeos/services/assistant/tests/service_unittest.o
/b/s/w/ir/cache/goma/client/gomacc ../../third_par...
../../chromeos/services/assistant/service_unittest.cc:12:10: fatal error: 'ash/public/interfaces/constants.mojom-forward.h' file not found
#include "ash/public/interfaces/constants.mojom-forward.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Original change's description:
> Reland "Remove references to MessagePump::Type"
> 
> This is a reland of bfca9d675c
> 
> Was reverted because an optional trybot failed due to a missing include in an unrelated file.
> That was fixed in https://crrev.com/c/1729634 and https://crrev.com/c/1730894
> 
> Original change's description:
> > Remove references to MessagePump::Type
> >
> > It is going away soon, replace with the real thing: MessagePumpType
> >
> > Had to fix a lot of includes (MessagePumpType is defined in message_pump_type.h).
> >
> > This is a mechanical change that will be reviewed according to
> > https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#mechanical-changes
> >
> > Bug: 891670
> > TBR=gab@chromium.org
> >
> > Change-Id: I1c85fce3cc11f7a283153ccaf2596e6e92a638d7
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726058
> > Commit-Queue: Carlos Caballero <carlscab@google.com>
> > Reviewed-by: Gabriel Charette <gab@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#682731}
> 
> TBR=gab@chromium.org
> 
> Bug: 891670
> Change-Id: I7654fb4ff3a5e8c0505aafb33939d2035f28f88b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730416
> Commit-Queue: Carlos Caballero <carlscab@google.com>
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#683592}

TBR=gab@chromium.org,carlscab@google.com

Change-Id: Ie479741cf8092d9110a9ee6c5fa81e7e084c6788
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 891670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733432
Reviewed-by: Chris Sharp <csharp@chromium.org>
Commit-Queue: Chris Sharp <csharp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683602}
2019-08-02 15:37:08 +00:00
Carlos Caballero
1c1d61e5d9 Reland "Remove references to MessagePump::Type"
This is a reland of bfca9d675c

Was reverted because an optional trybot failed due to a missing include in an unrelated file.
That was fixed in https://crrev.com/c/1729634 and https://crrev.com/c/1730894

Original change's description:
> Remove references to MessagePump::Type
>
> It is going away soon, replace with the real thing: MessagePumpType
>
> Had to fix a lot of includes (MessagePumpType is defined in message_pump_type.h).
>
> This is a mechanical change that will be reviewed according to
> https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#mechanical-changes
>
> Bug: 891670
> TBR=gab@chromium.org
>
> Change-Id: I1c85fce3cc11f7a283153ccaf2596e6e92a638d7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726058
> Commit-Queue: Carlos Caballero <carlscab@google.com>
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#682731}

TBR=gab@chromium.org

Bug: 891670
Change-Id: I7654fb4ff3a5e8c0505aafb33939d2035f28f88b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730416
Commit-Queue: Carlos Caballero <carlscab@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683592}
2019-08-02 15:10:39 +00:00
Sami Kyostila
8e4d5a915e content/browser: Always specify thread affinity when posting tasks
*** Note: There is no behavior change from this patch. ***

The PostTask APIs will shortly be changed to require all tasks to explicitly
specify their thread affinity, i.e., whether the task should run on the thread
pool or a specific named thread such as a BrowserThread. This patch updates all
call sites with thread affinity annotation. We also remove the "WithTraits"
suffix to make the call sites more readable.

Before:

    // Thread pool task.
    base::PostTaskWithTraits(FROM_HERE, {...}, ...);

    // UI thread task.
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI, ...}, ...);

After:

    // Thread pool task.
    base::PostTask(FROM_HERE, {base::ThreadPool(), ...}, ...);

    // UI thread task.
    base::PostTask(FROM_HERE, {BrowserThread::UI, ...}, ...);

This patch was semi-automatically prepared with these steps:

    1. Patch in https://chromium-review.googlesource.com/c/chromium/src/+/1635827
       to make thread affinity a build-time requirement.
    2. Run an initial pass with a clang rewriter:
       https://chromium-review.googlesource.com/c/chromium/src/+/1635623
    3. ninja -C out/Debug | grep 'requested here' | cut -d: -f1-3 | sort | \
           uniq > errors.txt
    4. while read line; do
         f=$(echo $line | cut -d: -f 1)
         r=$(echo $line | cut -d: -f 2)
         c=$(echo $line | cut -d: -f 3)
         sed -i "${r}s/./&base::ThreadPool(),/$c" $f
       done < errors.txt
    5. GOTO 3 until build succeeds.
    6. Remove the "WithTraits" suffix from task API call sites:

       $ tools/git/mffr.py -i <(cat <<EOF
       [
         ["PostTaskWithTraits",                            "PostTask"],
         ["PostDelayedTaskWithTraits",                     "PostDelayedTask"],
         ["PostTaskWithTraitsAndReply",                    "PostTaskAndReply"],
         ["CreateTaskRunnerWithTraits",                    "CreateTaskRunner"],
         ["CreateSequencedTaskRunnerWithTraits",           "CreateSequencedTaskRunner"],
         ["CreateUpdateableSequencedTaskRunnerWithTraits", "CreateUpdateableSequencedTaskRunner"],
         ["CreateSingleThreadTaskRunnerWithTraits",        "CreateSingleThreadTaskRunner"],
         ["CreateCOMSTATaskRunnerWithTraits",              "CreateCOMSTATaskRunner"]
       ]
       EOF
       )

This CL was uploaded by git cl split.

R=boliu@chromium.org, tsepez@chromium.org

Bug: 968047
Change-Id: I346372d16a3856186ea74d14e0dd8a12f7cacae5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729589
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683554}
2019-08-02 12:45:05 +00:00
Findit
b0504e9d67 Revert "Remove references to MessagePump::Type"
This reverts commit bfca9d675c.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 682731 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2JmY2E5ZDY3NWM1MjQ4NDNiOGJiNmEwZDAxNGUyOWQ0ZDY4NTkwNTYM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium/win-archive-rel/3468

Sample Failed Step: compile

Original change's description:
> Remove references to MessagePump::Type
> 
> It is going away soon, replace with the real thing: MessagePumpType
> 
> Had to fix a lot of includes (MessagePumpType is defined in message_pump_type.h).
> 
> This is a mechanical change that will be reviewed according to
> https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#mechanical-changes
> 
> Bug: 891670
> TBR=gab@chromium.org
> 
> Change-Id: I1c85fce3cc11f7a283153ccaf2596e6e92a638d7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726058
> Commit-Queue: Carlos Caballero <carlscab@google.com>
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#682731}


Change-Id: Idf6e0f69a07267d3a322c700882d2b3f65dcf021
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 891670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729553
Cr-Commit-Position: refs/heads/master@{#682762}
2019-07-31 16:42:20 +00:00
Carlos Caballero
bfca9d675c Remove references to MessagePump::Type
It is going away soon, replace with the real thing: MessagePumpType

Had to fix a lot of includes (MessagePumpType is defined in message_pump_type.h).

This is a mechanical change that will be reviewed according to
https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#mechanical-changes

Bug: 891670
TBR=gab@chromium.org

Change-Id: I1c85fce3cc11f7a283153ccaf2596e6e92a638d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726058
Commit-Queue: Carlos Caballero <carlscab@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682731}
2019-07-31 15:49:24 +00:00
Alex Clarke
49854cc84a Add ScopedDoNotUseUIDefaultQueueFromIO
In some circumstanecs you need to specify a BrowserTaskType or a priority when
posting a task from the IO theread to the UI thread or you risk inadvertant
task reordering. This patch introduces ScopedDoNotUseUIDefaultQueueFromIO an
RAII helper which causes PostTask on the UI thread's default task queue from
the IO thread to DCHECK.

The idea is to place ScopedDoNotUseUIDefaultQueueFromIO in contexts where
you're explicitly prioritizing certain tasks and it will guard against future
PostTasks which might otherwise get flakily reordered.

Bug: 863341
Change-Id: I67a56b2747b8bdd1ef35ec3652b55f1dc7ea830c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1660340
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672823}
2019-06-27 08:25:49 +00:00
Alex Clarke
636e705be4 Introduce SingleThreadTaskExecutor the replacement for base::MessageLoop
A large but mostly trivial patch in preparation for removing
base::MessageLoop. We introduce SingleThreadTaskExecutor a simple FIFO
scheduler, which is intended for non-test code that needs a simple
single threaded task environment. Tests should use ScopedTaskEnvironment
or TestBrowserThreadBundle instead.

This patch also moves MessageLoop::Type to MessagePump::Type and
moves the factory method to MessagePump::Create.

TBR=gab@chromium.org

Change-Id: I9850c4657bb90b62490f4313c420cae025101371
BUG: 891670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632216
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664709}
2019-05-30 10:49:37 +00:00
Carlos Caballero
4118f7eb06 Add helper to post best effort tasks
This helper will be useful when migrating code away from
PostAfterStartupTask. Some callsites would otherwise need a trampoline
as they need to post to a given task runner. This helper is only needed
until we have sequence-funneling in place.

This patch is a split of https://crrev.com/c/1571661. Refer to this if
you need more context for this change.

Bug: 887407
Change-Id: I122f837e6a7b509903055798deb0f2b6eb215bed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1628725
Commit-Queue: Carlos Caballero <carlscab@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663717}
2019-05-28 13:54:00 +00:00
Carlos Caballero
e840fc3ea0 Add multiple task queues for the IO thread
This will enable the same scheduling capabilities as we already have on
the UI thread.

Bug: 863341
Change-Id: Ice34f614d78321caabf0fac3c6b1d6a621abb712
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1598813
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/master@{#663539}
2019-05-27 14:16:37 +00:00
Carlos Caballero
72e8a209b5 Add BrowserTaskQueues::EnableAllQueues
After this patch all queues in BrowserTaskQueues will be disabled on
creation and users must explicitly enable them via a call to either
BrowserTaskQueues::EnableAllQueues or
BrowserTaskQueues::EnableAllExceptBestEffortQueues

This will help us ensure the invariant that no tasks will run before
BrowserMainLoop::CreateThreads still holds after we add an IO
scheduler.

Bug: 863341
Change-Id: I07d34ec84e166b12b9ab50448acde7f943f9cbbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611979
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Commit-Queue: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/master@{#661772}
2019-05-21 16:51:17 +00:00
Carlos Caballero
5f6212babf Create a dedicated class to hold all browser TaskQueues
Also provide a Handle class that is safe to use from any thread.
This class can then be reused by the IO thread.

Bug: 863341
Change-Id: I129c6481e79bf87b95bcf641a91258a878ec5cf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1598811
Commit-Queue: Carlos Caballero <carlscab@google.com>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659023}
2019-05-13 13:45:16 +00:00