This is a reland of commit 90af84e33e.
Browsertest improvements:
- In the JS code of the extension, Wasm functions are called until all of them are optimised. In this change, once in a while we yield to the event loop by calling setTimeout().
- The flag "--wasm-tiering-budget" is set to 10 so that the optimised, TurboFan code is created right away.
- As it's not clear when the caching exactly happens, the test keeps opening new tabs (which triggers the execution of the JS code in the extension) and waiting until there is a cache hit. This makes the test more robust if the caching happens a bit later.
- Previously the test waited to see x hits and y misses after x+y loads of the extension. Now the test waits for x+y samples. This way we get an accurate error message if there is an issue and don't run into timeouts.
- Added logging for easier future debugging.
Original change's description:
> [wasm] Add wasm module caching for extensions with streaming
> instantiation
>
> Bug: v8:14518
> Change-Id: I896f85284d02feb089e095b8a925bd451bfee85e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5117546
> Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
> Commit-Queue: Eva Herencsárová <evih@chromium.org>
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1256324}
Bug: v8:14518
Change-Id: I4ee455cf97cbf140d32a0ab1abcf3b2054ba750c
Cq-Include-Trybots: luci.chromium.try:linux_chromium_chromeos_msan_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5268792
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1258421}
The added content browsertest ensures that we produce and consume
local compile hints when running scripts.
To enable testing, this CL adds a capacity for making
InteractiveDetector ignore FCP - this is because the first paint never
happens in a content browser test, so without this the page would
never be detected as interactive.
Bug: chromium:1495723
Change-Id: Iceffed1244fbe4aa9048812653fd2874b59c703d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5024173
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1237944}
This cl makes CodeCacheBrowserTest run with BackgroundResourceFetch
feature disabled even when we will enable BackgroundResourceFetch
feature enabled by default.
Bug: 1379780
Change-Id: Ia48bff7b757f41a0068af3cbd88dd4c123a164bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5004282
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1221432}
This CL introduces BackgroundCodeCacheHost class which is created in the
main thread, and passed to the background thread to load code cache on
the background thread.
This CL only has an effect if the BackgroundResourceFetch feature is
enabled.
Bug: 1379780
Change-Id: Iaf7c4adfbf6ab7fc035acfabe4bea9ce65a1de13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4982988
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1218594}
There are two headers to declare features in content.
- the public one: `content/public/common/content_features.h`
- the private one: `content/common/features.h`.
Unfortunately, most are declared in the public one, despite being used
privately exclusively. This violate the `content/public/` rules. This
patches provides a fix.
Parts of this patch was made programmatically using this script:
https://paste.googleplex.com/6699322946093056, with the following
output: https://paste.googleplex.com/5591288895242240
This patch:
1. Update `docs/how_to_add_your_feature_flag.md` to incentive
developers to the non public versions.
2. Move ~70 features back into the private version.
3. Programmatically update the includes to include the correct
#include header(s).
4. For consistency and minimizing the amount of files modified,
the two headers to use the `features::` namespace.
AX-Relnotes: n/a.
Change-Id: Id9126a95dfbc533d4778b188b659b5acc9b3d9e3
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836057
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1194718}
The DanglingPointerDetector is configured only when the test enters the
ContentMain function. See https://crbug.com/1400059
I would like to configure it no matter the kind of test. For this to
happen, we need to annotate every pre-existing dangling pointers.
This patch annotates the ones you can find by running targets depending
on the GoogleTest library.
Statistic:
This adds 1776 new DanglingUntriaged. Among them:
- 1288 are in unittests.
- 488 are in implementation.
To produce those numbers, I used the command:
```bash
git diff annotate-linux origin/main -- "*test*" | grep "DanglingUntriaged" | wc -l
```
This patch has been generated by:
1. Apply the "auto-annotator" patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4474553
2. Compile the compiler again:
```bash
./tools/clang/scripts/build.py
```
3. List and run all the targets. You can use a bash script like:
https://docs.google.com/document/d/1AMMERcqy0eafFWopUCHYsIKIKEp3J8DFxqW9UIbzIHo
4. Concatenate output, filter by "Found dangling ptr", sort, remove
duplicate.
5. Apply the rewriter script from:
https://github.com/ArthurSonzogni/chrome-dangling-ptr-apply-edit
6. Revert the "auto-annotate" patch.
7. Apply `git cl format`
AX-Relnotes: n/a.
Bug: chromium:1400059
Change-Id: I217d5c0b925da5176fc53baf95919a3690f1e9a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4570424
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1151859}
Adds one test for frame contexts, and another that we can use
to test generated code cache usage by shared workers if that gets
implemented at some point.
Bug: 964467, 1445719
Change-Id: I822e7115ffadee15baea5082a7b1c01041248ea0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4554196
Commit-Queue: Andrew Williams <awillia@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1149679}
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}
constexpr enum expressions for enums without fixed underlying type must
now be in the range of the enum type.
The biggest change is that the 3-arg form of UMA_HISTOGRAM_ENUMERATION now
requires its enum arg to have a fixed underlying type (see bug for details),
so add a whole bunch of underlying types.
Fix other issues by slightly reordering arithmetic, or by making some
values const instead of constexpr.
No intended behavior change.
Bug: 1348574
Change-Id: I59d06a095c20ec1c2a5eea5928c73793f89856ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3796909
Reviewed-by: Hans Wennborg <hans@chromium.org>
Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1030177}
When including a NetworkIsolationKey in the cache key, and the
NetworkIsolationKey is transient, return absl::nullopt. Previously it
would return an empty string, which would cause cross-site leaks if it
were ever actually used as a cache key.
Also make NetworkIsolationKey::ToString() return an optional, and return
nullopt if transient, for the exact same reason. Rename ToString() to
ToCacheString(), since DCHECK_EQ(nik, nik) expects ToString() to return
a std::string. Also Migrate those DCHECK_EQs to DCHECK(nik==nik).
Bug: None
Change-Id: I4c7f9a2ff16755aff8d5a7590eb8877a16d3611e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3777742
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1027064}
This is the last remaining method in disk_cache.h that takes an out pointer while being able to execute both synchronously and asynchronously, which requires highly error-prone lifetime management of the destination.
The changed version simply produces a unique_ptr by value, either as return value or via callback.
HttpCache::GetBackend still has a similar issue, but it would be too much to handle in this one CL, and it's also different in that it's not a factory method, and both the callback invocation and lifetime of the disk_cache::Backend it returns are tied to the underlying HttpCache, so it likely needs a different solution (like it reporting success/failure, and users using HttpCache::GetCurrentBackend to make the lifetime dependency obvious).
Bug: 854716
Change-Id: I79807021c74ffadbe0acd62145345f887626f1fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688361
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1017654}
1. Take key string length into account. This may lead to fewer entries
in the index and less memory use.
2. Ignore too large entries.
3. Have a smaller capacity, based on the UMA numbers. Rename the
histogram as this change drastically changes the distribution.
Bug: 1336615
Change-Id: I6a30f8a0648845180e9c342feef3479704565322
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3715914
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1017101}
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}
This change introduces:
- disk_cache::BackendFileOperations and
disk_cache::BackendFileOperationsFactory to support brokering file
operations,
- network::mojom::HttpCacheBackendFileOperations to support
brokering fileoperations via mojo,
- network::MojoBackedFileOperations as a
disk_cache::BackendFileOperations implementation which uses
network::mojom::HttpCacheBackendFileOperations in the network service,
- HttpCacheBackendFileOperations (in
content/browser/net/http_cache_backend_file_operations_factory.h) as
a network::mojom::HttpCacheBackendFileOperations implementation
- disk_cache::TrivialFileOperations as the trivial
disk_cache::BackendFileOperations implementation.
This change also replaces file operations needed to create the simple
backend of an HTTP cache in a sandboxed network service running on
Android, and tests that with
SandboxedHttpCacheBrowserTest, CreateSimpleCache.
Change-Id: I93463fbbb0eef640f7095a6d0c47626f38af1856
Bug: 1289542
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3447669
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Brad Nelson <bradnelson@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/main@{#979738}
The members of GeneratedCodeCacheContext are always accessed on a
specific thread, so they also have to be reset on that thread to avoid
TSAN failures (and potentially real crashes).
Bug: 1298670, 1285414
Change-Id: I273ed08f343844969823fb347992b39518a5437f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3472846
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#975706}
These were previously moved to a background thread as part of the
NavigationThreadingOptimizations feature, which is now enabled by
default. This change will see if moving to the IO thread is any better.
This also makes a small fix to the background thread code, moving these
from USER_VISIBLE to USER_BLOCKING.
Bug: 1187753
Change-Id: I4573a9b53cdc434b5a968f2fdadb6410ea455b39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3379100
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Christian Dullweber <dullweber@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#957583}
This inlines all remaining DISALLOW_* macros in content/. This is done
manually (vim regex + manually finding insertion position).
IWYU cleanup is left as a separate pass that is easier when these macros
go away.
Bug: 1010217
Change-Id: I8b5ea6dd9f8a3f584cf3eef82634017a38b15be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3193883
Commit-Queue: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#936160}
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}
Design doc:
https://docs.google.com/document/d/1909zoSpNeMogKlmXmRtnSjyuot3YyxU-A_G8Fd4kDhs/edit
The feature is currently disabled by default, and can be enabled by
launching with --enable-features=WebUICodeCache. A subsequent change
will add configuration for a field trial.
Overview of changes (intended to indicate important files, not to
supercede the design document linked above):
1. In content/browser/ and net/, add a new instance of
GeneratedCodeCache with a new type, so that code cache entries for
WebUI are further insulated from the open web. This was a security
recommendation, to limit the chance that any site isolation bug in
the code caching system could become a privilege escalation.
Furthermore, disable deduplication within this new instance.
2. In code_cache_host_impl.cc, allow code caching of scripts that were
loaded via the chrome or chrome-untrusted schemes, if the requesting
page is also WebUI.
3. In scheme_registry.{h,cc}, and web_security_policy.{h,cc}, create a
way that we can define what schemes require a hash check when using
code cache data, because we can't rely on the response time from the
network cache to tell whether a script has changed.
4. In script_resource.cc, for resources loaded from the schemes
specified as needing a hash check, set up a
ScriptCachedMetadataHandler with a flag specifying that a content
hash is required.
5. In resource_loader.cc, for resources loaded from the schemes
specified as needing a hash check, ignore the response time and check
instead whether the Resource has the hash-required flag from step 4.
6. In v8_code_cache.{h,cc}, if the CachedMetadataHandler specifies that
hash checking is required, then check for hash matches when getting
data and include the hash when writing data. The tag at the beginning
of the metadata includes a bit to indicate whether the content hash
is included.
Bug: chromium:1210399
Change-Id: Ie7c1cbab1516b2240a35aaf9fa0e3ce7871321d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2859703
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Maksim Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#908883}