*** 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}
The parsing of --net-log-capture-mode had previously been extracted to //net to
facilitate sharing between NS (Network Service) and non-NS code paths, however
is now exclusively used by NS.
Bug: 934009
Change-Id: I5d18354fb5eac727f2aaf61e91785f6e3bcab462
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1674635
Reviewed-by: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Auto-Submit: Eric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671926}
The NetLog is now an internal detail of the Network Service.
In particular this CL:
* Removes ChromeNetLog class
* Removes ContentBrowserClient::GetNetLog()
* Removes BrowserProcess::net_log()
* Removes support for writing to a NetLog when Network Service is disabled.
And exception is made for Android WebView, which preserves support for NetLog when Network Service is not enabled.
Bug: 934009,767450
Change-Id: I95e2a6aae85ec9c7b90bce08c57e23cb688e5d02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1663846
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Robbie McElrath <rmcelrath@chromium.org>
Commit-Queue: Eric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671472}
ServiceManagerConnection is slated for imminent deletion. This
replaces most usage around //content/browser with the simpler
GetSystemConnector(). Split out from a much larger CL.
Bug: 904240
Change-Id: Ia88322f607cb6fbf3c5fdf3fd4b6762c8074c0c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1666778
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Becca Hughes <beccahughes@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671047}
This CL fixes a few issues with SequenceLocalStorage:
- Supports holding T with disabled copy/move constructor
by adding emplace().
- Prevents auto default construction with GetValuePointer.
- Query if SequenceLocalStorageSlot currently holds a value
with operator bool().
- Update doc to use NoDestructor.
This makes it possible to replace in many cases:
SequenceLocalStorageSlot<unique_ptr<T>> with
SequenceLocalStorageSlot<T>
and
auto ptr = sls.Get();
if (!ptr) {
ptr = make_unique<T>();
sls.Set(ptr);
}
return *ptr;
with
return sls.GetOrCreateValue();
TBR=fdoray@chromium.org
Change-Id: I0473fbb4eded35177aa32fabb5377b0cad648c16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1634876
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664708}
There are three fixes:
1) The main fix is that network::NetworkService needs to be torn down between tests. One reason is that so a test don't leave it misconfigured for other tests. The pressing reason is that if network::NetworkService is bound to a pipe in one test it'll also be bound to that test's BrowserThreadTestBundle's sequence; that means for other tests no mojo messages will be dispatched. Fix this by resetting the interface pointer at the end of each test.
2) We need to delete the network::NetworkService object to avoid leaks; depending on connection error dispatching again might not be delivered. This is fixed by storing the pointer in SequenceLocalStorageSlot.
3) We create network::NetworkService directly instead of trying to use the global ServiceManager. For most tests this happens because there's no global Connector. However some tests would instantiate a test service manager objects, so we need to force the direct instantiation through a test only method.
Bug: 966633
Change-Id: I1c181733af692e7a6742a45c10a16c863e2642a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632494
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#664068}