Title: [279019] branches/safari-611-branch/Source
Revision
279019
Author
[email protected]
Date
2021-06-17 15:59:17 -0700 (Thu, 17 Jun 2021)

Log Message

Cherry-pick r278870. rdar://problem/79473993

    [Mac] CoreMedia WrapperClass does not need alignment fixup
    https://bugs.webkit.org/show_bug.cgi?id=226978
    rdar://78864290

    Reviewed by Geoffrey Garen and Dan Bernstein.

    Source/WebCore:

    * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
    (WebCore::WebCoreDecompressionSession::enqueueSample): static_assert CMBufferQueueRef
    callback struct alignment and version size.

    Source/WebKit:

    * Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
    (WebKit::CoreMediaWrapped<Wrapped>::vTable): Don't add padding to WrapperClass,
    it isn't necessary. static_assert CMBaseClass and WrapperClass alignment and
    .version sizes.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278870 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (279018 => 279019)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-06-17 22:46:11 UTC (rev 279018)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-06-17 22:59:17 UTC (rev 279019)
@@ -1,3 +1,41 @@
+2021-06-17  Alan Coon  <[email protected]>
+
+        Cherry-pick r278870. rdar://problem/79473993
+
+    [Mac] CoreMedia WrapperClass does not need alignment fixup
+    https://bugs.webkit.org/show_bug.cgi?id=226978
+    rdar://78864290
+    
+    Reviewed by Geoffrey Garen and Dan Bernstein.
+    
+    Source/WebCore:
+    
+    * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
+    (WebCore::WebCoreDecompressionSession::enqueueSample): static_assert CMBufferQueueRef
+    callback struct alignment and version size.
+    
+    Source/WebKit:
+    
+    * Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
+    (WebKit::CoreMediaWrapped<Wrapped>::vTable): Don't add padding to WrapperClass,
+    it isn't necessary. static_assert CMBaseClass and WrapperClass alignment and
+    .version sizes.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-06-15  Eric Carlson  <[email protected]>
+
+            [Mac] CoreMedia WrapperClass does not need alignment fixup
+            https://bugs.webkit.org/show_bug.cgi?id=226978
+            rdar://78864290
+
+            Reviewed by Geoffrey Garen and Dan Bernstein.
+
+            * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
+            (WebCore::WebCoreDecompressionSession::enqueueSample): static_assert CMBufferQueueRef
+            callback struct alignment and version size.
+
 2021-06-15  Alan Coon  <[email protected]>
 
         Apply patch. rdar://problem/79355311

Modified: branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm (279018 => 279019)


--- branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm	2021-06-17 22:46:11 UTC (rev 279018)
+++ branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm	2021-06-17 22:59:17 UTC (rev 279019)
@@ -128,7 +128,7 @@
     if (!m_producerQueue) {
         CMBufferQueueRef outQueue { nullptr };
 #pragma pack(push, 4)
-        struct { uint8_t pad[padSize]; CMBufferCallbacks callbacks; } callbacks { { }, {
+        struct BufferCallbacks { uint8_t pad[padSize]; CMBufferCallbacks callbacks; } callbacks { { }, {
             0,
             nullptr,
             &getDecodeTime,
@@ -140,6 +140,9 @@
             nullptr,
         } };
 #pragma pack(pop)
+        static_assert(sizeof(callbacks.callbacks.version) == sizeof(uint32_t), "Version field must be 4 bytes");
+        static_assert(alignof(BufferCallbacks) == 4, "CMBufferCallbacks struct must have 4 byte alignment");
+
         CMBufferQueueCreate(kCFAllocatorDefault, kMaximumCapacity, &callbacks.callbacks, &outQueue);
         m_producerQueue = adoptCF(outQueue);
     }
@@ -147,7 +150,7 @@
     if (!m_consumerQueue) {
         CMBufferQueueRef outQueue { nullptr };
 #pragma pack(push, 4)
-        struct { uint8_t pad[padSize]; CMBufferCallbacks callbacks; } callbacks { { }, {
+        struct BufferCallbacks { uint8_t pad[padSize]; CMBufferCallbacks callbacks; } callbacks { { }, {
             0,
             nullptr,
             &getDecodeTime,
@@ -159,6 +162,9 @@
             nullptr,
         } };
 #pragma pack(pop)
+        static_assert(sizeof(callbacks.callbacks.version) == sizeof(uint32_t), "Version field must be 4 bytes");
+        static_assert(alignof(BufferCallbacks) == 4, "CMBufferCallbacks struct alignment must be 4");
+
         CMBufferQueueCreate(kCFAllocatorDefault, kMaximumCapacity, &callbacks.callbacks, &outQueue);
         m_consumerQueue = adoptCF(outQueue);
     }

Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (279018 => 279019)


--- branches/safari-611-branch/Source/WebKit/ChangeLog	2021-06-17 22:46:11 UTC (rev 279018)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog	2021-06-17 22:59:17 UTC (rev 279019)
@@ -1,3 +1,42 @@
+2021-06-17  Alan Coon  <[email protected]>
+
+        Cherry-pick r278870. rdar://problem/79473993
+
+    [Mac] CoreMedia WrapperClass does not need alignment fixup
+    https://bugs.webkit.org/show_bug.cgi?id=226978
+    rdar://78864290
+    
+    Reviewed by Geoffrey Garen and Dan Bernstein.
+    
+    Source/WebCore:
+    
+    * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
+    (WebCore::WebCoreDecompressionSession::enqueueSample): static_assert CMBufferQueueRef
+    callback struct alignment and version size.
+    
+    Source/WebKit:
+    
+    * Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
+    (WebKit::CoreMediaWrapped<Wrapped>::vTable): Don't add padding to WrapperClass,
+    it isn't necessary. static_assert CMBaseClass and WrapperClass alignment and
+    .version sizes.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-06-15  Eric Carlson  <[email protected]>
+
+            [Mac] CoreMedia WrapperClass does not need alignment fixup
+            https://bugs.webkit.org/show_bug.cgi?id=226978
+            rdar://78864290
+
+            Reviewed by Geoffrey Garen and Dan Bernstein.
+
+            * Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
+            (WebKit::CoreMediaWrapped<Wrapped>::vTable): Don't add padding to WrapperClass,
+            it isn't necessary. static_assert CMBaseClass and WrapperClass alignment and
+            .version sizes.
+
 2021-06-15  Alan Coon  <[email protected]>
 
         Apply patch. rdar://problem/78875336

Modified: branches/safari-611-branch/Source/WebKit/Shared/mac/MediaFormatReader/CoreMediaWrapped.h (279018 => 279019)


--- branches/safari-611-branch/Source/WebKit/Shared/mac/MediaFormatReader/CoreMediaWrapped.h	2021-06-17 22:46:11 UTC (rev 279018)
+++ branches/safari-611-branch/Source/WebKit/Shared/mac/MediaFormatReader/CoreMediaWrapped.h	2021-06-17 22:59:17 UTC (rev 279019)
@@ -152,13 +152,23 @@
 
 #pragma pack(push, 4)
     static constexpr struct { uint8_t pad[padSize]; CMBaseClass baseClass; } baseClass { { }, wrapperClass<sizeof(Wrapped)>() };
-    static constexpr struct { uint8_t pad[padSize]; WrapperClass derivedClass; } derivedClass { { }, Wrapped::wrapperClass() };
 #pragma pack(pop)
+    static constexpr WrapperClass derivedClass = Wrapped::wrapperClass();
 
+#if CPU(X86_64)
+    static_assert(sizeof(CMBaseClass::version) != sizeof(void*), "Fig struct fixup is required for CMBaseClass on X86_64");
+    static_assert(sizeof(WrapperClass::version) == sizeof(void*), "Fig struct fixup is not required for WrapperClass on X86_64");
+#else
+    static_assert(sizeof(CMBaseClass::version) == sizeof(void*), "Fig struct fixup only required for CMBaseClass on X86_64");
+    static_assert(sizeof(WrapperClass::version) == sizeof(void*), "Fig struct fixup only required for WrapperClass on X86_64");
+#endif
+    static_assert(alignof(CMBaseClass) == 4, "CMBaseClass must have 4 byte alignment");
+    static_assert(alignof(WrapperClass) == sizeof(void*), "WrapperClass must be natually aligned");
+
 IGNORE_WARNINGS_BEGIN("missing-field-initializers")
     static constexpr WrapperVTable vTable {
         { nullptr, &baseClass.baseClass },
-        &derivedClass.derivedClass,
+        &derivedClass
     };
 IGNORE_WARNINGS_END
     return vTable;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to