0
Commit Graph

320 Commits

Author SHA1 Message Date
Devon Loehr
c0138d8d14 Stringify bools consistently
This changes instances of `b ? "true" : "false"` to use `base::ToString(b)`
instead. It's a followup to previous changes to address things that were missed
or regressed in the meantime.

This change applies to the following directories: content

This CL was uploaded by an experimental version of git cl split
(https://crbug.com/389069356).

R=creis@chromium.org

Bug: 335797528
Change-Id: I4d4ec7cd9e8c13d09c91637bca88de27bb637842
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6318187
Auto-Submit: Devon Loehr <dloehr@google.com>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1427485}
2025-03-03 17:11:42 -08:00
Sandor Major
07aa8b0689 Move PermissionsPolicy to the network service
The network service needs access to the permissions policy. Previous CLs
moved all the dependencies so it is now safe to move this class.

The following files need to include permissions_policy.h because
otherwise they want to have access into incomplete `PermissionsPolicy`:
* components/permissions/permission_uma_util.cc
* third_party/blink/common/manifest/manifest_util.cc
* third_party/blink/renderer/core/html/client_hints_util.cc
* third_party/blink/renderer/modules/payments/payment_app_service_worker_registration.cc
* third_party/blink/renderer/modules/payments/payment_instruments.cc

Bug: 382291442
Low-Coverage-Reason: LARGE_SCALE_REFACTOR
Change-Id: Ifcf52df3bc5c035e8f6a45df02cf93f304b748c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6310821
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1426391}
2025-02-28 09:24:35 -08:00
Sandor Major
f42e6bd64c Move permissions_policy.cc-used feature flags to the Network service
Permissions Policy code is being moved to the Network service so these
flags need to move as well.

Bug: 382291442
Low-Coverage-Reason: LARGE_SCALE_REFACTOR
Change-Id: I2d6135ef1350f21e08de9053c69c762bfb1fd7ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6287505
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1426039}
2025-02-27 16:12:04 -08:00
Yao Xiao
effa1d6cf0 [shared storage] Add AbsoluteUsefulResourceDuration UMA
Why: This helps to see if there are long-running worklets, which can
impact performance or be exploited for side-channel attacks. If the
result reveals such instances, we will further add UKM to investigate
the specific use cases.

Given that the existing 'UsefulResourceDuration' represents a
percentage, we add 'AbsoluteUsefulResourceDuration' for a distinction.

Bug: 398173023
Change-Id: I8b69362158a35b0861033f8f58a0aa335edb4241
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6287655
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423455}
2025-02-21 15:31:37 -08:00
Roger McFarlane
8952859c39 Use bounded ranges (string_view) for histogram names.
This CL changes the histogram creation APIs to take a durable
string view (i.e., a pointer+size pair referring to memory that
the programmer has annotated that it will not be freed) instead
of just an implicit pointer. The HistogramBase class internally
represents the name's length and the histogram's flags using
16 bits in order to not grow the in-memory size of Histogram
objects. The name of the histogram is subsequently exposed by
HistogramBase as a string_view.

This CL updates consumers of the histogram name's to use a
string_view of the name. This removes many string length
calculations and string copy operations. For histograms
allocated in shared memory, it also avoids potential out-of-
bounds reads if the underlying string data is modified or
corrupted such that it no longer has a trailing NUL char
at the end of the string.

Lastly, this CL updates a number of call-sites where the
histogram names were being copied into short-lived string
objects for use as search keys into various containers to
perform the functionality without making any unnecessary
copies.

Low-Coverage-Reason: TRIVIAL_CHANGE Use of string_view instead of string/char* in some error/logging paths have low coverage.
AX-Relnotes: n/a
Bug: 393394360, 40818143
Change-Id: Iee9ee5ae62335b9e7815f4ae11bde4ff80cfd4a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6231451
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Antonio Rivera <antoniori@google.com>
Commit-Queue: Roger McFarlane <rogerm@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422750}
2025-02-20 12:50:27 -08:00
Yao Xiao
2c68650592 [shared storage] Add lock usage UMAs
Why: this helps to understand web locks adoptions.

What:
- When a worklet is destroyed, record whether navigator.locks was
  requested.
- When an update method is triggered (for individual method and for
  batchUpdate() separately), record whether the 'withLock' option is
  specified.

Bug: 373899210
Change-Id: I3ce97533345393c833b2861794bc52aad83573f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6277481
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421614}
2025-02-18 13:18:11 -08:00
Sandor Major
878f835180 Move ParsedPermissionsPolicyDeclaration from Blink to Network service
The network service is going to need access to the "storage-access"
Permissions Policy. This is the third step of moving some of the
Permissions Policy logic out of Blink to maintain a single
implementation of https://w3c.github.io/webappsec-permissions-policy
across Chromium.

Bug: 382291442
Low-Coverage-Reason: LARGE_SCALE_REFACTOR
Change-Id: Ic6ad87dd4bd6f882a135a0c580d481dc1b219831
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6254141
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Reviewed-by: Giovanni Ortuno Urquidi <ortuno@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421574}
2025-02-18 12:16:02 -08:00
Sandor «Alex» Major
c41217fd82 Reland "Fix Permissions Policy includes"
This reverts commit 720f465c92.

Reason for revert: https://crrev.com/c/6269804 shouldn't affect tests

Original change's description:
> Revert "Fix Permissions Policy includes"
>
> This reverts commit 989865934e.
>
> Reason for revert: Causing SharedStorageFencedFrameChromeBrowserTest failure (crbug/396718068)
>
> Original change's description:
> > Fix Permissions Policy includes
> >
> > This should make reviews of https://crrev.com/c/6254141 easier
> >
> > Bug: 382291442
> > Change-Id: Ibf1b3b0d17914c457074f9d39e054654822109ad
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6269804
> > Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> > Reviewed-by: Rick Byers <rbyers@chromium.org>
> > Commit-Queue: Rick Byers <rbyers@chromium.org>
> > Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> > Owners-Override: Rick Byers <rbyers@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1420643}
>
> Bug: 382291442, 396718068
> Change-Id: I5654fa7f5cdb6a5e086e18161ffe39176b43b630
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6271463
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Wenyu Fu <wenyufu@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Wenyu Fu <wenyufu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1420743}

Bug: 382291442, 396718068
Change-Id: Id1d4b3fd098df7c5aa61daa1b1b247a016ec1472
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6271184
Commit-Queue: Wenyu Fu <wenyufu@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Wenyu Fu <wenyufu@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Wenyu Fu <wenyufu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420774}
2025-02-14 15:33:13 -08:00
Wenyu Fu
720f465c92 Revert "Fix Permissions Policy includes"
This reverts commit 989865934e.

Reason for revert: Causing SharedStorageFencedFrameChromeBrowserTest failure (crbug/396718068)

Original change's description:
> Fix Permissions Policy includes
>
> This should make reviews of https://crrev.com/c/6254141 easier
>
> Bug: 382291442
> Change-Id: Ibf1b3b0d17914c457074f9d39e054654822109ad
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6269804
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Rick Byers <rbyers@chromium.org>
> Commit-Queue: Rick Byers <rbyers@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Owners-Override: Rick Byers <rbyers@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1420643}

Bug: 382291442, 396718068
Change-Id: I5654fa7f5cdb6a5e086e18161ffe39176b43b630
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6271463
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Wenyu Fu <wenyufu@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Wenyu Fu <wenyufu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420743}
2025-02-14 14:14:07 -08:00
Sandor Major
989865934e Fix Permissions Policy includes
This should make reviews of https://crrev.com/c/6254141 easier

Bug: 382291442
Change-Id: Ibf1b3b0d17914c457074f9d39e054654822109ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6269804
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Rick Byers <rbyers@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420643}
2025-02-14 11:49:01 -08:00
Sandor Major
ca47512a38 Reland "Move OriginWithPossibleWildcards from Blink to the Network service"
This is a reland of commit 0ea18895e7
Original change is in Patchset 1

The trait for `OriginWithPossibleWildcards` was depending on
`url_loader_base_shared` but it should depend on `url_loader_base`
I also got some hints how to reproduce this locally and it seems to
build properly now.

Original change's description:
> Reland "Move `OriginWithPossibleWildcards` from Blink to the Network service"
>
> This is a reland of commit 8cd5274221
> Original change is in Patchset 1
> The revert CL can be found here: https://crrev.com/c/6234523
>
>
> Original change's description:
> > Move `OriginWithPossibleWildcards` from Blink to the Network service
> >
> > The network service is going to need access to the "storage-access"
> > Permissions Policy. This is the second step of moving some of the
> > Permissions Policy logic out of Blink to maintain a single
> > implementation of https://w3c.github.io/webappsec-permissions-policy
> > across Chromium.
> >
> > The previous cl is under https://crrev.com/c/6219635
> >
> > Some files got a new include for
> > permissions_policy_feature.mojom-shared.h without content change. This
> > was required because previously the shared mojom header was probably
> > included transitively and now it's not anymore.
> >
> > Bug: 382291442
> > Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
> > Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> > Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> > Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> > Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> > Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> > Reviewed-by: Joe Mason <joenotcharles@google.com>
> > Owners-Override: Jeremy Roman <jbroman@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1416344}
>
> Bug: 382291442
> Change-Id: I540867ed61dbe858ee59cce96643692c01fc8f3b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6238257
> Owners-Override: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Joe Mason <joenotcharles@google.com>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1418188}

Bug: 382291442
Change-Id: If50327575954864dfe0638ed6d8d946a122beebc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6250085
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Owners-Override: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418692}
2025-02-11 08:58:04 -08:00
Jiacheng Guo
10600c26fe Add ProcessAllocationContext when allocating renderer processes
The CL adds ProcessAllocationContext to track the context when
allocating a renderer process. The context information will be used to
log UMAs when the browser fails to find a spare renderer for the allocation
request.

The design doc can be found at:
https://docs.google.com/document/d/1E3_3BUvSmQCz7XsRKAYyZn0uXWIeNuEWMsJsH-Gl2PI/edit?usp=sharing&resourcekey=0-SRNb8I8YuGz3HFJJZ1lG5w

Bug: 388998723
Change-Id: I69b012c12967dc34df26eb67ec9ab1145595a6a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6217682
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Jiacheng Guo <gjc@google.com>
Cr-Commit-Position: refs/heads/main@{#1418401}
2025-02-10 17:10:17 -08:00
Yao Xiao
4b5842c9a4 Revert "Reland "Move OriginWithPossibleWildcards from Blink to the Network service""
This reverts commit 0ea18895e7.

Reason for revert: caused build failure: https://ci.chromium.org/ui/p/chromium/builders/ci/win32-archive-rel/47925/overview

Original change's description:
> Reland "Move `OriginWithPossibleWildcards` from Blink to the Network service"
>
> This is a reland of commit 8cd5274221
> Original change is in Patchset 1
> The revert CL can be found here: https://crrev.com/c/6234523
>
>
> Original change's description:
> > Move `OriginWithPossibleWildcards` from Blink to the Network service
> >
> > The network service is going to need access to the "storage-access"
> > Permissions Policy. This is the second step of moving some of the
> > Permissions Policy logic out of Blink to maintain a single
> > implementation of https://w3c.github.io/webappsec-permissions-policy
> > across Chromium.
> >
> > The previous cl is under https://crrev.com/c/6219635
> >
> > Some files got a new include for
> > permissions_policy_feature.mojom-shared.h without content change. This
> > was required because previously the shared mojom header was probably
> > included transitively and now it's not anymore.
> >
> > Bug: 382291442
> > Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
> > Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> > Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> > Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> > Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> > Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> > Reviewed-by: Joe Mason <joenotcharles@google.com>
> > Owners-Override: Jeremy Roman <jbroman@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1416344}
>
> Bug: 382291442
> Change-Id: I540867ed61dbe858ee59cce96643692c01fc8f3b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6238257
> Owners-Override: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Joe Mason <joenotcharles@google.com>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1418188}

Bug: 382291442
Change-Id: I4bf4fa5e3034e15791e1acae63cc665a4e3d12bb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6248599
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Owners-Override: Yao Xiao <yaoxia@chromium.org>
Auto-Submit: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418238}
2025-02-10 10:34:15 -08:00
Sandor Major
0ea18895e7 Reland "Move OriginWithPossibleWildcards from Blink to the Network service"
This is a reland of commit 8cd5274221
Original change is in Patchset 1
The revert CL can be found here: https://crrev.com/c/6234523


Original change's description:
> Move `OriginWithPossibleWildcards` from Blink to the Network service
>
> The network service is going to need access to the "storage-access"
> Permissions Policy. This is the second step of moving some of the
> Permissions Policy logic out of Blink to maintain a single
> implementation of https://w3c.github.io/webappsec-permissions-policy
> across Chromium.
>
> The previous cl is under https://crrev.com/c/6219635
>
> Some files got a new include for
> permissions_policy_feature.mojom-shared.h without content change. This
> was required because previously the shared mojom header was probably
> included transitively and now it's not anymore.
>
> Bug: 382291442
> Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Joe Mason <joenotcharles@google.com>
> Owners-Override: Jeremy Roman <jbroman@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1416344}

Bug: 382291442
Change-Id: I540867ed61dbe858ee59cce96643692c01fc8f3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6238257
Owners-Override: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418188}
2025-02-10 08:54:55 -08:00
Anton Maliev
666c9c8203 Revert "Move OriginWithPossibleWildcards from Blink to the Network service"
This reverts commit 8cd5274221.

Reason for revert: Tree is closed due to compile error: https://ci.chromium.org/ui/p/chromium/builders/ci/mac-arm64-archive-rel/43617/overview

Original change's description:
> Move `OriginWithPossibleWildcards` from Blink to the Network service
>
> The network service is going to need access to the "storage-access"
> Permissions Policy. This is the second step of moving some of the
> Permissions Policy logic out of Blink to maintain a single
> implementation of https://w3c.github.io/webappsec-permissions-policy
> across Chromium.
>
> The previous cl is under https://crrev.com/c/6219635
>
> Some files got a new include for
> permissions_policy_feature.mojom-shared.h without content change. This
> was required because previously the shared mojom header was probably
> included transitively and now it's not anymore.
>
> Bug: 382291442
> Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Joe Mason <joenotcharles@google.com>
> Owners-Override: Jeremy Roman <jbroman@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1416344}

Bug: 382291442
Change-Id: I8a8749ea77398bce5a1c6c3e2d0dfd5e06945b97
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6234523
Auto-Submit: Anton Maliev <amaliev@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Anton Maliev <amaliev@chromium.org>
Owners-Override: Anton Maliev <amaliev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416362}
2025-02-05 11:50:33 -08:00
Sandor Major
8cd5274221 Move OriginWithPossibleWildcards from Blink to the Network service
The network service is going to need access to the "storage-access"
Permissions Policy. This is the second step of moving some of the
Permissions Policy logic out of Blink to maintain a single
implementation of https://w3c.github.io/webappsec-permissions-policy
across Chromium.

The previous cl is under https://crrev.com/c/6219635

Some files got a new include for
permissions_policy_feature.mojom-shared.h without content change. This
was required because previously the shared mojom header was probably
included transitively and now it's not anymore.

Bug: 382291442
Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Owners-Override: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416344}
2025-02-05 11:20:26 -08:00
Dan McArdle
c82203c16d Shared Storage: Move browsertests for Fenced Frame to new file
This is a behavior-preserving refactor.

Bug: 392049826
Low-Coverage-Reason: TRIVIAL_CHANGE
Change-Id: I2e2c6a324e43ad246a58a5d1f1e022fe07a5bd16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6219380
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Auto-Submit: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1415780}
2025-02-04 13:05:02 -08:00
David Sanders
f583e506ff Add missing includes of //base/metrics/histogram_functions.h (1/N)
Bug: 40216326
Change-Id: Iba3932754d47e887dda53052b82a58d5cd4d92a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6183272
Owners-Override: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414729}
2025-02-02 17:55:00 -08:00
Alex Turner
116d390d65 Create PrivateAggregationPendingContributions and wrapper classes
We plan to use the new class to support the new
`kPrivateAggregationApiErrorReporting` feature, which is currently
disabled by default (and not yet implemented).  In this cl, the main
class is empty, with a TODO to implement the logic.

However, the nested Wrapper class is a fairly basic union type that
conditionally contains either the main class (if the error reporting
feature is enabled) or a vector of contributions (if the feature is
disabled). This cl also switches some plumbing to use this new Wrapper
class, which will simplify future implementation work. It also moves the
definition of ContributionMergeKey to the new class to reflect the new
class's intended (eventual) role.

This cl should be a no-op, given the disabled feature.

Bug: 381788013
Change-Id: I92e4dcebfa786e0327cd12c9104b4dbc9760dc1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6079892
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414416}
2025-01-31 14:44:54 -08:00
Sandor «Alex» Major
e9545a72e6 Reland "Move PermissionsPolicyFeature from Blink to the Network service"
This is a reland of commit 1b851527a0

A new usage of `PermissionsPolicyFeature` appeared in the meantime.
Fixed in this CL.

Original change's description:
> Move `PermissionsPolicyFeature` from Blink to the Network service
>
> The network service is going to need access to the "storage-access"
> Permissions Policy. This is the first step of moving some of the
> Permissions Policy logic out of Blink to maintain a single
> implementation of https://w3c.github.io/webappsec-permissions-policy
> across Chromium.
>
> Tha main change here is moving the `PermissionsPolicyFeature` type from
> `blink.mojom` to `network.mojom`:
> https://crrev.com/c/6180431/7/services/network/public/mojom/permissions_policy/permissions_policy_feature.mojom
>
> Bug: 382291442
> Change-Id: Ib99fbd285031936dbf40d5f210816cc775c51dfa
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6180431
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Owners-Override: Rick Byers <rbyers@chromium.org>
> Reviewed-by: Rick Byers <rbyers@chromium.org>
> Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1414133}

Bug: 382291442
Change-Id: I853b73f61ab7ecd807fc3d16cd2895c353ebd126
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6219635
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414345}
2025-01-31 12:40:46 -08:00
Kevin McNee
4a02d170a9 Revert "Move PermissionsPolicyFeature from Blink to the Network service"
This reverts commit 1b851527a0.

Reason for revert: Broke the build https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20MSan%20Builder/86647/overview

Original change's description:
> Move `PermissionsPolicyFeature` from Blink to the Network service
>
> The network service is going to need access to the "storage-access"
> Permissions Policy. This is the first step of moving some of the
> Permissions Policy logic out of Blink to maintain a single
> implementation of https://w3c.github.io/webappsec-permissions-policy
> across Chromium.
>
> Tha main change here is moving the `PermissionsPolicyFeature` type from
> `blink.mojom` to `network.mojom`:
> https://crrev.com/c/6180431/7/services/network/public/mojom/permissions_policy/permissions_policy_feature.mojom
>
> Bug: 382291442
> Change-Id: Ib99fbd285031936dbf40d5f210816cc775c51dfa
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6180431
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Owners-Override: Rick Byers <rbyers@chromium.org>
> Reviewed-by: Rick Byers <rbyers@chromium.org>
> Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1414133}

Bug: 382291442
Change-Id: I068a9cbfb77057ded4295dc214aee51bee8a503c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6219376
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Kevin McNee <mcnee@chromium.org>
Owners-Override: Kevin McNee <mcnee@google.com>
Cr-Commit-Position: refs/heads/main@{#1414150}
2025-01-31 08:22:14 -08:00
Sandor Major
1b851527a0 Move PermissionsPolicyFeature from Blink to the Network service
The network service is going to need access to the "storage-access"
Permissions Policy. This is the first step of moving some of the
Permissions Policy logic out of Blink to maintain a single
implementation of https://w3c.github.io/webappsec-permissions-policy
across Chromium.

Tha main change here is moving the `PermissionsPolicyFeature` type from
`blink.mojom` to `network.mojom`:
https://crrev.com/c/6180431/7/services/network/public/mojom/permissions_policy/permissions_policy_feature.mojom

Bug: 382291442
Change-Id: Ib99fbd285031936dbf40d5f210816cc775c51dfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6180431
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414133}
2025-01-31 07:48:32 -08:00
Dan McArdle
e53ee3b96e Shared Storage: Move browsertests for Private Aggregation to new file
This is a behavior-preserving refactor.

Bug: 392049826
Change-Id: I4acc3b214d0d104b59638258813c82c30a9b9966
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216758
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414094}
2025-01-31 06:57:09 -08:00
Dan McArdle
84617d1b40 Shared Storage: Move SharedStorageBrowserTestBase out of browser test
This is a behavior-preserving refactor.

This CL moves SharedStorageBrowserTestBase and
TestSharedStorageRuntimeManager out of the monolithic
shared_storage_browsertest.cc and into their own source files.

Bug: 392049826
Change-Id: Ibd9fb26c51f250284ed63d63ee210c39f061a656
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216404
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414093}
2025-01-31 06:56:53 -08:00
Dan McArdle
920026e19f Shared Storage: Move TestSharedStorageObserver out of browser test
This is a behavior-preserving refactor.

Bug: 392049826
Change-Id: I41da253a95645c89beeda846b65dee53236f30b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6213916
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414092}
2025-01-31 06:55:55 -08:00
Dan McArdle
f0d28e506e Shared Storage: Move TestSharedStorageWorkletHost out of browser test
This is a behavior-preserving refactor.

This CL starts the process of chipping away at our currently-monolithic
shared_storage_browsertest.cc by pulling out classes into their own
source files. It also fixes a number of missing includes.

Next, we can move TestSharedStorageRuntimeManager, after which we should
be able to move SharedStorageBrowserTestBase. Once the base class is
moved, we'll be ready to move thousands of lines of tests into
shared_storage_private_aggregation_browser_test.cc, which I expect will
have a noticeable impact on build times for anyone working on these
browser tests.

Bug: 392049826
Change-Id: Ibdef9d18d26778304a307d4c8b22f611cdcd1f90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6214056
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414091}
2025-01-31 06:55:42 -08:00
Dan McArdle
7831ea3752 Shared Storage: Implement Private Aggregation per-context limits
This CL implements the Shared Storage side of Private Aggregation's
per-context limits feature, gated behind the blink feature flag
`kPrivateAggregationApiMaxContributions`, which is disabled by default.

Specifically, this CL makes the following changes:

* Adds a runtime-enabled `maxContributions` field to the
  `SharedStoragePrivateAggregationConfig` IDL dictionary.

* Handles `maxContributions` in `CheckPrivateAggregationConfig()`.
  Paired with the IDL change, this enables JS to set `maxContributions`.

* Adds browser test coverage. Primarily, we're testing that the field is
  ignored when the feature is disabled, and that it actually affects the
  number of contributions per report when the feature is enabled.

This CL contains no web-visible behavior changes.

Bug: 376707230
Change-Id: Icf883015af3cb00c8d72e1dc63114f2656b51b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6175278
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1413558}
2025-01-30 09:17:21 -08:00
Josh Karlin
bd5130d2b8 [Shared Storage] Enable web locks for Shared Storage by default
Chrome Status Entry: https://chromestatus.com/feature/5133950203461632


Bug: 373899210
Change-Id: I8fb0e5548eb6f0d3128b4debf1d3e8f1e5420721
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6179702
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1413102}
2025-01-29 12:35:36 -08:00
Josh Karlin
027984eae9 [Shared Storage] Downgrade console error to info
There is a console error posted when a selectURL call does not have
enough budget. Since this is an expected behavior and not indicative
of a problem with the page itself, this should be downgraded to kInfo.

Bug: 392828497
Change-Id: Id62715bf5de0c768a7f7a24fdcdf423943b476ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6206929
Reviewed-by: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412928}
2025-01-29 07:56:17 -08:00
Jiacheng Guo
914790cab9 Reland "Add SiteInstance::GetOrCreateProcess for creating a renderer process"
This is a reland of commit 6ae65e31a3

Some test case failures are not captured by the CQ and happens only in
the CI. To avoid back-and-forth reverts, the reland splits the field
trial config into another CL.

Original change's description:
> Add SiteInstance::GetOrCreateProcess for creating a renderer process
>
> The CL replaces SiteInstance::GetProcess with
> SiteInstance::GetOrCreateProcess.
> Calling GetProcess() without an process shall cause a CHECK failure
> instead. To avoid introducing extra crashes, a feature flag
> TraceSiteInstanceGetProcessCreation is introduced to call
> DumpWithoutCrashing instead. After verifying and fixing the captured
> tracebacks, a CHECK will be added to GetProcess().
>
> Design doc:
> https://docs.google.com/document/d/1E3_3BUvSmQCz7XsRKAYyZn0uXWIeNuEWMsJsH-Gl2PI/edit?usp=sharing&resourcekey=0-SRNb8I8YuGz3HFJJZ1lG5w
>
> Bug: 388998723, 41452811, 391970626
> Change-Id: I5cc1efec7289c8751939e0a57681da5e0e1721ab
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6166588
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Reviewed-by: Erik Chen <erikchen@chromium.org>
> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
> Commit-Queue: Jiacheng Guo <gjc@google.com>
> Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1412113}

Bug: 388998723, 41452811, 391970626
Change-Id: Iec6db7950a55da2d8297e51d2ae563488ae2023d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6207368
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Commit-Queue: Jiacheng Guo <gjc@google.com>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412676}
2025-01-28 18:20:30 -08:00
Dan McArdle
f1b2827b0e PrivateAggregation: Optimize special case of maxContributions
This CL implements an optimization for per-context limits, which are
still gated by a feature and disabled by default.

We're making `ShouldSendReportDeterministically()` a little more clever,
with the goal of enabling Private Aggregation to send fewer null reports
without loss of privacy. Rather than requiring determinism whenever the
`std::optional<size_t> max_contributions` parameter has a value, we will
now additionally require that it would make the aggregatable report
stick out. This resembles the semantics of the `filtering_id_max_bytes`
parameter.

This CL should not contain any web-visible behavior changes, primarily
because none of the calling APIs have defined the `maxContributions`
field yet.

Bug: 376707230
Change-Id: Iee0d849170e728fd9cdc540daa83881ce96a21dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6183147
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412280}
2025-01-28 06:56:08 -08:00
Florian Jacky
05c4b5c28e Revert "Add SiteInstance::GetOrCreateProcess for creating a renderer process"
This reverts commit 6ae65e31a3.

Reason for revert: Potential culprit for builder failures.

Bug: 392790046

Original change's description:
> Add SiteInstance::GetOrCreateProcess for creating a renderer process
>
> The CL replaces SiteInstance::GetProcess with
> SiteInstance::GetOrCreateProcess.
> Calling GetProcess() without an process shall cause a CHECK failure
> instead. To avoid introducing extra crashes, a feature flag
> TraceSiteInstanceGetProcessCreation is introduced to call
> DumpWithoutCrashing instead. After verifying and fixing the captured
> tracebacks, a CHECK will be added to GetProcess().
>
> Design doc:
> https://docs.google.com/document/d/1E3_3BUvSmQCz7XsRKAYyZn0uXWIeNuEWMsJsH-Gl2PI/edit?usp=sharing&resourcekey=0-SRNb8I8YuGz3HFJJZ1lG5w
>
> Bug: 388998723, 41452811, 391970626
> Change-Id: I5cc1efec7289c8751939e0a57681da5e0e1721ab
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6166588
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Reviewed-by: Erik Chen <erikchen@chromium.org>
> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
> Commit-Queue: Jiacheng Guo <gjc@google.com>
> Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1412113}

Bug: 388998723, 41452811, 391970626
Change-Id: I44bfd3db0f1de0d20c79c18b502889d2b72f5624
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6206286
Auto-Submit: Florian Jacky <fjacky@chromium.org>
Owners-Override: Florian Jacky <fjacky@chromium.org>
Commit-Queue: Florian Jacky <fjacky@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1412153}
2025-01-28 00:54:42 -08:00
Jiacheng Guo
6ae65e31a3 Add SiteInstance::GetOrCreateProcess for creating a renderer process
The CL replaces SiteInstance::GetProcess with
SiteInstance::GetOrCreateProcess.
Calling GetProcess() without an process shall cause a CHECK failure
instead. To avoid introducing extra crashes, a feature flag
TraceSiteInstanceGetProcessCreation is introduced to call
DumpWithoutCrashing instead. After verifying and fixing the captured
tracebacks, a CHECK will be added to GetProcess().

Design doc:
https://docs.google.com/document/d/1E3_3BUvSmQCz7XsRKAYyZn0uXWIeNuEWMsJsH-Gl2PI/edit?usp=sharing&resourcekey=0-SRNb8I8YuGz3HFJJZ1lG5w

Bug: 388998723, 41452811, 391970626
Change-Id: I5cc1efec7289c8751939e0a57681da5e0e1721ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6166588
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Jiacheng Guo <gjc@google.com>
Reviewed-by: Emilia Paz <emiliapaz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412113}
2025-01-27 22:49:49 -08:00
Dan McArdle
146dc341fb PrivateAggregation: Rename api_for_budgeting parameter to caller_api
Bug: 376707230
Change-Id: Ief9ef08c5b4e90d025ebbad4665548291e1dfe8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6176162
Reviewed-by: Alex Turner <alexmt@chromium.org>
Auto-Submit: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1410512}
2025-01-23 12:52:14 -08:00
Dan McArdle
5244c2f4d6 PrivateAggregation: Implement per-context limits gated by feature
This CL takes the following steps towards implementing per-context
contribution limits:

* Adds `blink::features::kPrivateAggregationApiMaxContributions`,
  disabled by default.

* Implements the Private Aggregation logic for the `maxContributions`
  config field and adds unit tests.

* Hardcodes `maxContributions` as `std::nullopt` in Shared Storage and
  Protected Audience.

This should not contain any web-visible behavior changes, primarily
because none of the calling APIs have defined the `maxContributions`
field yet.

Bug: 376707230
Change-Id: I0b065ab8fb2383ec502cd018e6e66862ebba1ba1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6172853
Reviewed-by: Mike Taylor <miketaylr@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1410414}
2025-01-23 09:36:31 -08:00
Ramon Cano Aparicio
6797d4e5e1 Rename HistogramBase::Sample to Sample32 in content.
Add size to type name so the size is known without needing to lookup
the typedef.
Continuation of https://chromium-review.googlesource.com/c/chromium/src/+/6163590

Changed occurrences under chromium/content

Bug: 40899968
Change-Id: I18af5c2d8d86656d0afc3a6094ab1aa5cb1b2f4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6164150
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Jinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: Ryan Tarpine <rtarpine@chromium.org>
Reviewed-by: Roman Arora <romanarora@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Luc Nguyen <lucnguyen@google.com>
Commit-Queue: Ramon Cano Aparicio <rcanoaparicio@google.com>
Cr-Commit-Position: refs/heads/main@{#1404808}
2025-01-10 08:09:02 -08:00
Sandor Major
d1bbf7751c Deduplicate permissions policy getter
RFHI's permissions_policy() and GetPermissionsPolicy() are doing the
same thing, keeping the latter as that's exposed on the RFH as well.

Bug: 382291442
Change-Id: I846764815f6adb72c6906c59d6d6810e02a5d611
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6164805
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404447}
2025-01-09 14:49:30 -08:00
Yao Xiao
08d1543f81 [shared storage] Implement the batch with_lock option for response header
Parse "options;with_lock=xxx" into the `with_lock` parameter. If
multiple "options" Items appear in the List, the last one will be
used. The parsed value is passed to the browser process's
`BatchUpdate()` API in the lock manager.

This allows developers to perform multiple Shared Storage operations
atomically within a single lock, as part of the Web Lock integration
proposal:
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205

Bug: 373899210
Change-Id: Id041e92075b22988656a3db4f1a74792312ee422
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6072742
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1397664}
2024-12-17 16:56:36 -08:00
Emily Andrews
d15fd76ecb Change RenderProcessHost::GetID to RenderProcessHost::GetDeprecatedID
This change bulk changes RenderProcessHost::GetID to
RenderProcessHost::GetDeprecatedID to support the transition to a
strongly typed ChildProcessId.

Bug: 379869738
Change-Id: Ib0c991536486ef29702ea166cdcf12ea68ed70ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6065543
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Emily Andrews <emiled@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1394500}
2024-12-10 20:41:54 +00:00
Helmut Januschka
aaadb80208 Remove unused kOverallBudgetRemaining constant /content/b/shared_storage
Bug: 378385004
Change-Id: I219ab168d94d7bc2fac558d7a2936d36078ac204
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6076171
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Commit-Queue: Cammie Smith Barnes <cammie@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1393991}
2024-12-10 00:20:57 +00:00
Yao Xiao
6614173ce0 [shared storage] Switch to call BatchUpdate() for response headers
In SharedStorageHeaderObserver::HeaderReceived(), switch to call
BatchUpdate() without a lock. The external behavior is the same with
calling individual Update() sequentially. Some testing components and
the callback parameters are updated accordingly (e.g., now, an
'operation' corresponds to the whole batch, rather than an individual
method).

This prepares for the upcoming change to introduce the batch options'
`with_lock` parameter.

Bug: 373899210
Change-Id: I4f82bf318ead5719382857a61c0c5af79352dbf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6073263
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1392633}
2024-12-05 23:52:50 +00:00
Dan McArdle
1b9ff1e513 PrivateAggregation: Require timeout for deterministic reports
Bug: 376479670
Change-Id: Ifd152e3e60bed05a8060e9699a8f7a6f60bd2154
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5979345
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1392617}
2024-12-05 23:28:28 +00:00
Yao Xiao
6575b4a432 [shared storage] Implement batchUpdate() for Window and SharedStorageWorklet context
This allows developers to perform multiple Shared Storage operations
atomically within a single lock, as part of the Web Lock integration
proposal:
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205

How:
- Add `batchUpdate(methods, options)` to the `SharedStorage` interface.
- Hooks up the `batchUpdate()` method to the
  `SharedStorageLockManager::SharedStorageBatchUpdate()` API in the
  browser process.

Bug: 373899210
Fuchsia-Binary-Size: Size increase is unavoidable.
Change-Id: I0e1b355e3b3d28518396ae4333afe21e6d02e858
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6069087
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391933}
2024-12-04 23:21:31 +00:00
Yao Xiao
17f053ad53 [shared storage] Add SharedStorageSet/Append/Delete/Clear IDL Interface
Implement the constructor for `SharedStorageSetMethod`, etc. The
error handling logic mirrors the existing sharedStorage.set(), etc.
To allow code reuse, the sharedStorage.set(), etc. methods
now creates the object and early return on exceptions.

Note that even though we no longer explicitly call resolver->Reject()
for sharedStorage.set(), etc., Chrome still converts thrown
exceptions to rejected promises (to adhere to the specification [1]),
so the end result is the same.

This prepares for the implementation of the
`sharedStorage.batchUpdate(methods)` method, as part of the Web Lock
integration proposal:
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205

[1] https://w3ctag.github.io/promises-guide/#always-return-promises

Bug: 373899210
Change-Id: Ie4edfedbe755afeb3db5ca557fd74482bac96138
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6054694
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390779}
2024-12-03 03:25:50 +00:00
Camillia Smith Barnes
08cef51ae0 Shared Storage: Plumb worklet creation method to browser
Currently, addModule and createWorklet use the same code path in the
browser and are (mostly) indistinguishable there. In this CL, we send
an extra bit via mojom from the renderer to the browser so that
SharedStorageWorkletHost can definitively distinguish between worklets
that have been created using addModule and those created via
createWorklet. This is in preparation for updating our reports to
DevTools to distinguish between calls to addModule and calls to
createWorklet.

Bug: 381899615
Change-Id: Ice20558f1456fe860d698287c7445a07096de2f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6064024
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Auto-Submit: Cammie Smith Barnes <cammie@chromium.org>
Commit-Queue: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Giovanni Ortuno Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390665}
2024-12-02 23:17:28 +00:00
Yao Xiao
a35131209d [shared storage] Add SharedStorageLockManager::SharedStorageBatchUpdate() API
This prepares for the batchUpdate() Web API change.

Explainer PR(s):
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205

How:
 - The SharedStorageBatchUpdate method first acquires the batch-level
   lock if requested (`with_lock` is present). Then, under the
   batch-level lock, it handles each method with any necessary
   individual lock. Finally, it releases the batch-level lock and
   invokes `callback`.
 - Note that the batch lock is released as soon as all methods are
   posted to the database, whereas the callback is invoked only after
   the database responses are available. This aligns with the
   established pattern for `SharedStorageUpdate` (i.e., we only
   have a single database task queue, so releasing the lock "sooner"
   still produces the correct behavior, and has better performance).

Bug: 373899210
Change-Id: Iaf2c1ea50ac11c3dd57624ee44004c35ccf5ecbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6055330
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390564}
2024-12-02 20:55:11 +00:00
Ari Chivukula
59b029192e Clean up stale base::Feature "SharedStorageAPIM125"
This feature seems to have fully launched, so lets cleanup per the
comment in third_party/blink/public/common/features.h

Bug: 356625345, 40185706
Change-Id: I45c1c2e8e5925a399bbd73bbdd0c77dff3b2c7ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6049896
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1389593}
2024-11-29 01:31:56 +00:00
Camillia Smith Barnes
48053290d8 Shared Storage: Support custom data origin in createWorklet
We add support for custom data origins.

See https://github.com/WICG/shared-storage/pull/198
and https://github.com/WICG/shared-storage/pull/206.

Bug: 376278213
Change-Id: I7589ef08e68a8ec416d5ba1b986a81974f3e34d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5996831
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388907}
2024-11-27 17:28:08 +00:00
Yao Xiao
79a50bf374 [shared storage] Implement withLock option for methods from PA worklets
Similar to what has been done for Window, SharedStorageWorklet, and
response headers, we add the `withLock` parameter parsing logic in the
PA worklet, and send the final request to the browser process's central
SharedStorageLockManager component.

We reuse AccessType::kWorkletSet, etc. for displaying events in
DevTools. Filed crbug.com/380291909 to further distinguish PA
worklet access from shared storage worklet access.

Bug: 373899210
Change-Id: Ia16d256167be5a43adba699c2c9b55a626f7b0e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6047561
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388539}
2024-11-26 23:54:23 +00:00
Yao Xiao
7177f6736f [shared storage] Implement with_lock option for methods from response headers
Explainer PR(s):
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205

How:
- Add the parameter parsing logic in the network service, and send the
  final request to the browser process's central
  SharedStorageLockManager component.
- Since SharedStorageLockManager::SharedStorageUpdate() hides the
  exact database result, we update observer's OnMethodFinished()'s
  parameters accordingly. In the test observer, the error message is
  further transformed into a boolean 'success' result. This callback
  is only used in tests and it's not important to assert the detailed
  result anyway.
- A new test, `SharedStorageHeaderObserverTest.Append_NoCapacity`,
  has been added to demonstrate the case where `SharedStorageUpdate`
  encounters an error.

Bug: 373899210
Change-Id: I4588c83174d465e7248cc1f41c9b7a693aa326f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6042601
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388298}
2024-11-26 17:22:50 +00:00