| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks for the refactor in prep for https://crrev.com/c/8053444. I'll add further comments about consuming the new helper in that CL.
// If `key_ahead_of_prerender` and `collect_result_ahead_of_prerender` arenit: should this be removed now that the logic has moved?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// If `key_ahead_of_prerender` and `collect_result_ahead_of_prerender` arenit: should this be removed now that the logic has moved?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Overall LGTM, sorry for the delay
`CollectMatchCandidatesGeneric` to `void`. Callers now retrieve matchedsuper nit: exceeds 72 chars?
- Remove `key_ahead_of_prerender` and `collect_result_ahead_of_prerender`ditto
// Debug: Fill `PrefetchPotentialCandidateCollectResult` if the navigationnit: ditto above, can we retain this comment?
if (is_available) {
candidates_available.push_back(candidate);
servable_states.emplace(candidate->key(), servable_state);
}Code reading note:
So these are moved to `PrefetchCandidateCollectHelper`'s `GetMatchedCandidates()` and `GetServableStates()` respectively, by checking
`PrefetchPotentialCandidateCollectResult::kAvailable`?
// Debug: Fill `kUnavailablePrefetchIsNotInPrefetchService` if prefetch ahead
// of prerender is not in `candidates`.nit: can we retain this comment?
// `PrefetchMatchResolver::FindInternal2()`. `PrefechContainer`'s dtor isnit: `FindInternal2` -> `FindPrefetchInternal2`, and `PrefechContainer` -> `PrefetchContainer`
// Safety: `CollectDetails`'s lifitime is bounded bynit: `lifitime` -> `lifetime`
// Returns candidate `PrefetchContainer`s and servable states for matchingCode reading note: this will be updated in the next CL
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
`CollectMatchCandidatesGeneric` to `void`. Callers now retrieve matchedsuper nit: exceeds 72 chars?
Done
- Remove `key_ahead_of_prerender` and `collect_result_ahead_of_prerender`Ken Okadaditto
Done
// Debug: Fill `PrefetchPotentialCandidateCollectResult` if the navigationnit: ditto above, can we retain this comment?
Done
if (is_available) {
candidates_available.push_back(candidate);
servable_states.emplace(candidate->key(), servable_state);
}Code reading note:
So these are moved to `PrefetchCandidateCollectHelper`'s `GetMatchedCandidates()` and `GetServableStates()` respectively, by checking
`PrefetchPotentialCandidateCollectResult::kAvailable`?
Yes.
// Debug: Fill `kUnavailablePrefetchIsNotInPrefetchService` if prefetch ahead
// of prerender is not in `candidates`.nit: can we retain this comment?
Done
// `PrefetchMatchResolver::FindInternal2()`. `PrefechContainer`'s dtor isnit: `FindInternal2` -> `FindPrefetchInternal2`, and `PrefechContainer` -> `PrefetchContainer`
Thanks!
// Safety: `CollectDetails`'s lifitime is bounded by| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
16 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: content/browser/preloading/prefetch/prefetch_match_resolver.h
Insertions: 3, Deletions: 3.
@@ -361,9 +361,9 @@
class PrefetchCandidateCollectHelper {
public:
struct CollectDetails {
- // Safety: `CollectDetails`'s lifitime is bounded by
- // `PrefetchMatchResolver::FindInternal2()`. `PrefechContainer`'s dtor is
- // not called in it.
+ // Safety: `CollectDetails`'s lifetime is bounded by
+ // `PrefetchMatchResolver::FindPrefetchInternal2()`. `PrefetchContainer`'s
+ // dtor is not called in it.
raw_ptr<T> candidate;
PrefetchServableState servable_state;
PrefetchPotentialCandidateCollectResult collect_result;
```
```
The name of the file: content/browser/preloading/prefetch/prefetch_match_resolver.cc
Insertions: 4, Deletions: 0.
@@ -302,6 +302,8 @@
servable_states = helper.GetServableStates();
+ // Debug: Fill `PrefetchPotentialCandidateCollectResult` if the navigation
+ // is prerender and has prefetch ahead of prerender.
if (prefetch_container_ahead_of_prerender) {
[&]() {
for (const auto& details : helper.GetCandidates()) {
@@ -312,6 +314,8 @@
return;
}
}
+ // Defaults to `kUnavailablePrefetchIsNotInPrefetchService` if prefetch
+ // ahead of prerender is not in the candidates.
collect_result_ahead_of_prerender_for_metrics_ =
PrefetchPotentialCandidateCollectResult::
kUnavailablePrefetchIsNotInPrefetchService;
```
Prefetch: Add helper to collect prefetch candidate details
This is a preparation of https://crrev.com/c/8053444.
Refactoring. No behavioral change.
This CL introduces `PrefetchCandidateCollectHelper` template class to
collect details of candidate prefetch containers during the candidate
collection phase of prefetch matching. Key changes:
- Pass `PrefetchCandidateCollectHelper` to `CollectMatchCandidates` to
record candidate details (e.g. `PrefetchServableState` and
`PrefetchPotentialCandidateCollectResult`).
- Change the return type of `CollectMatchCandidates` and
`CollectMatchCandidatesGeneric` to `void`. Callers now retrieve
matched candidates and servable states directly from the helper.
- Refactor `IsCandidateAvailable` into `JudgeCandidateCollectResult`,
which returns `PrefetchPotentialCandidateCollectResult` directly
instead of mutating an out-parameter.
- Remove `key_ahead_of_prerender` and
`collect_result_ahead_of_prerender` parameters from
`CollectMatchCandidates`, handling the check on the caller side
using the helper.
- Store `raw_ptr<T>` in `CollectDetails` with lifetime safety
comments, passing `CollectDetails` by value and moving it into the
helper.
TAG=agy
CONV=69517bc6-16b1-4b64-a5c3-ee901b49e323
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |