#include "third_party/blink/renderer/core/loader/resource/image_resource_content.h"
#include <memory>
#include "base/auto_reset.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/time/time.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/loader/resource/image_resource.h"
#include "third_party/blink/renderer/core/loader/resource/image_resource_info.h"
#include "third_party/blink/renderer/core/loader/resource/image_resource_observer.h"
#include "third_party/blink/renderer/core/svg/graphics/svg_image.h"
#include "third_party/blink/renderer/platform/graphics/bitmap_image.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_load_timing.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
#include "third_party/blink/renderer/platform/network/http_parsers.h"
#include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "ui/gfx/geometry/size.h"
#include "v8/include/v8.h"
namespace blink {
namespace {
class NullImageResourceInfo final
: public GarbageCollected<NullImageResourceInfo>,
public ImageResourceInfo { … };
}
ImageResourceContent::ImageResourceContent(scoped_refptr<blink::Image> image)
: … { … }
ImageResourceContent* ImageResourceContent::CreateLoaded(
scoped_refptr<blink::Image> image) { … }
ImageResourceContent* ImageResourceContent::Fetch(FetchParameters& params,
ResourceFetcher* fetcher) { … }
void ImageResourceContent::SetImageResourceInfo(ImageResourceInfo* info) { … }
void ImageResourceContent::Trace(Visitor* visitor) const { … }
void ImageResourceContent::HandleObserverFinished(
ImageResourceObserver* observer) { … }
void ImageResourceContent::AddObserver(ImageResourceObserver* observer) { … }
void ImageResourceContent::RemoveObserver(ImageResourceObserver* observer) { … }
void ImageResourceContent::DidRemoveObserver() { … }
static void PriorityFromObserver(
const ImageResourceObserver* observer,
ResourcePriority& priority,
ResourcePriority& priority_excluding_image_loader) { … }
std::pair<ResourcePriority, ResourcePriority>
ImageResourceContent::PriorityFromObservers() const { … }
std::optional<WebURLRequest::Priority> ImageResourceContent::RequestPriority()
const { … }
void ImageResourceContent::DestroyDecodedData() { … }
void ImageResourceContent::DoResetAnimation() { … }
scoped_refptr<const SharedBuffer> ImageResourceContent::ResourceBuffer() const { … }
bool ImageResourceContent::ShouldUpdateImageImmediately() const { … }
blink::Image* ImageResourceContent::GetImage() const { … }
gfx::Size ImageResourceContent::IntrinsicSize(
RespectImageOrientationEnum should_respect_image_orientation) const { … }
RespectImageOrientationEnum ImageResourceContent::ForceOrientationIfNecessary(
RespectImageOrientationEnum default_orientation) const { … }
void ImageResourceContent::NotifyObservers(
NotifyFinishOption notifying_finish_option,
CanDeferInvalidation defer) { … }
scoped_refptr<Image> ImageResourceContent::CreateImage(bool is_multipart) { … }
void ImageResourceContent::ClearImage() { … }
void ImageResourceContent::UpdateToLoadedContentStatus(
ResourceStatus new_status) { … }
void ImageResourceContent::NotifyStartLoad() { … }
void ImageResourceContent::AsyncLoadCompleted(const blink::Image* image) { … }
ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage(
scoped_refptr<SharedBuffer> data,
ResourceStatus status,
UpdateImageOption update_image_option,
bool all_data_received,
bool is_multipart) { … }
ImageDecoder::CompressionFormat ImageResourceContent::GetCompressionFormat()
const { … }
uint64_t ImageResourceContent::ContentSizeForEntropy() const { … }
void ImageResourceContent::DecodedSizeChangedTo(const blink::Image* image,
size_t new_size) { … }
bool ImageResourceContent::ShouldPauseAnimation(const blink::Image* image) { … }
void ImageResourceContent::UpdateImageAnimationPolicy() { … }
void ImageResourceContent::Changed(const blink::Image* image) { … }
bool ImageResourceContent::IsAccessAllowed() const { … }
void ImageResourceContent::EmulateLoadStartedForInspector(
ResourceFetcher* fetcher,
const AtomicString& initiator_name) { … }
void ImageResourceContent::SetIsSufficientContentLoadedForPaint() { … }
bool ImageResourceContent::IsSufficientContentLoadedForPaint() const { … }
bool ImageResourceContent::IsLoaded() const { … }
bool ImageResourceContent::IsLoading() const { … }
bool ImageResourceContent::ErrorOccurred() const { … }
bool ImageResourceContent::LoadFailedOrCanceled() const { … }
ResourceStatus ImageResourceContent::GetContentStatus() const { … }
bool ImageResourceContent::IsAnimatedImage() const { … }
bool ImageResourceContent::IsPaintedFirstFrame() const { … }
bool ImageResourceContent::TimingAllowPassed() const { … }
const KURL& ImageResourceContent::Url() const { … }
bool ImageResourceContent::IsDataUrl() const { … }
AtomicString ImageResourceContent::MediaType() const { … }
void ImageResourceContent::SetIsBroken() { … }
bool ImageResourceContent::IsBroken() const { … }
base::TimeTicks ImageResourceContent::DiscoveryTime() const { … }
base::TimeTicks ImageResourceContent::LoadStart() const { … }
base::TimeTicks ImageResourceContent::LoadEnd() const { … }
base::TimeTicks ImageResourceContent::LoadResponseEnd() const { … }
bool ImageResourceContent::HasCacheControlNoStoreHeader() const { … }
float ImageResourceContent::DevicePixelRatioHeaderValue() const { … }
bool ImageResourceContent::HasDevicePixelRatioHeaderValue() const { … }
const ResourceResponse& ImageResourceContent::GetResponse() const { … }
std::optional<ResourceError> ImageResourceContent::GetResourceError() const { … }
bool ImageResourceContent::IsCacheValidator() const { … }
void ImageResourceContent::LoadDeferredImage(ResourceFetcher* fetcher) { … }
bool ImageResourceContent::IsAdResource() const { … }
void ImageResourceContent::RecordDecodedImageType(UseCounter* use_counter) { … }
}