#include "third_party/blink/renderer/core/paint/timing/largest_contentful_paint_calculator.h"
#include "base/check.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/html/loading_attribute.h"
#include "third_party/blink/renderer/core/inspector/identifiers_factory.h"
#include "third_party/blink/renderer/core/paint/timing/image_element_timing.h"
#include "third_party/blink/renderer/core/paint/timing/image_paint_timing_detector.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing.h"
#include "third_party/blink/renderer/core/paint/timing/text_paint_timing_detector.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink {
namespace {
constexpr const char kTraceCategories[] = …;
constexpr const char kLCPCandidate[] = …;
}
LargestContentfulPaintType GetLargestContentfulPaintTypeFromString(
const AtomicString& type_string) { … }
LargestContentfulPaintCalculator::LargestContentfulPaintCalculator(
WindowPerformance* window_performance)
: … { … }
void LargestContentfulPaintCalculator::
UpdateWebExposedLargestContentfulPaintIfNeeded(
const TextRecord* largest_text,
const ImageRecord* largest_image,
bool is_triggered_by_soft_navigation) { … }
void LargestContentfulPaintCalculator::UpdateWebExposedLargestContentfulImage(
const ImageRecord* largest_image,
bool is_triggered_by_soft_navigation) { … }
void LargestContentfulPaintCalculator::UpdateWebExposedLargestContentfulText(
const TextRecord& largest_text,
bool is_triggered_by_soft_navigation) { … }
bool LargestContentfulPaintCalculator::HasLargestImagePaintChangedForMetrics(
base::TimeTicks largest_image_paint_time,
uint64_t largest_image_paint_size) const { … }
bool LargestContentfulPaintCalculator::HasLargestTextPaintChangedForMetrics(
base::TimeTicks largest_text_paint_time,
uint64_t largest_text_paint_size) const { … }
bool LargestContentfulPaintCalculator::NotifyMetricsIfLargestImagePaintChanged(
base::TimeTicks image_paint_time,
uint64_t image_paint_size,
ImageRecord* image_record,
double image_bpp,
std::optional<WebURLRequest::Priority> priority) { … }
bool LargestContentfulPaintCalculator::NotifyMetricsIfLargestTextPaintChanged(
base::TimeTicks text_paint_time,
uint64_t text_paint_size) { … }
void LargestContentfulPaintCalculator::UpdateLatestLcpDetails() { … }
void LargestContentfulPaintCalculator::Trace(Visitor* visitor) const { … }
std::unique_ptr<TracedValue>
LargestContentfulPaintCalculator::TextCandidateTraceData(
const TextRecord& largest_text,
bool is_triggered_by_soft_navigation) { … }
std::unique_ptr<TracedValue>
LargestContentfulPaintCalculator::ImageCandidateTraceData(
const ImageRecord* largest_image,
bool is_triggered_by_soft_navigation,
Element* image_element) { … }
}