summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/html/lazy_load_image_observer.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 16:23:34 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:37:21 +0000
commit38a9a29f4f9436cace7f0e7abf9c586057df8a4e (patch)
treec4e8c458dc595bc0ddb435708fa2229edfd00bd4 /chromium/third_party/blink/renderer/core/html/lazy_load_image_observer.cc
parente684a3455bcc29a6e3e66a004e352dea4e1141e7 (diff)
downloadqtwebengine-chromium-38a9a29f4f9436cace7f0e7abf9c586057df8a4e.tar.gz
BASELINE: Update Chromium to 73.0.3683.37
Change-Id: I08c9af2948b645f671e5d933aca1f7a90ea372f2 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/lazy_load_image_observer.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/html/lazy_load_image_observer.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/lazy_load_image_observer.cc b/chromium/third_party/blink/renderer/core/html/lazy_load_image_observer.cc
index 9ebbcba427a..2f10b829b71 100644
--- a/chromium/third_party/blink/renderer/core/html/lazy_load_image_observer.cc
+++ b/chromium/third_party/blink/renderer/core/html/lazy_load_image_observer.cc
@@ -245,6 +245,35 @@ void LazyLoadImageObserver::OnVisibilityChanged(
if (entry->isIntersecting()) {
DCHECK(visible_load_time_metrics.time_when_first_visible.is_null());
visible_load_time_metrics.time_when_first_visible = CurrentTimeTicks();
+
+ if (visible_load_time_metrics.record_visibility_metrics &&
+ image_element->GetDocument().GetFrame()) {
+ // Since the visibility metrics are recorded when the image finishes
+ // loading, this means that the image became visible before it
+ // finished loading.
+
+ // Note: If the WebEffectiveConnectionType enum ever gets out of sync
+ // with net::EffectiveConnectionType, then both the AboveTheFold and
+ // BelowTheFold histograms here will have to be updated to record the
+ // sample in terms of net::EffectiveConnectionType instead of
+ // WebEffectiveConnectionType.
+ if (visible_load_time_metrics.is_initially_intersecting) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Blink.VisibleBeforeLoaded.LazyLoadImages.AboveTheFold",
+ image_element->GetDocument()
+ .GetFrame()
+ ->Client()
+ ->GetEffectiveConnectionType());
+ } else {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Blink.VisibleBeforeLoaded.LazyLoadImages.BelowTheFold",
+ image_element->GetDocument()
+ .GetFrame()
+ ->Client()
+ ->GetEffectiveConnectionType());
+ }
+ }
+
visibility_metrics_observer_->unobserve(image_element);
}
}