Title: [275570] trunk/Source/WebCore
Revision
275570
Author
[email protected]
Date
2021-04-06 16:36:25 -0700 (Tue, 06 Apr 2021)

Log Message

Replace the Optional metadata of ImageSource by a single OptionSet and the underlying metadata
https://bugs.webkit.org/show_bug.cgi?id=224202

Reviewed by Simon Fraser.

Encapsulating the metadata in a Optionals adds extra memory cost. Replace
these Optionals by the underlying metadata and an OptionSet to tell which
ones are cached.

* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::ImageSource):
(WebCore::ImageSource::frameAtIndexCacheIfNeeded):
Instead of assertion index < m_frames.size(), we can return defaultFrame().
This will used in many callers which checks the size before calling it.

(WebCore::ImageSource::clearMetadata):

(WebCore::ImageSource::metadataCacheIfNeeded):
(WebCore::ImageSource::firstFrameMetadataCacheIfNeeded):
These two template functions will be used to return and cache, if needed,
the image metadata. The first function uses the ImageDecoder while the
second one uses the first ImageFrame of the image.

(WebCore::ImageSource::encodedDataStatus):
(WebCore::ImageSource::frameCount):
(WebCore::ImageSource::repetitionCount):
(WebCore::ImageSource::uti):
(WebCore::ImageSource::filenameExtension):
(WebCore::ImageSource::accessibilityDescription):
(WebCore::ImageSource::hotSpot):
(WebCore::ImageSource::orientation):
(WebCore::ImageSource::densityCorrectedSize):
(WebCore::ImageSource::sourceSize):
(WebCore::ImageSource::singlePixelSolidColor):
(WebCore::ImageSource::maximumSubsamplingLevel):
(WebCore::ImageSource::frameDecodingStatusAtIndex):
(WebCore::ImageSource::frameHasAlphaAtIndex):
(WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex):
(WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex):
(WebCore::ImageSource::frameSubsamplingLevelAtIndex):
(WebCore::ImageSource::frameSizeAtIndex):
(WebCore::ImageSource::frameBytesAtIndex):
(WebCore::ImageSource::frameDurationAtIndex):
(WebCore::ImageSource::frameOrientationAtIndex):
(WebCore::ImageSource::frameImageAtIndex):
(WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
(WebCore::ImageSource::metadata): Deleted.
(WebCore::ImageSource::frameMetadataAtIndex): Deleted.
(WebCore::ImageSource::frameMetadataAtIndexCacheIfNeeded): Deleted.
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::frameAtIndex):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275569 => 275570)


--- trunk/Source/WebCore/ChangeLog	2021-04-06 23:28:53 UTC (rev 275569)
+++ trunk/Source/WebCore/ChangeLog	2021-04-06 23:36:25 UTC (rev 275570)
@@ -1,3 +1,57 @@
+2021-04-06  Said Abou-Hallawa  <[email protected]>
+
+        Replace the Optional metadata of ImageSource by a single OptionSet and the underlying metadata
+        https://bugs.webkit.org/show_bug.cgi?id=224202
+
+        Reviewed by Simon Fraser.
+
+        Encapsulating the metadata in a Optionals adds extra memory cost. Replace
+        these Optionals by the underlying metadata and an OptionSet to tell which
+        ones are cached.
+
+        * platform/graphics/ImageSource.cpp:
+        (WebCore::ImageSource::ImageSource):
+        (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
+        Instead of assertion index < m_frames.size(), we can return defaultFrame().
+        This will used in many callers which checks the size before calling it.
+
+        (WebCore::ImageSource::clearMetadata):
+
+        (WebCore::ImageSource::metadataCacheIfNeeded):
+        (WebCore::ImageSource::firstFrameMetadataCacheIfNeeded):
+        These two template functions will be used to return and cache, if needed,
+        the image metadata. The first function uses the ImageDecoder while the
+        second one uses the first ImageFrame of the image.
+
+        (WebCore::ImageSource::encodedDataStatus):
+        (WebCore::ImageSource::frameCount):
+        (WebCore::ImageSource::repetitionCount):
+        (WebCore::ImageSource::uti):
+        (WebCore::ImageSource::filenameExtension):
+        (WebCore::ImageSource::accessibilityDescription):
+        (WebCore::ImageSource::hotSpot):
+        (WebCore::ImageSource::orientation):
+        (WebCore::ImageSource::densityCorrectedSize):
+        (WebCore::ImageSource::sourceSize):
+        (WebCore::ImageSource::singlePixelSolidColor):
+        (WebCore::ImageSource::maximumSubsamplingLevel):
+        (WebCore::ImageSource::frameDecodingStatusAtIndex):
+        (WebCore::ImageSource::frameHasAlphaAtIndex):
+        (WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex):
+        (WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex):
+        (WebCore::ImageSource::frameSubsamplingLevelAtIndex):
+        (WebCore::ImageSource::frameSizeAtIndex):
+        (WebCore::ImageSource::frameBytesAtIndex):
+        (WebCore::ImageSource::frameDurationAtIndex):
+        (WebCore::ImageSource::frameOrientationAtIndex):
+        (WebCore::ImageSource::frameImageAtIndex):
+        (WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
+        (WebCore::ImageSource::metadata): Deleted.
+        (WebCore::ImageSource::frameMetadataAtIndex): Deleted.
+        (WebCore::ImageSource::frameMetadataAtIndexCacheIfNeeded): Deleted.
+        * platform/graphics/ImageSource.h:
+        (WebCore::ImageSource::frameAtIndex):
+
 2021-04-06  Myles C. Maxfield  <[email protected]>
 
         [GPU Process] Simplify DisplayList::Iterator part 3: Reorder #include dependencies to allow for ItemBuffer{Writing,Reading}Client to know about DisplayList item types

Modified: trunk/Source/WebCore/platform/graphics/ImageSource.cpp (275569 => 275570)


--- trunk/Source/WebCore/platform/graphics/ImageSource.cpp	2021-04-06 23:28:53 UTC (rev 275569)
+++ trunk/Source/WebCore/platform/graphics/ImageSource.cpp	2021-04-06 23:36:25 UTC (rev 275570)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc.  All rights reserved.
+ * Copyright (C) 2016-2021 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -54,6 +54,7 @@
 {
     m_frameCount = 1;
     m_encodedDataStatus = EncodedDataStatus::Complete;
+    m_cachedMetadata.add({ MetadataType::EncodedDataStatus, MetadataType::FrameCount });
     growFrames();
 
     setNativeImage(WTFMove(nativeImage));
@@ -62,6 +63,7 @@
 
     m_size = m_frames[0].size();
     m_orientation = ImageOrientation(ImageOrientation::None);
+    m_cachedMetadata.add({ MetadataType::Orientation, MetadataType::Size });
 }
 
 ImageSource::~ImageSource()
@@ -435,7 +437,9 @@
 
 const ImageFrame& ImageSource::frameAtIndexCacheIfNeeded(size_t index, ImageFrame::Caching caching, const Optional<SubsamplingLevel>& subsamplingLevel)
 {
-    ASSERT(index < m_frames.size());
+    if (index >= m_frames.size())
+        return ImageFrame::defaultFrame();
+    
     ImageFrame& frame = m_frames[index];
     if (!isDecoderAvailable() || frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex(index, DecodingOptions(DecodingMode::Asynchronous)))
         return frame;
@@ -466,11 +470,13 @@
 
 void ImageSource::clearMetadata()
 {
-    m_frameCount = WTF::nullopt;
-    m_repetitionCount = WTF::nullopt;
-    m_singlePixelSolidColor = WTF::nullopt;
-    m_encodedDataStatus = WTF::nullopt;
-    m_uti = WTF::nullopt;
+    m_cachedMetadata.remove({
+        MetadataType::EncodedDataStatus,
+        MetadataType::FrameCount,
+        MetadataType::RepetitionCount,
+        MetadataType::SinglePixelSolidColor,
+        MetadataType::UTI
+    });
 }
 
 URL ImageSource::sourceURL() const
@@ -488,65 +494,57 @@
     return m_image ? m_image->expectedContentLength() : 0;
 }
 
-template<typename T, T (ImageDecoder::*functor)() const>
-T ImageSource::metadata(const T& defaultValue, Optional<T>* cachedValue)
+template<typename T>
+T ImageSource::metadataCacheIfNeeded(T& cachedValue, const T& defaultValue, MetadataType metadataType, T (ImageDecoder::*functor)() const)
 {
-    if (cachedValue && *cachedValue)
-        return cachedValue->value();
+    if (m_cachedMetadata.contains(metadataType))
+        return cachedValue;
 
     if (!isDecoderAvailable() || !m_decoder->isSizeAvailable())
         return defaultValue;
 
-    if (!cachedValue)
-        return (*m_decoder.*functor)();
-
-    *cachedValue = (*m_decoder.*functor)();
+    cachedValue = (*m_decoder.*functor)();
+    m_cachedMetadata.add(metadataType);
     didDecodeProperties(m_decoder->bytesDecodedToDetermineProperties());
-    return cachedValue->value();
+    return cachedValue;
 }
 
-template<typename T, typename... Args>
-T ImageSource::frameMetadataAtIndex(size_t index, T (ImageFrame::*functor)(Args...) const, Args&&... args)
+template<typename T>
+T ImageSource::firstFrameMetadataCacheIfNeeded(T& cachedValue, MetadataType metadataType, T (ImageFrame::*functor)() const, ImageFrame::Caching caching, const Optional<SubsamplingLevel>& subsamplingLevel)
 {
-    const ImageFrame& frame = index < m_frames.size() ? m_frames[index] : ImageFrame::defaultFrame();
-    return (frame.*functor)(std::forward<Args>(args)...);
-}
+    if (m_cachedMetadata.contains(metadataType))
+        return cachedValue;
 
-template<typename T, typename... Args>
-T ImageSource::frameMetadataAtIndexCacheIfNeeded(size_t index, T (ImageFrame::*functor)() const, Optional<T>* cachedValue, Args&&... args)
-{
-    if (cachedValue && *cachedValue)
-        return cachedValue->value();
+    const ImageFrame& frame = frameAtIndexCacheIfNeeded(0, caching, subsamplingLevel);
 
-    const ImageFrame& frame = index < m_frames.size() ? frameAtIndexCacheIfNeeded(index, std::forward<Args>(args)...) : ImageFrame::defaultFrame();
-
     // Don't cache any unavailable frame metadata.
-    if (!frame.hasMetadata() || !cachedValue)
+    if (!frame.hasMetadata())
         return (frame.*functor)();
 
-    *cachedValue = (frame.*functor)();
-    return cachedValue->value();
+    cachedValue = (frame.*functor)();
+    m_cachedMetadata.add(metadataType);
+    return cachedValue;
 }
 
 EncodedDataStatus ImageSource::encodedDataStatus()
 {
-    return metadata<EncodedDataStatus, (&ImageDecoder::encodedDataStatus)>(EncodedDataStatus::Unknown, &m_encodedDataStatus);
+    return metadataCacheIfNeeded(m_encodedDataStatus, EncodedDataStatus::Unknown, MetadataType::EncodedDataStatus, &ImageDecoder::encodedDataStatus);
 }
 
 size_t ImageSource::frameCount()
 {
-    return metadata<size_t, (&ImageDecoder::frameCount)>(m_frames.size(), &m_frameCount);
+    return metadataCacheIfNeeded(m_frameCount, m_frames.size(), MetadataType::FrameCount, &ImageDecoder::frameCount);
 }
 
 RepetitionCount ImageSource::repetitionCount()
 {
-    return metadata<RepetitionCount, (&ImageDecoder::repetitionCount)>(RepetitionCountNone, &m_repetitionCount);
+    return metadataCacheIfNeeded(m_repetitionCount, static_cast<RepetitionCount>(RepetitionCountNone), MetadataType::RepetitionCount, &ImageDecoder::repetitionCount);
 }
 
 String ImageSource::uti()
 {
 #if USE(CG)
-    return metadata<String, (&ImageDecoder::uti)>(String(), &m_uti);
+    return metadataCacheIfNeeded(m_uti, String(), MetadataType::UTI, &ImageDecoder::uti);
 #else
     return String();
 #endif
@@ -554,27 +552,27 @@
 
 String ImageSource::filenameExtension()
 {
-    return metadata<String, (&ImageDecoder::filenameExtension)>(String(), &m_filenameExtension);
+    return metadataCacheIfNeeded(m_filenameExtension, String(), MetadataType::FileNameExtension, &ImageDecoder::filenameExtension);
 }
 
 String ImageSource::accessibilityDescription()
 {
-    return metadata<String, (&ImageDecoder::accessibilityDescription)>(String(), &m_accessibilityDescription);
+    return metadataCacheIfNeeded(m_accessibilityDescription, String(), MetadataType::AccessibilityDescription, &ImageDecoder::accessibilityDescription);
 }
 
 Optional<IntPoint> ImageSource::hotSpot()
 {
-    return metadata<Optional<IntPoint>, (&ImageDecoder::hotSpot)>(WTF::nullopt, &m_hotSpot);
+    return metadataCacheIfNeeded(m_hotSpot, { }, MetadataType::HotSpot, &ImageDecoder::hotSpot);
 }
 
 ImageOrientation ImageSource::orientation()
 {
-    return frameMetadataAtIndexCacheIfNeeded<ImageOrientation>(0, (&ImageFrame::orientation), &m_orientation, ImageFrame::Caching::Metadata);
+    return firstFrameMetadataCacheIfNeeded(m_orientation, MetadataType::Orientation, &ImageFrame::orientation, ImageFrame::Caching::Metadata);
 }
 
 Optional<IntSize> ImageSource::densityCorrectedSize(ImageOrientation orientation)
 {
-    auto size = frameMetadataAtIndexCacheIfNeeded<Optional<IntSize>>(0, &ImageFrame::densityCorrectedSize, &m_densityCorrectedSize, ImageFrame::Caching::Metadata);
+    auto size = firstFrameMetadataCacheIfNeeded(m_densityCorrectedSize, MetadataType::DensityCorrectedSize, &ImageFrame::densityCorrectedSize, ImageFrame::Caching::Metadata);
     if (!size)
         return WTF::nullopt;
 
@@ -600,7 +598,7 @@
         size = m_decoder->size();
     else
 #endif
-        size = frameMetadataAtIndexCacheIfNeeded<IntSize>(0, (&ImageFrame::size), &m_size, ImageFrame::Caching::Metadata, SubsamplingLevel::Default);
+        size = firstFrameMetadataCacheIfNeeded(m_size, MetadataType::Size, &ImageFrame::size, ImageFrame::Caching::Metadata, SubsamplingLevel::Default);
     
     if (orientation == ImageOrientation::FromImage)
         orientation = this->orientation();
@@ -610,19 +608,18 @@
 
 Color ImageSource::singlePixelSolidColor()
 {
-    if (!m_singlePixelSolidColor && (size() != IntSize(1, 1) || frameCount() != 1))
+    if (!m_cachedMetadata.contains(MetadataType::SinglePixelSolidColor) && (size() != IntSize(1, 1) || frameCount() != 1)) {
         m_singlePixelSolidColor = Color();
+        m_cachedMetadata.add(MetadataType::SinglePixelSolidColor);
+    }
 
-    if (m_singlePixelSolidColor)
-        return m_singlePixelSolidColor.value();
-
-    return frameMetadataAtIndexCacheIfNeeded<Color>(0, (&ImageFrame::singlePixelSolidColor), &m_singlePixelSolidColor, ImageFrame::Caching::MetadataAndImage);
+    return firstFrameMetadataCacheIfNeeded(m_singlePixelSolidColor, MetadataType::SinglePixelSolidColor, &ImageFrame::singlePixelSolidColor, ImageFrame::Caching::MetadataAndImage);
 }
 
 SubsamplingLevel ImageSource::maximumSubsamplingLevel()
 {
-    if (m_maximumSubsamplingLevel)
-        return m_maximumSubsamplingLevel.value();
+    if (m_cachedMetadata.contains(MetadataType::MaximumSubsamplingLevel))
+        return m_maximumSubsamplingLevel;
 
     if (!isDecoderAvailable() || !m_decoder->frameAllowSubsamplingAtIndex(0))
         return SubsamplingLevel::Default;
@@ -639,7 +636,8 @@
     }
 
     m_maximumSubsamplingLevel = level;
-    return m_maximumSubsamplingLevel.value();
+    m_cachedMetadata.add(MetadataType::MaximumSubsamplingLevel);
+    return m_maximumSubsamplingLevel;
 }
 
 bool ImageSource::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex(size_t index, const DecodingOptions& decodingOptions)
@@ -652,47 +650,47 @@
 
 DecodingStatus ImageSource::frameDecodingStatusAtIndex(size_t index)
 {
-    return frameMetadataAtIndexCacheIfNeeded<DecodingStatus>(index, (&ImageFrame::decodingStatus), nullptr, ImageFrame::Caching::Metadata);
+    return frameAtIndexCacheIfNeeded(index, ImageFrame::Caching::Metadata).decodingStatus();
 }
 
 bool ImageSource::frameHasAlphaAtIndex(size_t index)
 {
-    return frameMetadataAtIndex<bool>(index, (&ImageFrame::hasAlpha));
+    return frameAtIndex(index).hasAlpha();
 }
 
 bool ImageSource::frameHasFullSizeNativeImageAtIndex(size_t index, const Optional<SubsamplingLevel>& subsamplingLevel)
 {
-    return frameMetadataAtIndex<bool>(index, (&ImageFrame::hasFullSizeNativeImage), subsamplingLevel);
+    return frameAtIndex(index).hasFullSizeNativeImage(subsamplingLevel);
 }
 
 bool ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t index, const Optional<SubsamplingLevel>& subsamplingLevel, const DecodingOptions& decodingOptions)
 {
-    return frameMetadataAtIndex<bool>(index, (&ImageFrame::hasDecodedNativeImageCompatibleWithOptions), subsamplingLevel, decodingOptions);
+    return frameAtIndex(index).hasDecodedNativeImageCompatibleWithOptions(subsamplingLevel, decodingOptions);
 }
 
 SubsamplingLevel ImageSource::frameSubsamplingLevelAtIndex(size_t index)
 {
-    return frameMetadataAtIndex<SubsamplingLevel>(index, (&ImageFrame::subsamplingLevel));
+    return frameAtIndex(index).subsamplingLevel();
 }
 
 IntSize ImageSource::frameSizeAtIndex(size_t index, SubsamplingLevel subsamplingLevel)
 {
-    return frameMetadataAtIndexCacheIfNeeded<IntSize>(index, (&ImageFrame::size), nullptr, ImageFrame::Caching::Metadata, subsamplingLevel);
+    return frameAtIndexCacheIfNeeded(index, ImageFrame::Caching::Metadata, subsamplingLevel).size();
 }
 
 unsigned ImageSource::frameBytesAtIndex(size_t index, SubsamplingLevel subsamplingLevel)
 {
-    return frameMetadataAtIndexCacheIfNeeded<unsigned>(index, (&ImageFrame::frameBytes), nullptr, ImageFrame::Caching::Metadata, subsamplingLevel);
+    return frameAtIndexCacheIfNeeded(index, ImageFrame::Caching::Metadata, subsamplingLevel).frameBytes();
 }
 
 Seconds ImageSource::frameDurationAtIndex(size_t index)
 {
-    return frameMetadataAtIndexCacheIfNeeded<Seconds>(index, (&ImageFrame::duration), nullptr, ImageFrame::Caching::Metadata);
+    return frameAtIndexCacheIfNeeded(index, ImageFrame::Caching::Metadata).duration();
 }
 
 ImageOrientation ImageSource::frameOrientationAtIndex(size_t index)
 {
-    return frameMetadataAtIndexCacheIfNeeded<ImageOrientation>(index, (&ImageFrame::orientation), nullptr, ImageFrame::Caching::Metadata);
+    return frameAtIndexCacheIfNeeded(index, ImageFrame::Caching::Metadata).orientation();
 }
 
 #if USE(DIRECT2D)
@@ -712,12 +710,12 @@
 
 RefPtr<NativeImage> ImageSource::frameImageAtIndex(size_t index)
 {
-    return frameMetadataAtIndex<RefPtr<NativeImage>>(index, (&ImageFrame::nativeImage));
+    return frameAtIndex(index).nativeImage();
 }
 
 RefPtr<NativeImage> ImageSource::frameImageAtIndexCacheIfNeeded(size_t index, SubsamplingLevel subsamplingLevel)
 {
-    return frameMetadataAtIndexCacheIfNeeded<RefPtr<NativeImage>>(index, (&ImageFrame::nativeImage), nullptr, ImageFrame::Caching::MetadataAndImage, subsamplingLevel);
+    return frameAtIndexCacheIfNeeded(index, ImageFrame::Caching::MetadataAndImage, subsamplingLevel).nativeImage();
 }
 
 void ImageSource::dump(TextStream& ts)

Modified: trunk/Source/WebCore/platform/graphics/ImageSource.h (275569 => 275570)


--- trunk/Source/WebCore/platform/graphics/ImageSource.h	2021-04-06 23:28:53 UTC (rev 275569)
+++ trunk/Source/WebCore/platform/graphics/ImageSource.h	2021-04-06 23:36:25 UTC (rev 275570)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc.  All rights reserved.
+ * Copyright (C) 2016-2021 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -134,14 +134,26 @@
     ImageSource(BitmapImage*, AlphaOption = AlphaOption::Premultiplied, GammaAndColorProfileOption = GammaAndColorProfileOption::Applied);
     ImageSource(RefPtr<NativeImage>&&);
 
-    template<typename T, T (ImageDecoder::*functor)() const>
-    T metadata(const T& defaultValue, Optional<T>* cachedValue = nullptr);
+    enum class MetadataType {
+        AccessibilityDescription    = 1 << 0,
+        DensityCorrectedSize        = 1 << 1,
+        EncodedDataStatus           = 1 << 2,
+        FileNameExtension           = 1 << 3,
+        FrameCount                  = 1 << 4,
+        HotSpot                     = 1 << 5,
+        MaximumSubsamplingLevel     = 1 << 6,
+        Orientation                 = 1 << 7,
+        RepetitionCount             = 1 << 8,
+        SinglePixelSolidColor       = 1 << 9,
+        Size                        = 1 << 10,
+        UTI                         = 1 << 11
+    };
 
-    template<typename T, typename... Args>
-    T frameMetadataAtIndex(size_t, T (ImageFrame::*functor)(Args...) const, Args&&...);
+    template<typename T>
+    T metadataCacheIfNeeded(T& cachedValue, const T& defaultValue, MetadataType, T (ImageDecoder::*functor)() const);
 
-    template<typename T, typename... Args>
-    T frameMetadataAtIndexCacheIfNeeded(size_t, T (ImageFrame::*functor)() const,  Optional<T>* cachedValue, Args&&...);
+    template<typename T>
+    T firstFrameMetadataCacheIfNeeded(T& cachedValue, MetadataType, T (ImageFrame::*functor)() const, ImageFrame::Caching, const Optional<SubsamplingLevel>& = { });
 
     bool ensureDecoderAvailable(SharedBuffer* data);
     bool isDecoderAvailable() const { return m_decoder; }
@@ -163,6 +175,7 @@
     WorkQueue& decodingQueue();
     SynchronizedFixedQueue<ImageFrameRequest, BufferSize>& frameRequestQueue();
 
+    const ImageFrame& frameAtIndex(size_t index) { return index < m_frames.size() ? m_frames[index] : ImageFrame::defaultFrame(); }
     const ImageFrame& frameAtIndexCacheIfNeeded(size_t, ImageFrame::Caching, const Optional<SubsamplingLevel>& = { });
 
     void dump(TextStream&);
@@ -195,21 +208,23 @@
     Seconds m_frameDecodingDurationForTesting;
 
     // Image metadata.
-    Optional<EncodedDataStatus> m_encodedDataStatus;
-    Optional<size_t> m_frameCount;
-    Optional<RepetitionCount> m_repetitionCount;
-    Optional<String> m_uti;
-    Optional<String> m_filenameExtension;
-    Optional<String> m_accessibilityDescription;
-    Optional<Optional<IntPoint>> m_hotSpot;
+    EncodedDataStatus m_encodedDataStatus { EncodedDataStatus::Unknown };
+    size_t m_frameCount { 0 };
+    RepetitionCount m_repetitionCount { RepetitionCountNone };
+    String m_uti;
+    String m_filenameExtension;
+    String m_accessibilityDescription;
+    Optional<IntPoint> m_hotSpot;
 
     // Image metadata which is calculated from the first ImageFrame.
-    Optional<IntSize> m_size;
-    Optional<ImageOrientation> m_orientation;
-    Optional<Optional<IntSize>> m_densityCorrectedSize;
-    Optional<Color> m_singlePixelSolidColor;
-    Optional<SubsamplingLevel> m_maximumSubsamplingLevel;
+    IntSize m_size;
+    Optional<IntSize> m_densityCorrectedSize;
+    ImageOrientation m_orientation;
+    Color m_singlePixelSolidColor;
+    SubsamplingLevel m_maximumSubsamplingLevel { SubsamplingLevel::Default };
 
+    OptionSet<MetadataType> m_cachedMetadata;
+
     RunLoop& m_runLoop;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to