summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc50
1 files changed, 36 insertions, 14 deletions
diff --git a/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc b/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc
index eebd60c431d..9d85096e384 100644
--- a/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc
+++ b/chromium/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc
@@ -62,31 +62,53 @@ void IntersectionObserverController::DeliverNotifications(
bool IntersectionObserverController::ComputeIntersections(
unsigned flags,
- LocalFrameUkmAggregator& ukm_aggregator) {
+ LocalFrameUkmAggregator& ukm_aggregator,
+ absl::optional<base::TimeTicks>& monotonic_time) {
needs_occlusion_tracking_ = false;
- if (GetExecutionContext()) {
- TRACE_EVENT0("blink,devtools.timeline",
- "IntersectionObserverController::"
- "computeIntersections");
- HeapVector<Member<IntersectionObserver>> observers_to_process;
- CopyToVector(tracked_explicit_root_observers_, observers_to_process);
+ if (!GetExecutionContext())
+ return false;
+ TRACE_EVENT0("blink,devtools.timeline",
+ "IntersectionObserverController::"
+ "computeIntersections");
+ HeapVector<Member<IntersectionObserver>> observers_to_process;
+ CopyToVector(tracked_explicit_root_observers_, observers_to_process);
+ HeapVector<Member<IntersectionObservation>> observations_to_process;
+ CopyToVector(tracked_implicit_root_observations_, observations_to_process);
+ int64_t internal_observation_count = 0;
+ int64_t javascript_observation_count = 0;
+ {
+ LocalFrameUkmAggregator::IterativeTimer ukm_timer(ukm_aggregator);
for (auto& observer : observers_to_process) {
if (observer->HasObservations()) {
- SCOPED_UMA_AND_UKM_TIMER(ukm_aggregator, observer->GetUkmMetricId());
- needs_occlusion_tracking_ |= observer->ComputeIntersections(flags);
+ ukm_timer.StartInterval(observer->GetUkmMetricId());
+ int64_t count = observer->ComputeIntersections(flags, monotonic_time);
+ if (observer->IsInternal())
+ internal_observation_count += count;
+ else
+ javascript_observation_count += count;
+ needs_occlusion_tracking_ |= observer->trackVisibility();
} else {
tracked_explicit_root_observers_.erase(observer);
}
}
- HeapVector<Member<IntersectionObservation>> observations_to_process;
- CopyToVector(tracked_implicit_root_observations_, observations_to_process);
for (auto& observation : observations_to_process) {
- SCOPED_UMA_AND_UKM_TIMER(ukm_aggregator,
- observation->Observer()->GetUkmMetricId());
- observation->ComputeIntersection(flags);
+ ukm_timer.StartInterval(observation->Observer()->GetUkmMetricId());
+ int64_t count = observation->ComputeIntersection(flags, monotonic_time);
+ if (observation->Observer()->IsInternal())
+ internal_observation_count += count;
+ else
+ javascript_observation_count += count;
needs_occlusion_tracking_ |= observation->Observer()->trackVisibility();
}
}
+
+ ukm_aggregator.RecordCountSample(
+ LocalFrameUkmAggregator::kIntersectionObservationInternalCount,
+ internal_observation_count);
+ ukm_aggregator.RecordCountSample(
+ LocalFrameUkmAggregator::kIntersectionObservationJavascriptCount,
+ javascript_observation_count);
+
return needs_occlusion_tracking_;
}