0
Commit Graph

185 Commits

Author SHA1 Message Date
Dan McArdle
da911aec7a PrivateAggregationBudgeter: Eliminate storage initialization callback
Currently, `PrivateAggregationBudgeter` defers storage initialization by
binding a callback to a private method in the constructor and lazily
running the callback the first time storage is needed.

Subjectively, it's a little confusing for the reader because they have
to untangle this indirect control flow. This CL removes the callback and
instead calls the private method directly. The tradeoff is that we now
have to explicitly store the method's parameters as private fields.

Another benefit of this more explicit control flow is that it eliminates
the `WeakPtr` bound to the callback. I found that `WeakPtr` a little
confusing because it implied that there's a chance that we'd initialize
storage after destroying `this`.

Change-Id: I8925196fe3b7762d5e4ebd8918c44f449b357eb2
Bug: 398173022
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6287446
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423293}
2025-02-21 11:56:31 -08:00
Alex Turner
1f8da17601 Support aggregate error reporting in the PrivateAggregationHost
Adds support for the kPrivateAggregationApiErrorReporting feature,
including its ContributeToHistogramOnEvent() method. When the feature is
enabled, delegates triggering those conditional contributions (as well
as general merging and truncation) to the
PrivateAggregationPendingContributions object. Also allows debug keys to
be set on null reports.

When the feature is disabled (which it is by default), this cl should
have no effect.

Bug: 381788013
Change-Id: If10f2236a54ab08f916ed02c7bc92b74a2d1f435
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6207481
Reviewed-by: Dan McArdle <dmcardle@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: mmenke <mmenke@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423164}
2025-02-21 08:30:19 -08:00
Alex Turner
d405d322a6 Add histograms to PrivateAggregationPendingContributions
These histograms measure important situations in the object. This will
help inform whether certain memory limits are appropriate as well as
monitoring other behavior. One of these metrics
(NumContributionMergeKeys) approximately matches an existing metric,
with the old metric being recorded when the aggregate error reporting
feature is disabled, and the new metric when the feature is enabled.

Bug: 381788013
Change-Id: Id01ad8ddcbe9bb7a37263e50658d6be1005adeb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6242562
Reviewed-by: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423163}
2025-02-21 08:28:45 -08:00
Evan Stade
3ffd78a4e2 Fix private aggregation budgets proto in component build.
Newer protobuf adds some dchecks that catch that static symbols weren't
linking properly.

Bug: 328417294
Change-Id: If66e36dc1296e6cf2e12006c6f6c5f3d6c778d02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6235017
Auto-Submit: Evan Stade <estade@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416348}
2025-02-05 11:24:02 -08:00
Alex Turner
2171020147 Implement PrivateAggregationPendingContributions
Adds support for making contributions conditional on an error event (in
PrivateAggregationPendingContributions). Also adds support for ordinary
(unconditional) contributions to the same class. Additionally defines
the list of error events. While this definition is in a mojo file, it
is not yet used in the mojo interface. (This will be added in a future
cl.) This support is gated behind a (disabled by default) feature flag.
So, this cl is a no-op.

Bug: 381788013
Change-Id: Ia3a603b0e8e8971a26fca8cfa350f0fb36fa9f93
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6086115
Reviewed-by: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1415635}
2025-02-04 09:44:56 -08:00
Anthony Vallée-Dubois
9adf0bbf4b Builder pattern in DatabaseOptions
DatabaseOptions is getting too large for the "explicit out of line
constructor for complex types" presubmit. Adding a constructor to it
prevents it from being an aggregate type, which is how most of the
callers currently use it.

This Cl makes DatabaseOptions members private and adds builder-type
setters for each member. It also updates all callers, and adds an out of
line constructor.

A future improvement could be to add a passkey to the setters for
discouraged options.

Bug: None
Change-Id: I63562f43c8b290247878d194039487b240e958c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216099
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414974}
2025-02-03 09:01:41 -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
Dan McArdle
d0e7bd66eb PrivateAggregation: Delete base::Feature for 100 contributions
This CL deletes the base::Feature that increased Protected Audience
callers' default number of contributions per report from 20 to 100:
PrivateAggregationApi100ContributionsForProtectedAudience.

Fixed: 389897604
Change-Id: I50f444696207944e6b5b52cb662d793215771718
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6218025
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414066}
2025-01-31 06:08:12 -08:00
Dan McArdle
c9375d1dc1 PrivateAggregation: Add golden reports for per-context limits
Bug: 376707230
Change-Id: Iaed5dc13e73b5c0b91a958c085f567ebcbc850ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6172854
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412487}
2025-01-28 12:18:54 -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
Peter Kasting
1557e5fbe4 [cleanup] Replace base::ranges with std::ranges: content/
Done entirely with `git grep` and `sed` + `git cl format`, no
hand-editing.

Bug: 386918226
Change-Id: I8561612cb02c9d62c455836dba414ab402e40694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6199140
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412009}
2025-01-27 17:14:08 -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
Dan McArdle
4e27a344ae PrivateAggregationHost: Use CHECK_DEREF where possible
Replacing pointers that we explicitly CHECK with references/CHECK_DEREF
saves a few lines of code, and I think it's marginally clearer.

Change-Id: I00965a706cbfd4d47a75b42811321cb9b29f1187
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6169103
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1406293}
2025-01-14 12:25:38 -08:00
Dan McArdle
f05a3d8b09 PrivateAggregationHost: Simplify counting of open pipes with timeout
Currently, `pipes_with_timeout_count_` is an int, so there's a very
theoretical possibility of overflowing the int when there are MAX_INT
open pipes.

This CL skirts the issue entirely by just deleting the field. We can
achieve the same results by iterating over the contexts in the
`receiver_set_`.

Change-Id: I3b73d842c6f59ba9a4b03501503aa3962260b891
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6169078
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1406265}
2025-01-14 11:43:12 -08:00
Peter Kasting
b0e8496bf1 More std::ranges porting: content/
Bug: 386918226
Change-Id: Ia34acc40c6b7832b970f77d010ce705a28359966
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6163827
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1405614}
2025-01-13 10:46:03 -08:00
Anthony Vallée-Dubois
dd2d901c3e Assert that database tag is valid at compile time
This CL adds facilities to assert at compile-time that a database tag
passed to the `sql::Database` constructors is specified in the
DatabaseTag variant list in the corresponding `histograms.xml` file.

For many users of `Database`, this change is a no-op. That said, some
create databases with `make_unique()`, and the mechanism for forwarding arguments used by that function is incompatible with the
implicit invocation of the consteval constructor this CL introduces.
For this reason, these callers are also updated to explicitly create
the tag object.

Finally, 19 databases were using tags not defined in the histograms
file, so this CL adds these tags as variants.

Change-Id: I7aa6fdc4b923325cc41038fef72b239b5c19e4bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6055279
Reviewed-by: Robert Liao <robliao@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Reviewed-by: Steven Valdez <svaldez@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Bo Majewski <majewski@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1398280}
2024-12-18 15:25:28 -08:00
Anthony Vallée-Dubois
e3c94919c5 Make database tag mandatory
This CL removes the default value of the `tag` argument on the 2
`sql::Database` constructors, and updates all callers that didn't
explicitly pass a tag to do so.

As a convenience, this CL also defines a common tag for unit tests.

This will allow the implementation and monitoring of per-database
performance metrics (time to open, statement execution time, VMSteps,
etc) without the possibility of having some of the databases
uninstrumented. This is useful for diagnosing issues such as crbug.com/369635654 in the wild, and required for some performance investigations that we have in the pipeline.

The last step of this work item (asserting that the tag is correctly defined in histograms.xml variants) is implemented in https://chromium-review.googlesource.com/c/chromium/src/+/6055279.

Bug: 40949392
Change-Id: I6dec0fb86a5e7b98cd42ac3a9db18e23eaf9e9bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6039025
Reviewed-by: manuk hovanesian <manukh@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1395446}
2024-12-12 08:47:47 -08:00
Dan McArdle
f3377e40c2 PrivateAggregationManager: Fix parameter name comment in test
Change-Id: Ia2053e2725501fd2af6462c692e737c85a239a58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6084665
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394875}
2024-12-11 08:34:44 -08: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
Dan McArdle
a9322b9719 PrivateAggregation: Send reports on disconnect in developer mode
This CL speeds up WPTs by ignoring any remaining timeout when Private
Aggregation developer mode is enabled, i.e. when the command line flag
`--private-aggregation-developer-mode` is present. The effect is that
reports are scheduled nearly immediately after the isolated context
disconnects.

This change should make some of Private Aggregation's Shared Storage
WPTs run faster because reports will be sent with shorter delay. Note
that we will need to update the WPTs' hardcoded timeouts before we see
the full effect; some tests wait up to 6 seconds before concluding that
zero reports were received.

Here's a comparison of the individual test times (in milliseconds). This
may be a little noisy because I only ran the tests once with and once
without the changes. Unsurprisingly, only Shared Storage tests seem to
be affected.

.virtual
  .private-aggregation-developer-mode
    .wpt_internal
      .private-aggregation
        .fenced-frame-disallowed-fields.sub.https.html
          6500 -> 6518 (100.28%)
        .fenced-frame-network-revocation.sub.https.html
          5606 -> 5545 (98.91%)
        .protected-audience-aggregation-coordinator.https.window.html
          25807 -> 25651 (99.40%)
        .protected-audience-auction-report-buyers-debug-mode.https.window.html
          23236 -> 23444 (100.90%)
        .protected-audience-filtering-id-sends-report.https.window.html
          13383 -> 13975 (104.42%)
        .protected-audience-sends-report.https.window.html
          8937 -> 8946 (100.10%)
        .shared-storage-aggregation-coordinator.https.window.html
          11334 -> 11401 (100.59%)
        .shared-storage-context-id-sends-report.https.window.html
          16370 -> 1388 (8.48%)
        .shared-storage-filtering-id-sends-null-report.https.window.html
          24555 -> 24573 (100.07%)
        .shared-storage-filtering-id-sends-report.https.window.html
          42315 -> 32508 (76.82%)
        .shared-storage-sends-report.https.window.html
          5440 -> 4777 (87.81%)

Bug: 362901607
Change-Id: I8d5381e8d914cd2d43dfcd4a39feba110be3227a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6068370
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1392543}
2024-12-05 21:43:03 +00:00
Anthony Vallée-Dubois
71d7031332 Change the database tag from a setter to a ctor param
This CL should be a mostly mechanical change, replacing the calls to
`set_histogram_tag` to an argument on the 2 `sql::Database`
constructors. Nothing else should be different.

Change-Id: Ie8fd1d7a677fa66ff90c426fea9367ac4c7c469d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6037574
Reviewed-by: Carlos Knippschild <carlosk@chromium.org>
Reviewed-by: Steven Holte <holte@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: Etienne Bergeron <etienneb@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Reviewed-by: mmenke <mmenke@chromium.org>
Reviewed-by: Siddhartha S <ssid@chromium.org>
Reviewed-by: Sophie Chang <sophiechang@chromium.org>
Reviewed-by: Ben Reich <benreich@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Reviewed-by: Daniel Rubery <drubery@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Ravjit Uppal <ravjit@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391975}
2024-12-05 00:17:43 +00:00
Peter Kasting
5f6928c30b Remove usage of base::make_span(): content/browser/ part 2
Replace with span() CTAD use, or more targeted helpers.

Bug: 341907909
Change-Id: I702c8a532172bc9dfa3610cdb8c0dcf3730810c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6059285
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1389907}
2024-11-29 21:25:11 +00:00
Alex Turner
ac14fbca81 Remove kPrivateAggregationApiContributionMerging launched feature flag
This runtime enabled feature flag was enabled by default in M129. We no
longer need the kill switch and can have the feature enabled
indefinitely. This will also simplify implementation of future features.

Bug: 349980058
Change-Id: I27e7662b8ddb70d4da6529e315854a973ab0a138
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6048371
Reviewed-by: Nan Lin <linnan@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388900}
2024-11-27 17:18:53 +00:00
Alex Turner
1949b3501e Remove support for old report format in Aggregation Service layer
Now that the filtering ID features have all been removed (see
crrev.com/c/6011871, crrev.com/c/6019343 and crrev.com/c/6032178), this
is no longer a need to support the old format. This takes the form of
always requiring a filtering_id_max_bytes to be set (instead of it being
an optional type).

This should be mostly a no-op, but if there are any reports scheduled
and saved to disk from before the features were enabled (M128), they
will now be upgraded to the new format instead of still using the old
one.

Bug: 330744610
Change-Id: I2a28352a778afa2e60f81cdbe5da02183b7c2f94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6035826
Reviewed-by: Nan Lin <linnan@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387019}
2024-11-22 20:08:43 +00:00
Alex Turner
33161dc8d8 Remove PrivateAggregationFilteringIds launched RTE flag
This runtime enabled feature flag was enabled by default in M128. So, we
no longer need the kill switch and can have the feature enabled
indefinitely. See crrev.com/c/6011871 for the removal of the Aggregation
Service layer's flag.

Bug: 330744610
Change-Id: I97c9475ba78a5dc3c7278c5e93d970c431326bca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6032178
Commit-Queue: Philip Rogers <pdr@chromium.org>
Reviewed-by: Nan Lin <linnan@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: Qingxin Wu <qingxinwu@google.com>
Auto-Submit: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1385320}
2024-11-19 23:40:46 +00:00
Nan Lin
e28af4e6d6 Remove feature kPrivacySandboxAggregationServiceFilteringIds
The feature was default enabled in M126.

Change-Id: Ia073119ed40d92901e284e3ff433c3fc3a8a421c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6011871
Commit-Queue: Nan Lin <linnan@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Reviewed-by: Qingxin Wu <qingxinwu@google.com>
Cr-Commit-Position: refs/heads/main@{#1381954}
2024-11-12 20:57:48 +00:00
Dan McArdle
79bd8c3c1a Reland "PrivateAggregation: Update report determinism logic"
Patchset 1 reapplies commit fb4fec6182,
which updates report determinism logic. It was reverted because it
caused the Private Aggregation WPTs to fail.

Patchset 2 reapplies commit 9c42cb3c9a,
which updates the timeout logic for Shared Storage. This was reverted
because it would be a privacy issue to leave it in the tree without the
changed report determinism logic.

Patchsets 3 and beyond attempt to fix the original issue with the WPTs.

* The main problem is that I forgot to update a few tests that should
  now be expecting to receive null reports, e.g. because they set a
  non-default filteringIdMaxBytes and made zero viable histogram
  contributions.

* A secondary problem is that we're so close to the test-harness timeout
  of 60 seconds that adding the test with zero contributions caused
  shared-storage-filtering-id-sends-report.https.window.js to time out.
  My workaround in this CL is to partition the tests from that .js file
  into two smaller files.

Original change's description:
> PrivateAggregation: Update report determinism logic
>
> This CL aligns our Private Aggregation implementation with the spec.
>
> Non-default values of filtering_id_max_bytes are now sufficient cause to
> send null reports.
>
> This CL also adds a WPT to verify the new behavior.
>
> Bug: 375523829
> Change-Id: I495a63fb7563f7bc1c0e437e20dc9b99be5284a8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5973057
> Reviewed-by: Alex Turner <alexmt@chromium.org>
> Commit-Queue: Dan McArdle <dmcardle@chromium.org>
> Reviewed-by: Yao Xiao <yaoxia@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1376999}

Bug: 375523829
Change-Id: I62f352a73d6641db1cc3e1b90346ba94ad54cce1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5991030
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Auto-Submit: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1379134}
2024-11-06 18:46:06 +00:00
Xiaochen Zhou
09a682d5b6 Fenced frames: Rename fenced frame local unpartitioned data access to
fenced storage read.

This CL renames fenced frame local unpartitioned data access API to
fenced storage read API. It does not change any behavior except the
error messages when the API is called without attestation or without
network revoked.

This CL also renames the proto enum for this API. It is safe to do so
because there has been no attestation list containing this API shipped.

Bug: 375607722
Change-Id: Iab24e4226fc698ff5b3c1afa6ad5f4da464914ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5966637
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Shivani Sharma <shivanisha@chromium.org>
Reviewed-by: Fiona Macintosh <fmacintosh@google.com>
Reviewed-by: David Vallet <dvallet@chromium.org>
Commit-Queue: Xiaochen Zhou <xiaochenzh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1378084}
2024-11-05 02:46:15 +00:00
Dan McArdle
22c4c62d5c Revert "PrivateAggregation: Update timeout logic for Shared Storage"
This reverts commit 9c42cb3c9a.

Reason for revert: This CL shouldn't be merged without its sibling for privacy reasons, but its sibling was reverted in https://crrev.com/c/chromium/src/+/5985354

Original change's description:
> PrivateAggregation: Update timeout logic for Shared Storage
>
> This CL aligns Shared Storage with the Private Aggregation spec. It will
> now set a timeout when `filtering_id_max_bytes` is a non-default value.
>
> Bug: 375523829
> Change-Id: I24f2d489ade2c86a99e9d759c778b51ddfb42c1c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5967193
> Reviewed-by: Alex Turner <alexmt@chromium.org>
> Commit-Queue: Dan McArdle <dmcardle@chromium.org>
> Reviewed-by: Yao Xiao <yaoxia@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1376990}

Bug: 375523829
Change-Id: I4f3b695b891cf4a2944c2df7d83fb908135170fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5985370
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Angela Yoeurng <yoangela@chromium.org>
Commit-Queue: Angela Yoeurng <yoangela@chromium.org>
Owners-Override: Angela Yoeurng <yoangela@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1377099}
2024-11-01 21:33:45 +00:00
Angela Yoeurng
2052a7395f Revert "PrivateAggregation: Update report determinism logic"
This reverts commit fb4fec6182.

Reason for revert: Likely culprit for build failures 
e.g. https://ci.chromium.org/ui/p/chromium/builders/ci/linux-bfcache-rel/65919/overview
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/149699/overview

Original change's description:
> PrivateAggregation: Update report determinism logic
>
> This CL aligns our Private Aggregation implementation with the spec.
>
> Non-default values of filtering_id_max_bytes are now sufficient cause to
> send null reports.
>
> This CL also adds a WPT to verify the new behavior.
>
> Bug: 375523829
> Change-Id: I495a63fb7563f7bc1c0e437e20dc9b99be5284a8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5973057
> Reviewed-by: Alex Turner <alexmt@chromium.org>
> Commit-Queue: Dan McArdle <dmcardle@chromium.org>
> Reviewed-by: Yao Xiao <yaoxia@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1376999}

Bug: 375523829
Change-Id: I1bf3aa2d1a920f49f3f16b51bf4dfa9d940a662c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5985354
Auto-Submit: Angela Yoeurng <yoangela@chromium.org>
Commit-Queue: Angela Yoeurng <yoangela@chromium.org>
Owners-Override: Angela Yoeurng <yoangela@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1377085}
2024-11-01 21:13:53 +00:00
Dan McArdle
fb4fec6182 PrivateAggregation: Update report determinism logic
This CL aligns our Private Aggregation implementation with the spec.

Non-default values of filtering_id_max_bytes are now sufficient cause to
send null reports.

This CL also adds a WPT to verify the new behavior.

Bug: 375523829
Change-Id: I495a63fb7563f7bc1c0e437e20dc9b99be5284a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5973057
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1376999}
2024-11-01 18:35:10 +00:00
Dan McArdle
5274375911 PrivateAggregation: Rename BudgetDeniedBehavior to NullReportBehavior
This is a behavior-preserving refactor that moves and renames
PrivateAggregationBudgeter::BudgetDeniedBehavior to
PrivateAggregationHost::NullReportBehavior.

Bug: 375523829
Change-Id: I70e9f27a29e70be5ac22d160d3120902ddc30223
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5973157
Reviewed-by: Paul Jensen <pauljensen@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1376998}
2024-11-01 18:34:19 +00:00
Dan McArdle
9c42cb3c9a PrivateAggregation: Update timeout logic for Shared Storage
This CL aligns Shared Storage with the Private Aggregation spec. It will
now set a timeout when `filtering_id_max_bytes` is a non-default value.

Bug: 375523829
Change-Id: I24f2d489ade2c86a99e9d759c778b51ddfb42c1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5967193
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1376990}
2024-11-01 18:22:35 +00:00
Xiaochen Zhou
e653034d14 [Privacy Sandbox] Chrome client layer implementation of local
unpartitioned data access attestation check.

Implement the browser client layer check of the new attestation API.
Apply this check for shared storage get.

Browser tests for testing shared storage get with respect to the new
attestation check is added in:
chrome/browser/storage/shared_storage_browsertest.cc.

Update other existing tests to work with this check.

Please note other than the attestation, the local unpartitioned data
access is also gated on 3pc setting. See crrev.com/c/5860019.

Bug: 361375807
Change-Id: I338bb9fa756b9e2b793f3bf4a491281cd41409f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5854085
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Xiaochen Zhou <xiaochenzh@chromium.org>
Reviewed-by: Shivani Sharma <shivanisha@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1370560}
2024-10-18 14:14:03 +00:00
Helmut Januschka
a3cf92a41d use std::optional base::GetFileSize() in //content
Bug: 371234479
Change-Id: Ic324561e0c6fd20d85e5895fb45c89ca5866876a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5905147
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1370248}
2024-10-17 21:09:58 +00:00
Dan McArdle
48ce97f9e0 PrivateAggregation: Enable 100 contributions for Protected Audience
This CL enables the preexisting feature by default:
PrivateAggregationApiDynamicMaxContributionsPerCallingApi

It also updates WPT expectations for Private Aggregation's tests that
cover Protected Audience callers.

Bug: 360160864
Change-Id: I2f67f8cdbcc2932aac18c0a150c7c654c742a928
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5812290
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368287}
2024-10-14 16:26:23 +00:00
Dan McArdle
3815da7c30 PrivateAggregation: Remove stale TODO about flushing writes
Bug: 40226452
Change-Id: Ib4b175eba17898500b7856092a613a85b77323c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5900535
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1362023}
2024-09-30 21:29:18 +00:00
Xiaochen Zhou
825ad74abd Fenced frames: Remove FencedFramesReportingAttestationsChanges flag
and feature.

This feature is obsolete and has never been enabled. It was added in
https://chromium-review.googlesource.com/c/chromium/src/+/4949771.
It is a temporary solution for an issue in post-impression beacon.

The problem is when an adtech needs to measure Protected Audience ads
via post-impression beacon, but is not using any of the ads personalization or targeting features of Protected Audiences. A
different approach was taken. This feature was implemented but never planned to ship.

Bug: 361119170
Change-Id: Ife04241f0e3a69fe36ad18236b29beb2617af8f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5867036
Commit-Queue: Xiaochen Zhou <xiaochenzh@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Liam Brady <lbrady@google.com>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1359962}
2024-09-25 15:38:01 +00:00
Dan McArdle
cf24da08a2 PrivateAggregation: Rename Api enum to PrivateAggregationCallerApi
This CL creates a new header file to house PrivateAggregationCallerApi,
an enum that identifies which API is calling Private Aggregation.

The enum used to be PrivateAggregationBudgetKey::Api, but now we're
using it for things that aren't related to budgeting.

Fixed: 362431899
Change-Id: Ia0e7fbe9f19119557dc4e6bb7406206bde9cfc36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5823744
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Auto-Submit: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1350232}
2024-09-03 17:28:49 +00:00
Arthur Sonzogni
0a5d54489f Spanify: content/ (c-array conversions only)
Addresses ~14% of `-WUnsafe-buffer-usage` opt-out in `//content`.
This is a #cleanup.

The patch was initially partially generated by `./tool/clang/spanify`.

This patch applies conversions specifically to c-arrays in `//content`.
Although the `spanify` tool supports broader conversions, this change
intentionally focuses on c-arrays. Several manual fixes were made to
address anonymous struct issues and other edge cases encountered during
the conversion process.

Bug: 342213636, 40285824
Change-Id: I72666faa45a461ea27bb3608beeacc6c9fcd8a63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5824992
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1349804}
2024-09-02 11:23:35 +00:00
Dan McArdle
cc5ab8177c PrivateAggregation: Use extreme keys for goldens 5 and 6
Golden reports 5 and 6 were duplicates of 1 and 2. They were supposed to
use a bucket of (2^128 - 1), but accidentally used 1.

Fixed: 362901603
Change-Id: I57aae181ac13f4de72102bc2e60da84cd39e7746
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5825399
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1348844}
2024-08-29 20:04:07 +00:00
Dan McArdle
0b79970a9b PrivateAggregation: Add Protected Audience goldens w/ 100 contributions
Bug: 362462215
Change-Id: Ic5cb1f9d1cba1d3b8c0d9a6b42caf0a56128256a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5823551
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1348667}
2024-08-29 16:03:01 +00:00
Dan McArdle
87d3263768 PrivateAggregation: Extract contribution limit logic to public function
This will make it easier to match the browser's actual behavior in the
golden tests.

Bug: 362462215
Change-Id: I4025ac567fad348ddd02ebc91f329176447784eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5823550
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1348666}
2024-08-29 16:02:44 +00:00
Dan McArdle
17f903cdbf PrivateAggregationBudgetStorage: Add histogram for db file size
This CL adds a new histogram that records the size on disk of the
database created by PrivateAggregationBudgetStorage. The histogram's
name is "PrivacySandbox.PrivateAggregation.BudgetStorage.DbSize".

Bug: 358138965
Change-Id: Ie208dade1c26a7bee8ffe06ad46f5eb72b03da67
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5798861
Auto-Submit: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Commit-Queue: Ben Kelly <wanderview@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1348649}
2024-08-29 15:18:24 +00:00
Dan McArdle
40c27fdf4c PrivateAggregation: Implement 100 contributions for Protected Audience
This CL implements the logic for limiting Protected Audience callers to
100 contributions per report. Shared Storage callers are not affected.

The new behavior is gated behind a feature flag that is disabled by
default.

* Explainer change:
  https://github.com/patcg-individual-drafts/private-aggregation-api/pull/138

* Spec change:
  https://github.com/patcg-individual-drafts/private-aggregation-api/pull/150

Bug: 360160864
Change-Id: I14cd4087986a8ecb70e60701d56fac6d25135a53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5743397
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1347486}
2024-08-27 17:55:36 +00:00
Dan McArdle
5b1284becb content/browser/private_aggregation: Fix typoed arg comments
This CL fixes typoes of the form /*arg-*/ that should have been /*arg=*/
under the assumption that they were trying to name an argument.

This CL was uploaded by git cl split.

R=alexmt@chromium.org

Bug: 362092187
Change-Id: I926951805e50df94b39428798b572a192eca0ef4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5813182
Auto-Submit: Dan McArdle <dmcardle@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1346734}
2024-08-26 15:09:20 +00:00
Avi Drissman
78865bbb3d Don't use int for bindings
Switch to a modern type, EnumSet.

Fixed: 361106055
Change-Id: Iae1e8a0e43f73ba746573e49c26916f6ac09d2ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5801311
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
Reviewed-by: Vigen Issahhanjan <vigeni@google.com>
Reviewed-by: James Maclean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1345641}
2024-08-22 20:57:19 +00:00
Alex Turner
0e81a648c4 Enable client-side contribution merging for Private Aggregation
Bug: 349980058
Change-Id: I55c38e81b32da8c58a622fdfbbc25126c793efd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5769592
Reviewed-by: Alex Turner <alexmt@chromium.org>
Reviewed-by: Dan McArdle <dmcardle@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1343082}
2024-08-16 22:47:07 +00:00
Peter Boström
01ab59ae08 Migrate NOTREACHED_NORETURN -> NOTREACHED
NOTREACHED() has turned [[noreturn]] so the former macro isn't needed
anymore.

This does not attempt to do a rewrite of any surrounding code, like:

if (!foo) {
  NOTREACHED();
}

to CHECK(foo);

Those transforms take a non-trivial amount of time (and there are
thousands of instances). Cleanup can be left as an exercise for the
reader.

NO_IFTTT=No-op-rename migration.

Bug: 40580068
Change-Id: I068c5fdce9dc4c352d8bdd62bb3cd2c0a2d59659
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5782602
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1342096}
2024-08-15 02:39:49 +00:00