#include "third_party/blink/renderer/core/paint/timing/image_paint_timing_detector.h"
#include "base/feature_list.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/layout/layout_image_resource.h"
#include "third_party/blink/renderer/core/layout/svg/layout_svg_image.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/timing/image_element_timing.h"
#include "third_party/blink/renderer/core/paint/timing/largest_contentful_paint_calculator.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing_detector.h"
#include "third_party/blink/renderer/core/style/style_fetched_image.h"
#include "third_party/blink/renderer/core/timing/soft_navigation_heuristics.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/traced_value.h"
namespace blink {
namespace {
uint64_t DownScaleIfIntrinsicSizeIsSmaller(
uint64_t visual_size,
const uint64_t& intrinsic_image_size,
const uint64_t& displayed_image_size) { … }
void RecordPotentialSoftNavigationPaint(LocalFrameView* frame_view,
gfx::RectF rect,
Node* node) { … }
}
double ImageRecord::EntropyForLCP() const { … }
std::optional<WebURLRequest::Priority> ImageRecord::RequestPriority() const { … }
void ImageRecord::Trace(Visitor* visitor) const { … }
ImagePaintTimingDetector::ImagePaintTimingDetector(
LocalFrameView* frame_view,
PaintTimingCallbackManager* callback_manager)
: … { … }
ImageRecord* ImageRecordsManager::LargestImage() const { … }
void ImagePaintTimingDetector::PopulateTraceValue(
TracedValue& value,
const ImageRecord& first_image_paint) { … }
void ImagePaintTimingDetector::ReportCandidateToTrace(
ImageRecord& largest_image_record,
base::TimeTicks time) { … }
void ImagePaintTimingDetector::ReportNoCandidateToTrace() { … }
std::pair<ImageRecord*, bool>
ImagePaintTimingDetector::UpdateMetricsCandidate() { … }
void ImagePaintTimingDetector::OnPaintFinished() { … }
void ImagePaintTimingDetector::NotifyImageRemoved(
const LayoutObject& object,
const MediaTiming* media_timing) { … }
void ImagePaintTimingDetector::StopRecordEntries() { … }
void ImagePaintTimingDetector::RegisterNotifyPresentationTime() { … }
void ImagePaintTimingDetector::ReportPresentationTime(
unsigned last_queued_frame_index,
base::TimeTicks timestamp) { … }
void ImageRecordsManager::AssignPaintTimeToRegisteredQueuedRecords(
const base::TimeTicks& timestamp,
unsigned last_queued_frame_index) { … }
bool ImagePaintTimingDetector::RecordImage(
const LayoutObject& object,
const gfx::Size& intrinsic_size,
const MediaTiming& media_timing,
const PropertyTreeStateOrAlias& current_paint_chunk_properties,
const StyleImage* style_image,
const gfx::Rect& image_border) { … }
uint64_t ImagePaintTimingDetector::ComputeImageRectSize(
const gfx::Rect& image_border,
const gfx::RectF& mapped_visual_rect,
const gfx::Size& intrinsic_size,
const PropertyTreeStateOrAlias& current_paint_chunk_properties,
const LayoutObject& object,
const MediaTiming& media_timing) { … }
void ImagePaintTimingDetector::NotifyImageFinished(
const LayoutObject& object,
const MediaTiming* media_timing) { … }
void ImagePaintTimingDetector::ReportLargestIgnoredImage() { … }
ImageRecordsManager::ImageRecordsManager(LocalFrameView* frame_view)
: … { … }
bool ImageRecordsManager::OnFirstAnimatedFramePainted(
MediaRecordIdHash record_id_hash,
unsigned current_frame_index) { … }
void ImageRecordsManager::OnImageLoaded(MediaRecordIdHash record_id_hash,
unsigned current_frame_index,
const StyleImage* style_image) { … }
void ImageRecordsManager::ReportLargestIgnoredImage(
unsigned current_frame_index) { … }
void ImageRecordsManager::OnImageLoadedInternal(ImageRecord* record,
unsigned current_frame_index) { … }
void ImageRecordsManager::MaybeUpdateLargestIgnoredImage(
const MediaRecordId& record_id,
const uint64_t& visual_size,
const gfx::Rect& frame_visual_rect,
const gfx::RectF& root_visual_rect) { … }
bool ImageRecordsManager::RecordFirstPaintAndReturnIsPending(
const MediaRecordId& record_id,
const uint64_t& visual_size,
const gfx::Rect& frame_visual_rect,
const gfx::RectF& root_visual_rect,
double bpp) { … }
void ImageRecordsManager::AddPendingImage(ImageRecord* record) { … }
ImageRecord* ImageRecordsManager::CreateImageRecord(
const LayoutObject& object,
const MediaTiming* media_timing,
const uint64_t& visual_size,
const gfx::Rect& frame_visual_rect,
const gfx::RectF& root_visual_rect,
MediaRecordIdHash hash) { … }
void ImageRecordsManager::ClearImagesQueuedForPaintTime() { … }
void ImageRecordsManager::Clear() { … }
void ImageRecordsManager::Trace(Visitor* visitor) const { … }
void ImagePaintTimingDetector::Trace(Visitor* visitor) const { … }
}