Title: [288426] trunk/Source/WebCore
Revision
288426
Author
da...@apple.com
Date
2022-01-23 16:55:31 -0800 (Sun, 23 Jan 2022)

Log Message

Improve FourCC to use more inlining, fix incorrect mix of WEBCORE_EXPORT on entire class with inline functions
https://bugs.webkit.org/show_bug.cgi?id=235461

Reviewed by Sam Weinig.

* WebCore.xcodeproj/project.pbxproj: Added FourCC.cpp. Because of
unified sources it was compiled, but because it was not in the project
various Xcode features would not work.

* platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp:
Added some explicitly non-inlined exported functions. These need to
be exported because they are used in TestWebKitAPI tests and we
want to export the functions rather than the vtable pointer.
* platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.h:
Stop using WEBCORE_EXPORT on whole classes that contain inline
functions, and instead use it on individual functions.

* platform/graphics/FourCC.cpp:
(WebCore::FourCC::fromString): Take a StringView instead of String.
Removed unnecessary allocation of a temporary CString for the result
of String::ascii.
(WebCore::FourCC::string const): Rename from toString to string and
changed the return type to std::array instead of String.

* platform/graphics/FourCC.h: Made all the constructors constexpr.
Changed the string literal constructor to just work with 4-character
strings. The old one was a template for any length string, but then
asserted it was 4 characters long, which is a roundabout way to do it.

* platform/graphics/HEVCUtilities.cpp:
(WebCore::parseHEVCDecoderConfigurationRecord): Take FourCC instead
of const FourCC&. Also removed unnecessary explicit conversion to
FourCC since four character strings.
* platform/graphics/HEVCUtilities.h: Ditto.

* platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.h:
Removed unneeded WEBCORE_EXPORT on these classes.

* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Removed
unnecesary calls to toString, logging can handle FourCC without it.
Also removed unneeded type casts to size_t.

* platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
(WebCore::contentTypesToCodecs): Removed unnecessary allocation of
a String by using StringView for the substring.

* platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
(WebCore::validateHEVCParameters): Added an explicit cast to String
since FourCC::fromString now takes a StringView. Sadly there's not
a trivial way to do this without allocating a String.

* platform/graphics/cv/GraphicsContextGLCVCocoa.cpp:
(WebCore::GraphicsContextGLCVCocoa::copyVideoSampleToTexture):
Since FourCC::string now returns a std::array with a C-style
null-terminated string, use it instead of calling toString and
then utf8. Cleaner and also much more efficient.

* platform/graphics/iso/ISOBox.cpp: Moved constructors and
destructors so they are no longer inlined so there is no need to
export the vtable.
(WebCore::ISOBox::peekBox): Removed unnecessary initialization
of FourCC since they are zero by default.

* platform/graphics/iso/ISOBox.h: Removed WEBCORE_EXPORT of
the entire class, since that's not fully compatible with a class
with inline functions (warning is done by check-webkit-style).
Put WEBCORE_EXPORT on individual functions instead.  Also use some
more constexpr, removed unneeded FourCC initialization since it is
zero by default, and use FourCC, not const FourCC& for return value.

* platform/graphics/iso/ISOOriginalFormatBox.h: Removed unneeded
FourCC initialization since it is zero by default.
* platform/graphics/iso/ISOSchemeTypeBox.h: Ditto.

* platform/graphics/iso/ISOVTTCue.cpp: Moved constructors and
destructors so they are no longer inlined so there is no need to
export the vtable.
(WebCore::ISOWebVTTCue::parse): Use PRIu64 instead of casting
to size_t, no need to rely on the relationship between type sizes.

* platform/graphics/iso/ISOVTTCue.h: Removed WEBCORE_EXPORT of
the entire class, since that's not fully compatible with a class
with inline functions (warning is done by check-webkit-style).
Put WEBCORE_EXPORT on individual functions instead.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288425 => 288426)


--- trunk/Source/WebCore/ChangeLog	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/ChangeLog	2022-01-24 00:55:31 UTC (rev 288426)
@@ -1,3 +1,91 @@
+2022-01-23  Darin Adler  <da...@apple.com>
+
+        Improve FourCC to use more inlining, fix incorrect mix of WEBCORE_EXPORT on entire class with inline functions
+        https://bugs.webkit.org/show_bug.cgi?id=235461
+
+        Reviewed by Sam Weinig.
+
+        * WebCore.xcodeproj/project.pbxproj: Added FourCC.cpp. Because of
+        unified sources it was compiled, but because it was not in the project
+        various Xcode features would not work.
+
+        * platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp:
+        Added some explicitly non-inlined exported functions. These need to
+        be exported because they are used in TestWebKitAPI tests and we
+        want to export the functions rather than the vtable pointer.
+        * platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.h:
+        Stop using WEBCORE_EXPORT on whole classes that contain inline
+        functions, and instead use it on individual functions.
+
+        * platform/graphics/FourCC.cpp:
+        (WebCore::FourCC::fromString): Take a StringView instead of String.
+        Removed unnecessary allocation of a temporary CString for the result
+        of String::ascii.
+        (WebCore::FourCC::string const): Rename from toString to string and
+        changed the return type to std::array instead of String.
+
+        * platform/graphics/FourCC.h: Made all the constructors constexpr.
+        Changed the string literal constructor to just work with 4-character
+        strings. The old one was a template for any length string, but then
+        asserted it was 4 characters long, which is a roundabout way to do it.
+
+        * platform/graphics/HEVCUtilities.cpp:
+        (WebCore::parseHEVCDecoderConfigurationRecord): Take FourCC instead
+        of const FourCC&. Also removed unnecessary explicit conversion to
+        FourCC since four character strings.
+        * platform/graphics/HEVCUtilities.h: Ditto.
+
+        * platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.h:
+        Removed unneeded WEBCORE_EXPORT on these classes.
+
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+        (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Removed
+        unnecesary calls to toString, logging can handle FourCC without it.
+        Also removed unneeded type casts to size_t.
+
+        * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
+        (WebCore::contentTypesToCodecs): Removed unnecessary allocation of
+        a String by using StringView for the substring.
+
+        * platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
+        (WebCore::validateHEVCParameters): Added an explicit cast to String
+        since FourCC::fromString now takes a StringView. Sadly there's not
+        a trivial way to do this without allocating a String.
+
+        * platform/graphics/cv/GraphicsContextGLCVCocoa.cpp:
+        (WebCore::GraphicsContextGLCVCocoa::copyVideoSampleToTexture):
+        Since FourCC::string now returns a std::array with a C-style
+        null-terminated string, use it instead of calling toString and
+        then utf8. Cleaner and also much more efficient.
+
+        * platform/graphics/iso/ISOBox.cpp: Moved constructors and
+        destructors so they are no longer inlined so there is no need to
+        export the vtable.
+        (WebCore::ISOBox::peekBox): Removed unnecessary initialization
+        of FourCC since they are zero by default.
+
+        * platform/graphics/iso/ISOBox.h: Removed WEBCORE_EXPORT of
+        the entire class, since that's not fully compatible with a class
+        with inline functions (warning is done by check-webkit-style).
+        Put WEBCORE_EXPORT on individual functions instead.  Also use some
+        more constexpr, removed unneeded FourCC initialization since it is
+        zero by default, and use FourCC, not const FourCC& for return value.
+
+        * platform/graphics/iso/ISOOriginalFormatBox.h: Removed unneeded
+        FourCC initialization since it is zero by default.
+        * platform/graphics/iso/ISOSchemeTypeBox.h: Ditto.
+
+        * platform/graphics/iso/ISOVTTCue.cpp: Moved constructors and
+        destructors so they are no longer inlined so there is no need to
+        export the vtable.
+        (WebCore::ISOWebVTTCue::parse): Use PRIu64 instead of casting
+        to size_t, no need to rely on the relationship between type sizes.
+
+        * platform/graphics/iso/ISOVTTCue.h: Removed WEBCORE_EXPORT of
+        the entire class, since that's not fully compatible with a class
+        with inline functions (warning is done by check-webkit-style).
+        Put WEBCORE_EXPORT on individual functions instead.
+
 2022-01-23  Tyler Wilcock  <tyle...@apple.com>
 
         AX Isolated Tree Mode: Re-compute AXPropertyName::IsEnabled when a node experiences AXDisabledStateChanged

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (288425 => 288426)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-01-24 00:55:31 UTC (rev 288426)
@@ -12568,6 +12568,7 @@
 		932CC0D11DFFD667004C0F9F /* JSMediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaTrackConstraints.h; sourceTree = "<group>"; };
 		932CC0F01DFFD8D4004C0F9F /* MediaTrackConstraints.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaTrackConstraints.idl; sourceTree = "<group>"; };
 		932CC0F61DFFDA1F004C0F9F /* MediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTrackConstraints.cpp; sourceTree = "<group>"; };
+		932D26F4279B8526004DCD8D /* FourCC.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FourCC.cpp; sourceTree = "<group>"; };
 		932E16080AF578340025F408 /* FrameLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoader.cpp; sourceTree = "<group>"; };
 		932F1D39270D269F000C2813 /* JSDOMAsyncIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMAsyncIterator.h; sourceTree = "<group>"; };
 		932F1D43270EBF38000C2813 /* JSFileSystemDirectoryHandleCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileSystemDirectoryHandleCustom.cpp; sourceTree = "<group>"; };
@@ -28843,6 +28844,7 @@
 				4A6E9FC613C17D570046A7F8 /* FontTaggedSettings.h */,
 				7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */,
 				7CE6CBFA187F370700D46BF5 /* FormatConverter.h */,
+				932D26F4279B8526004DCD8D /* FourCC.cpp */,
 				CD525BA21EE0B10700788DF5 /* FourCC.h */,
 				4FB390AC15EF61F3007AD51F /* GeneratedImage.cpp */,
 				BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */,

Modified: trunk/Source/WebCore/platform/graphics/FourCC.cpp (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/FourCC.cpp	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/FourCC.cpp	2022-01-24 00:55:31 UTC (rev 288426)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,28 +28,17 @@
 
 namespace WebCore {
 
-std::optional<FourCC> FourCC::fromString(const String& stringValue)
+std::optional<FourCC> FourCC::fromString(StringView string)
 {
-    auto asciiValue = stringValue.ascii();
-    if (asciiValue.length() != 4)
+    if (string.length() != 4 || !string.isAllASCII())
         return std::nullopt;
-
-    const char* data = ""
-    ASSERT(asciiValue.data());
-    uint32_t value = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
-    return FourCC(value);
+    return { { {
+        static_cast<char>(string[0]),
+        static_cast<char>(string[1]),
+        static_cast<char>(string[2]),
+        static_cast<char>(string[3]),
+        '\0'
+    } } };
 }
 
-String FourCC::toString() const
-{
-    Vector<LChar, 4> data = {
-        LChar(value >> 24),
-        LChar((value >> 16) & 0xFF),
-        LChar((value >> 8) & 0xFF),
-        LChar(value & 0xFF),
-    };
-
-    return String::adopt(WTFMove(data));
 }
-
-}

Modified: trunk/Source/WebCore/platform/graphics/FourCC.h (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/FourCC.h	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/FourCC.h	2022-01-24 00:55:31 UTC (rev 288426)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,25 +30,42 @@
 namespace WebCore {
 
 struct FourCC {
-    FourCC() = default;
-    FourCC(uint32_t value) : value(value) { }
+    constexpr FourCC() = default;
+    constexpr FourCC(uint32_t value) : value { value } { }
+    constexpr FourCC(const char (&nullTerminatedString)[5]);
+    constexpr std::array<char, 5> string() const;
+    static std::optional<FourCC> fromString(StringView);
 
-    template<std::size_t N>
-    constexpr FourCC(const char (&data)[N])
-    {
-        static_assert((N - 1) == 4, "FourCC literals must be exactly 4 characters long");
-        value = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
-    }
+    uint32_t value { 0 };
+};
 
-    String toString() const;
-    WEBCORE_EXPORT static std::optional<FourCC> fromString(const String&);
+constexpr bool operator==(FourCC, FourCC);
+constexpr bool operator!=(FourCC, FourCC);
 
-    bool operator==(const FourCC& other) const { return value == other.value; }
-    bool operator!=(const FourCC& other) const { return value != other.value; }
+constexpr FourCC::FourCC(const char (&data)[5])
+    : value(data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3])
+{
+    ASSERT_UNDER_CONSTEXPR_CONTEXT(isASCII(data[0]));
+    ASSERT_UNDER_CONSTEXPR_CONTEXT(isASCII(data[1]));
+    ASSERT_UNDER_CONSTEXPR_CONTEXT(isASCII(data[2]));
+    ASSERT_UNDER_CONSTEXPR_CONTEXT(isASCII(data[3]));
+    ASSERT_UNDER_CONSTEXPR_CONTEXT(data[4] == '\0');
+}
 
-    uint32_t value { 0 };
-};
+constexpr std::array<char, 5> FourCC::string() const
+{
+    return {
+        static_cast<char>(value >> 24),
+        static_cast<char>(value >> 16),
+        static_cast<char>(value >> 8),
+        static_cast<char>(value),
+        '\0'
+    };
+}
 
+constexpr bool operator==(FourCC a, FourCC b) { return a.value == b.value; }
+constexpr bool operator!=(FourCC a, FourCC b) { return a.value != b.value; }
+
 } // namespace WebCore
 
 namespace WTF {
@@ -56,7 +73,7 @@
 template<typename> struct LogArgument;
 
 template<> struct LogArgument<WebCore::FourCC> {
-    static String toString(const WebCore::FourCC& code) { return code.toString(); }
+    static String toString(const WebCore::FourCC& code) { return code.string().data(); }
 };
 
 } // namespace WTF

Modified: trunk/Source/WebCore/platform/graphics/HEVCUtilities.cpp (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/HEVCUtilities.cpp	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/HEVCUtilities.cpp	2022-01-24 00:55:31 UTC (rev 288426)
@@ -238,7 +238,7 @@
         , compatibilityFlags.toString());
 }
 
-std::optional<HEVCParameters> parseHEVCDecoderConfigurationRecord(const FourCC& codecCode, const SharedBuffer& buffer)
+std::optional<HEVCParameters> parseHEVCDecoderConfigurationRecord(FourCC codecCode, const SharedBuffer& buffer)
 {
     // ISO/IEC 14496-15:2014
     // 8.3.3.1 HEVC decoder configuration record
@@ -248,9 +248,9 @@
         return std::nullopt;
 
     HEVCParameters parameters;
-    if (codecCode == FourCC("hev1"))
+    if (codecCode == "hev1")
         parameters.codec = HEVCParameters::Codec::Hev1;
-    else if (codecCode == FourCC("hvc1"))
+    else if (codecCode == "hvc1")
         parameters.codec = HEVCParameters::Codec::Hvc1;
     else
         return std::nullopt;

Modified: trunk/Source/WebCore/platform/graphics/HEVCUtilities.h (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/HEVCUtilities.h	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/HEVCUtilities.h	2022-01-24 00:55:31 UTC (rev 288426)
@@ -55,7 +55,7 @@
 };
 
 WEBCORE_EXPORT std::optional<HEVCParameters> parseHEVCCodecParameters(StringView);
-WEBCORE_EXPORT std::optional<HEVCParameters> parseHEVCDecoderConfigurationRecord(const FourCC&, const SharedBuffer&);
+WEBCORE_EXPORT std::optional<HEVCParameters> parseHEVCDecoderConfigurationRecord(FourCC, const SharedBuffer&);
 WEBCORE_EXPORT String createHEVCCodecParametersString(const HEVCParameters&);
 
 struct DoViParameters {

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp	2022-01-24 00:55:31 UTC (rev 288426)
@@ -248,4 +248,19 @@
     return m_initDataBox.read(view, offset);
 }
 
+ISOFairPlayStreamingInfoBox::ISOFairPlayStreamingInfoBox() = default;
+ISOFairPlayStreamingInfoBox::ISOFairPlayStreamingInfoBox(const ISOFairPlayStreamingInfoBox&) = default;
+ISOFairPlayStreamingKeyAssetIdBox::ISOFairPlayStreamingKeyAssetIdBox(const ISOFairPlayStreamingKeyAssetIdBox&) = default;
+ISOFairPlayStreamingKeyAssetIdBox::~ISOFairPlayStreamingKeyAssetIdBox() = default;
+ISOFairPlayStreamingKeyContextBox::ISOFairPlayStreamingKeyContextBox(const ISOFairPlayStreamingKeyContextBox&) = default;
+ISOFairPlayStreamingKeyContextBox::~ISOFairPlayStreamingKeyContextBox() = default;
+ISOFairPlayStreamingKeyVersionListBox::ISOFairPlayStreamingKeyVersionListBox(const ISOFairPlayStreamingKeyVersionListBox&) = default;
+ISOFairPlayStreamingKeyVersionListBox::~ISOFairPlayStreamingKeyVersionListBox() = default;
+ISOFairPlayStreamingKeyRequestBox::ISOFairPlayStreamingKeyRequestBox(const ISOFairPlayStreamingKeyRequestBox&) = default;
+ISOFairPlayStreamingKeyRequestBox::~ISOFairPlayStreamingKeyRequestBox() = default;
+ISOFairPlayStreamingInitDataBox::ISOFairPlayStreamingInitDataBox() = default;
+ISOFairPlayStreamingInitDataBox::~ISOFairPlayStreamingInitDataBox() = default;
+ISOFairPlayStreamingPsshBox::ISOFairPlayStreamingPsshBox() = default;
+ISOFairPlayStreamingPsshBox::~ISOFairPlayStreamingPsshBox() = default;
+
 }

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.h (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.h	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.h	2022-01-24 00:55:31 UTC (rev 288426)
@@ -29,19 +29,23 @@
 
 namespace WebCore {
 
-class WEBCORE_EXPORT ISOFairPlayStreamingInfoBox final : public ISOFullBox {
+class ISOFairPlayStreamingInfoBox final : public ISOFullBox {
 public:
+    WEBCORE_EXPORT ISOFairPlayStreamingInfoBox();
+    WEBCORE_EXPORT ISOFairPlayStreamingInfoBox(const ISOFairPlayStreamingInfoBox&);
+    ISOFairPlayStreamingInfoBox(ISOFairPlayStreamingInfoBox&&);
+
     static FourCC boxTypeName() { return "fpsi"; }
 
     FourCC scheme() const { return m_scheme; }
 
 private:
-    bool parse(JSC::DataView&, unsigned& offset) override;
+    bool parse(JSC::DataView&, unsigned& offset) final;
 
     FourCC m_scheme;
 };
 
-class WEBCORE_EXPORT ISOFairPlayStreamingKeyRequestInfoBox final : public ISOFullBox {
+class ISOFairPlayStreamingKeyRequestInfoBox final : public ISOFullBox {
 public:
     static FourCC boxTypeName() { return "fkri"; }
 
@@ -49,46 +53,75 @@
     const KeyID& keyID() const { return m_keyID; }
 
 private:
-    bool parse(JSC::DataView&, unsigned& offset) override;
+    bool parse(JSC::DataView&, unsigned& offset) final;
 
     KeyID m_keyID;
 };
 
-class WEBCORE_EXPORT ISOFairPlayStreamingKeyAssetIdBox final : public ISOBox {
+class ISOFairPlayStreamingKeyAssetIdBox final : public ISOBox {
 public:
+    ISOFairPlayStreamingKeyAssetIdBox() = default;
+    WEBCORE_EXPORT ISOFairPlayStreamingKeyAssetIdBox(const ISOFairPlayStreamingKeyAssetIdBox&);
+    ISOFairPlayStreamingKeyAssetIdBox(ISOFairPlayStreamingKeyAssetIdBox&&) = default;
+    WEBCORE_EXPORT ~ISOFairPlayStreamingKeyAssetIdBox();
+
+    ISOFairPlayStreamingKeyAssetIdBox& operator=(const ISOFairPlayStreamingKeyAssetIdBox&) = default;
+    ISOFairPlayStreamingKeyAssetIdBox& operator=(ISOFairPlayStreamingKeyAssetIdBox&&) = default;
+
     static FourCC boxTypeName() { return "fkai"; }
     const Vector<uint8_t> data() const { return m_data; }
 
 private:
-    bool parse(JSC::DataView&, unsigned& offset) override;
+    bool parse(JSC::DataView&, unsigned& offset) final;
 
     Vector<uint8_t> m_data;
 };
 
-class WEBCORE_EXPORT ISOFairPlayStreamingKeyContextBox final : public ISOBox {
+class ISOFairPlayStreamingKeyContextBox final : public ISOBox {
 public:
+    ISOFairPlayStreamingKeyContextBox() = default;
+    WEBCORE_EXPORT ISOFairPlayStreamingKeyContextBox(const ISOFairPlayStreamingKeyContextBox&);
+    ISOFairPlayStreamingKeyContextBox(ISOFairPlayStreamingKeyContextBox&&) = default;
+    WEBCORE_EXPORT ~ISOFairPlayStreamingKeyContextBox();
+
+    ISOFairPlayStreamingKeyContextBox& operator=(const ISOFairPlayStreamingKeyContextBox&) = default;
+    ISOFairPlayStreamingKeyContextBox& operator=(ISOFairPlayStreamingKeyContextBox&&) = default;
+
     static FourCC boxTypeName() { return "fkcx"; }
     const Vector<uint8_t> data() const { return m_data; }
 
 private:
-    bool parse(JSC::DataView&, unsigned& offset) override;
+    bool parse(JSC::DataView&, unsigned& offset) final;
 
     Vector<uint8_t> m_data;
 };
 
-class WEBCORE_EXPORT ISOFairPlayStreamingKeyVersionListBox final : public ISOBox {
+class ISOFairPlayStreamingKeyVersionListBox final : public ISOBox {
 public:
+    ISOFairPlayStreamingKeyVersionListBox() = default;
+    WEBCORE_EXPORT ISOFairPlayStreamingKeyVersionListBox(const ISOFairPlayStreamingKeyVersionListBox&);
+    ISOFairPlayStreamingKeyVersionListBox(ISOFairPlayStreamingKeyVersionListBox&&) = default;
+    WEBCORE_EXPORT ~ISOFairPlayStreamingKeyVersionListBox();
+
+    ISOFairPlayStreamingKeyVersionListBox& operator=(const ISOFairPlayStreamingKeyVersionListBox&) = default;
+    ISOFairPlayStreamingKeyVersionListBox& operator=(ISOFairPlayStreamingKeyVersionListBox&&) = default;
+
     static FourCC boxTypeName() { return "fkvl"; }
     const Vector<uint8_t> versions() const { return m_versions; }
 
 private:
-    bool parse(JSC::DataView&, unsigned& offset) override;
+    bool parse(JSC::DataView&, unsigned& offset) final;
 
     Vector<uint8_t> m_versions;
 };
 
-class WEBCORE_EXPORT ISOFairPlayStreamingKeyRequestBox final : public ISOBox {
+class ISOFairPlayStreamingKeyRequestBox final : public ISOBox {
 public:
+    ISOFairPlayStreamingKeyRequestBox() = default;
+    WEBCORE_EXPORT ISOFairPlayStreamingKeyRequestBox(const ISOFairPlayStreamingKeyRequestBox&);
+    ISOFairPlayStreamingKeyRequestBox(ISOFairPlayStreamingKeyRequestBox&&) = default;
+    WEBCORE_EXPORT ~ISOFairPlayStreamingKeyRequestBox();
+
     static FourCC boxTypeName() { return "fpsk"; }
 
     const ISOFairPlayStreamingKeyRequestInfoBox& requestInfo() const { return m_requestInfo; }
@@ -97,7 +130,7 @@
     const std::optional<ISOFairPlayStreamingKeyVersionListBox>& versionList() const { return m_versionList; }
 
 private:
-    bool parse(JSC::DataView&, unsigned& offset) override;
+    bool parse(JSC::DataView&, unsigned& offset) final;
 
     ISOFairPlayStreamingKeyRequestInfoBox m_requestInfo;
     std::optional<ISOFairPlayStreamingKeyAssetIdBox> m_assetID;
@@ -105,8 +138,11 @@
     std::optional<ISOFairPlayStreamingKeyVersionListBox> m_versionList;
 };
 
-class WEBCORE_EXPORT ISOFairPlayStreamingInitDataBox final : public ISOBox {
+class ISOFairPlayStreamingInitDataBox final : public ISOBox {
 public:
+    WEBCORE_EXPORT ISOFairPlayStreamingInitDataBox();
+    WEBCORE_EXPORT ~ISOFairPlayStreamingInitDataBox();
+
     static FourCC boxTypeName() { return "fpsd"; }
 
     const ISOFairPlayStreamingInfoBox& info() const { return m_info; }
@@ -113,20 +149,23 @@
     const Vector<ISOFairPlayStreamingKeyRequestBox>& requests() const { return m_requests; }
 
 private:
-    bool parse(JSC::DataView&, unsigned& offset) override;
+    bool parse(JSC::DataView&, unsigned& offset) final;
 
     ISOFairPlayStreamingInfoBox m_info;
     Vector<ISOFairPlayStreamingKeyRequestBox> m_requests;
 };
 
-class WEBCORE_EXPORT ISOFairPlayStreamingPsshBox final : public ISOProtectionSystemSpecificHeaderBox {
+class ISOFairPlayStreamingPsshBox final : public ISOProtectionSystemSpecificHeaderBox {
 public:
+    WEBCORE_EXPORT ISOFairPlayStreamingPsshBox();
+    WEBCORE_EXPORT ~ISOFairPlayStreamingPsshBox();
+
     static const Vector<uint8_t>& fairPlaySystemID();
 
     const ISOFairPlayStreamingInitDataBox& initDataBox() { return m_initDataBox; }
 
 private:
-    bool parse(JSC::DataView&, unsigned& offset) override;
+    bool parse(JSC::DataView&, unsigned& offset) final;
 
     ISOFairPlayStreamingInitDataBox m_initDataBox;
 };

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp	2022-01-24 00:55:31 UTC (rev 288426)
@@ -502,11 +502,11 @@
         auto type = peekResult.value().first;
         auto boxLength = peekResult.value().second;
         if (boxLength > view->byteLength()) {
-            ERROR_LOG(LOGIDENTIFIER, "chunk  type = '", type.toString(), "', size = ", (size_t)boxLength, " larger than buffer length!");
+            ERROR_LOG(LOGIDENTIFIER, "chunk  type = '", type, "', size = ", boxLength, " larger than buffer length!");
             continue;
         }
 
-        INFO_LOG(LOGIDENTIFIER, "chunk  type = '", type.toString(), "', size = ", (size_t)boxLength);
+        INFO_LOG(LOGIDENTIFIER, "chunk  type = '", type, "', size = ", boxLength);
 
         do {
             if (m_haveReportedVTTHeader || !formatDescription)

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm	2022-01-24 00:55:31 UTC (rev 288426)
@@ -49,7 +49,7 @@
             if (firstPeriod != notFound)
                 codecString.truncate(firstPeriod);
 
-            auto codecIdentifier = FourCC::fromString(codecString.left(4));
+            auto codecIdentifier = FourCC::fromString(StringView { codecString }.left(4));
             if (codecIdentifier)
                 codecs.append(codecIdentifier.value());
         }

Modified: trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm	2022-01-24 00:55:31 UTC (rev 288426)
@@ -48,7 +48,7 @@
         if (!PAL::isAVFoundationFrameworkAvailable() || !PAL::canLoad_AVFoundation_AVVideoCodecTypeHEVCWithAlpha())
             return std::nullopt;
 
-        auto codecCode = FourCC::fromString(AVVideoCodecTypeHEVCWithAlpha);
+        auto codecCode = FourCC::fromString(String { AVVideoCodecTypeHEVCWithAlpha });
         if (!codecCode)
             return std::nullopt;
 

Modified: trunk/Source/WebCore/platform/graphics/cv/GraphicsContextGLCVCocoa.cpp (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/cv/GraphicsContextGLCVCocoa.cpp	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/cv/GraphicsContextGLCVCocoa.cpp	2022-01-24 00:55:31 UTC (rev 288426)
@@ -585,7 +585,7 @@
         && pixelFormat != kCVPixelFormatType_AGX_420YpCbCr8BiPlanarFullRange
 #endif
         ) {
-        LOG(WebGL, "GraphicsContextGLCVCocoa::copyVideoTextureToPlatformTexture(%p) - Asked to copy an unsupported pixel format ('%s').", this, FourCC(pixelFormat).toString().utf8().data());
+        LOG(WebGL, "GraphicsContextGLCVCocoa::copyVideoTextureToPlatformTexture(%p) - Asked to copy an unsupported pixel format ('%s').", this, FourCC(pixelFormat).string().data());
         return false;
     }
     IOSurfaceRef surface = CVPixelBufferGetIOSurface(image);

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp	2022-01-24 00:55:31 UTC (rev 288426)
@@ -32,6 +32,10 @@
 
 namespace WebCore {
 
+ISOBox::ISOBox() = default;
+ISOBox::~ISOBox() = default;
+ISOBox::ISOBox(const ISOBox&) = default;
+
 ISOBox::PeekResult ISOBox::peekBox(DataView& view, unsigned offset)
 {
     uint64_t size = 0;
@@ -38,7 +42,7 @@
     if (!checkedRead<uint32_t>(size, view, offset, BigEndian))
         return std::nullopt;
 
-    FourCC type = { uint32_t { 0 } };
+    FourCC type;
     if (!checkedRead<uint32_t>(type, view, offset, BigEndian))
         return std::nullopt;
 
@@ -96,6 +100,9 @@
     return true;
 }
 
+ISOFullBox::ISOFullBox() = default;
+ISOFullBox::ISOFullBox(const ISOFullBox&) = default;
+
 bool ISOFullBox::parse(DataView& view, unsigned& offset)
 {
     if (!ISOBox::parse(view, offset))

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOBox.h (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/iso/ISOBox.h	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOBox.h	2022-01-24 00:55:31 UTC (rev 288426)
@@ -36,31 +36,34 @@
 
 namespace WebCore {
 
-class WEBCORE_EXPORT ISOBox {
+class ISOBox {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    virtual ~ISOBox() = default;
+    WEBCORE_EXPORT ISOBox();
+    WEBCORE_EXPORT ISOBox(const ISOBox&);
+    ISOBox(ISOBox&&) = default;
+    WEBCORE_EXPORT virtual ~ISOBox();
 
+    ISOBox& operator=(const ISOBox&) = default;
+    ISOBox& operator=(ISOBox&&) = default;
+
     using PeekResult = std::optional<std::pair<FourCC, uint64_t>>;
     static PeekResult peekBox(JSC::DataView&, unsigned offset);
-    static size_t minimumBoxSize() { return 2 * sizeof(uint32_t); }
+    static constexpr size_t minimumBoxSize() { return 2 * sizeof(uint32_t); }
 
-    bool read(JSC::DataView&);
+    WEBCORE_EXPORT bool read(JSC::DataView&);
     bool read(JSC::DataView&, unsigned& offset);
 
     uint64_t size() const { return m_size; }
-    const FourCC& boxType() const { return m_boxType; }
+    FourCC boxType() const { return m_boxType; }
     const Vector<uint8_t>& extendedType() const { return m_extendedType; }
 
 protected:
     virtual bool parse(JSC::DataView&, unsigned& offset);
 
-    enum Endianness {
-        BigEndian,
-        LittleEndian,
-    };
+    enum Endianness { BigEndian, LittleEndian };
 
-    template <typename T, typename R, typename V>
+    template<typename T, typename R, typename V>
     static bool checkedRead(R& returnValue, V& view, unsigned& offset, Endianness endianness)
     {
         bool readStatus = false;
@@ -76,12 +79,16 @@
     }
 
     uint64_t m_size { 0 };
-    FourCC m_boxType { uint32_t { 0 } };
+    FourCC m_boxType;
     Vector<uint8_t> m_extendedType;
 };
 
-class WEBCORE_EXPORT ISOFullBox : public ISOBox {
+class ISOFullBox : public ISOBox {
 public:
+    WEBCORE_EXPORT ISOFullBox();
+    WEBCORE_EXPORT ISOFullBox(const ISOFullBox&);
+    ISOFullBox(ISOFullBox&&) = default;
+
     uint8_t version() const { return m_version; }
     uint32_t flags() const { return m_flags; }
 

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h	2022-01-24 00:55:31 UTC (rev 288426)
@@ -38,7 +38,7 @@
 private:
     bool parse(JSC::DataView&, unsigned& offset) override;
 
-    FourCC m_dataFormat { uint32_t { 0 } };
+    FourCC m_dataFormat;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h	2022-01-24 00:55:31 UTC (rev 288426)
@@ -39,7 +39,7 @@
 private:
     bool parse(JSC::DataView&, unsigned& offset) override;
 
-    FourCC m_schemeType { uint32_t { 0 } };
+    FourCC m_schemeType;
     uint32_t m_schemeVersion { 0 };
 };
 

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp	2022-01-24 00:55:31 UTC (rev 288426)
@@ -91,6 +91,9 @@
 {
 }
 
+ISOWebVTTCue::ISOWebVTTCue(ISOWebVTTCue&&) = default;
+ISOWebVTTCue::~ISOWebVTTCue() = default;
+
 bool ISOWebVTTCue::parse(DataView& view, unsigned& offset)
 {
     if (!ISOBox::parse(view, offset))
@@ -110,7 +113,7 @@
         else if (stringBox.boxType() == vttPayloadBoxType())
             m_cueText = stringBox.contents();
         else
-            LOG(Media, "ISOWebVTTCue::ISOWebVTTCue - skipping box id = \"%s\", size = %zu", stringBox.boxType().toString().utf8().data(), (size_t)stringBox.size());
+            LOG(Media, "ISOWebVTTCue::ISOWebVTTCue - skipping box id = \"%s\", size = %" PRIu64, stringBox.boxType().string().data(), stringBox.size());
     }
     return true;
 }

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h (288425 => 288426)


--- trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h	2022-01-23 23:10:34 UTC (rev 288425)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h	2022-01-24 00:55:31 UTC (rev 288426)
@@ -39,11 +39,17 @@
 // N bytes : CueSettingsBox : box : optional
 // N bytes : CuePayloadBox : box : required
 
-class WEBCORE_EXPORT ISOWebVTTCue final : public ISOBox {
+class ISOWebVTTCue final : public ISOBox {
 public:
     ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& duration);
-    ISOWebVTTCue(MediaTime&& presentationTime, MediaTime&& duration, String&& cueID, String&& cueText, String&& settings = { }, String&& sourceID = { }, String&& originalStartTime = { });
+    WEBCORE_EXPORT ISOWebVTTCue(MediaTime&& presentationTime, MediaTime&& duration, String&& cueID, String&& cueText, String&& settings = { }, String&& sourceID = { }, String&& originalStartTime = { });
+    ISOWebVTTCue(const ISOWebVTTCue&) = default;
+    WEBCORE_EXPORT ISOWebVTTCue(ISOWebVTTCue&&);
+    WEBCORE_EXPORT ~ISOWebVTTCue();
 
+    ISOWebVTTCue& operator=(const ISOWebVTTCue&) = default;
+    ISOWebVTTCue& operator=(ISOWebVTTCue&&) = default;
+
     static FourCC boxTypeName() { return "vttc"; }
 
     const MediaTime& presentationTime() const { return m_presentationTime; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to