Title: [256997] branches/safari-609.1.20.0-branch/Source/WebCore
Revision
256997
Author
alanc...@apple.com
Date
2020-02-19 16:41:55 -0800 (Wed, 19 Feb 2020)

Log Message

Revert r256989. rdar://problem/59298138

Modified Paths

Diff

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/ChangeLog (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/ChangeLog	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/ChangeLog	2020-02-20 00:41:55 UTC (rev 256997)
@@ -1,5 +1,9 @@
 2020-02-19  Alan Coon  <alanc...@apple.com>
 
+        Revert r256989. rdar://problem/59298138
+
+2020-02-19  Alan Coon  <alanc...@apple.com>
+
         Revert r256963. rdar://problem/59478837
 
 2020-02-19  Alan Coon  <alanc...@apple.com>

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/html/HTMLMediaElement.cpp (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/html/HTMLMediaElement.cpp	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/html/HTMLMediaElement.cpp	2020-02-20 00:41:55 UTC (rev 256997)
@@ -274,18 +274,6 @@
     return values[static_cast<size_t>(enumerationValue)];
 }
 
-String convertEnumerationToString(HTMLMediaElement::TextTrackVisibilityCheckType enumerationValue)
-{
-    static const NeverDestroyed<String> values[] = {
-        MAKE_STATIC_STRING_IMPL("CheckTextTrackVisibility"),
-        MAKE_STATIC_STRING_IMPL("AssumeTextTrackVisibilityChanged"),
-    };
-    static_assert(static_cast<size_t>(HTMLMediaElement::TextTrackVisibilityCheckType::CheckTextTrackVisibility) == 0, "TextTrackVisibilityCheckType::CheckTextTrackVisibility is not 0 as expected");
-    static_assert(static_cast<size_t>(HTMLMediaElement::TextTrackVisibilityCheckType::AssumeTextTrackVisibilityChanged) == 1, "TextTrackVisibilityCheckType::AssumeTextTrackVisibilityChanged is not 1 as expected");
-    ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
-    return values[static_cast<size_t>(enumerationValue)];
-}
-
 #if ENABLE(VIDEO_TRACK)
 
 class TrackDisplayUpdateScope {
@@ -6547,7 +6535,7 @@
 #if ENABLE(VIDEO_TRACK)
 void HTMLMediaElement::configureTextTrackDisplay(TextTrackVisibilityCheckType checkType)
 {
-    ALWAYS_LOG(LOGIDENTIFIER, checkType);
+    ALWAYS_LOG(LOGIDENTIFIER);
     ASSERT(m_textTracks);
 
     if (m_processingPreferenceChange)

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/html/HTMLMediaElementEnums.h (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/html/HTMLMediaElementEnums.h	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/html/HTMLMediaElementEnums.h	2020-02-20 00:41:55 UTC (rev 256997)
@@ -47,7 +47,6 @@
 
 String convertEnumerationToString(HTMLMediaElementEnums::ReadyState);
 String convertEnumerationToString(HTMLMediaElementEnums::NetworkState);
-String convertEnumerationToString(HTMLMediaElementEnums::TextTrackVisibilityCheckType);
 
 } // namespace WebCore
 
@@ -72,13 +71,5 @@
     }
 };
 
-template <>
-struct LogArgument<WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType> {
-    static String toString(const WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType type)
-    {
-        return convertEnumerationToString(type);
-    }
-};
-
 }; // namespace WTF
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/html/shadow/MediaControlElements.cpp (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/html/shadow/MediaControlElements.cpp	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/html/shadow/MediaControlElements.cpp	2020-02-20 00:41:55 UTC (rev 256997)
@@ -1092,6 +1092,10 @@
 
 MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Document& document)
     : MediaControlDivElement(document, MediaTextTrackDisplayContainer)
+    , m_updateTimer(*this, &MediaControlTextTrackContainerElement::updateTimerFired)
+    , m_fontSize(0)
+    , m_fontSizeIsImportant(false)
+    , m_updateTextTrackRepresentationStyle(false)
 {
     setPseudo(AtomString("-webkit-media-text-track-container", AtomString::ConstructFromLiteral));
 }
@@ -1200,13 +1204,13 @@
     }
 
     // 11. Return output.
-    if (hasChildNodes())
+    if (hasChildNodes()) {
         show();
-    else
+        updateTextTrackRepresentation();
+    } else {
         hide();
-
-    if (m_textTrackRepresentation || video.requiresTextTrackRepresentation())
-        updateTextTrackRepresentation();
+        clearTextTrackRepresentation();
+    }
 }
 
 void MediaControlTextTrackContainerElement::processActiveVTTCue(VTTCue& cue)
@@ -1288,6 +1292,26 @@
         setInlineStyleProperty(CSSPropertyStrokeWidth, strokeWidth, CSSUnitType::CSS_PX, important);
 }
 
+void MediaControlTextTrackContainerElement::updateTimerFired()
+{
+    if (!document().page())
+        return;
+
+    auto mediaElement = parentMediaElement(this);
+    if (!mediaElement)
+        return;
+
+    for (auto& activeCue : mediaElement->currentlyActiveCues())
+        activeCue.data()->recalculateStyles();
+
+    if (m_textTrackRepresentation)
+        updateStyleForTextTrackRepresentation();
+
+    updateActiveCuesFontSize();
+    updateDisplay();
+    updateTextStrokeStyle();
+}
+
 void MediaControlTextTrackContainerElement::updateTextTrackRepresentation()
 {
     auto mediaElement = parentMediaElement(this);
@@ -1294,33 +1318,24 @@
     if (!mediaElement)
         return;
 
-    auto requiresTextTrackRepresentation = mediaElement->requiresTextTrackRepresentation();
-    if (!hasChildNodes() || !requiresTextTrackRepresentation) {
+    if (!mediaElement->requiresTextTrackRepresentation()) {
         if (m_textTrackRepresentation) {
-            if (!requiresTextTrackRepresentation) {
-                clearTextTrackRepresentation();
-                updateSizes(ForceUpdate::Yes);
-            } else
-                m_textTrackRepresentation->setHidden(true);
+            clearTextTrackRepresentation();
+            updateSizes(ForceUpdate::Yes);
         }
         return;
     }
 
     if (!m_textTrackRepresentation) {
-        ALWAYS_LOG(LOGIDENTIFIER);
-
-        m_waitingForFirstLayout = true;
         m_textTrackRepresentation = TextTrackRepresentation::create(*this);
         if (document().page())
             m_textTrackRepresentation->setContentScale(document().page()->deviceScaleFactor());
+        m_updateTextTrackRepresentationStyle = true;
         mediaElement->setTextTrackRepresentation(m_textTrackRepresentation.get());
-        updateSizes();
-        updateTextTrackRepresentationStyle();
     }
 
-    m_textTrackRepresentation->setHidden(false);
-    if (!m_waitingForFirstLayout)
-        m_textTrackRepresentation->update();
+    m_textTrackRepresentation->update();
+    updateStyleForTextTrackRepresentation();
 }
 
 void MediaControlTextTrackContainerElement::clearTextTrackRepresentation()
@@ -1328,18 +1343,21 @@
     if (!m_textTrackRepresentation)
         return;
 
-    ALWAYS_LOG(LOGIDENTIFIER);
-
-    m_waitingForFirstLayout = true;
     m_textTrackRepresentation = nullptr;
+    m_updateTextTrackRepresentationStyle = true;
     if (auto mediaElement = parentMediaElement(this))
         mediaElement->setTextTrackRepresentation(nullptr);
-    updateTextTrackRepresentationStyle();
+    updateStyleForTextTrackRepresentation();
     updateActiveCuesFontSize();
 }
 
-void MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle()
+void MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation()
 {
+    if (!m_updateTextTrackRepresentationStyle)
+        return;
+
+    m_updateTextTrackRepresentationStyle = false;
+
     if (m_textTrackRepresentation) {
         setInlineStyleProperty(CSSPropertyWidth, m_videoDisplaySize.size().width(), CSSUnitType::CSS_PX);
         setInlineStyleProperty(CSSPropertyHeight, m_videoDisplaySize.size().height(), CSSUnitType::CSS_PX);
@@ -1369,32 +1387,15 @@
     updateSizes(ForceUpdate::Yes);
 }
 
-void MediaControlTextTrackContainerElement::layoutIfNecessary()
+void MediaControlTextTrackContainerElement::updateSizes(ForceUpdate force)
 {
-    m_waitingForFirstLayout = false;
-
-    auto sizeChanged = updateVideoDisplaySize();
-    if (m_textTrackRepresentation)
-        m_textTrackRepresentation->update();
-
-    if (!sizeChanged)
+    auto mediaElement = parentMediaElement(this);
+    if (!mediaElement)
         return;
 
-    // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately.
-    m_taskQueue.enqueueTask([this] () {
-        updateCueStyles();
-    });
-}
-
-bool MediaControlTextTrackContainerElement::updateVideoDisplaySize()
-{
     if (!document().page())
-        return false;
+        return;
 
-    auto mediaElement = parentMediaElement(this);
-    if (!mediaElement)
-        return false;
-
     IntRect videoBox;
     if (m_textTrackRepresentation) {
         videoBox = m_textTrackRepresentation->bounds();
@@ -1403,42 +1404,19 @@
         videoBox.setHeight(videoBox.height() * deviceScaleFactor);
     } else {
         if (!is<RenderVideo>(mediaElement->renderer()))
-            return false;
+            return;
         videoBox = downcast<RenderVideo>(*mediaElement->renderer()).videoBox();
     }
 
-    if (m_videoDisplaySize == videoBox)
-        return false;
+    if (force == ForceUpdate::No && m_videoDisplaySize == videoBox)
+        return;
 
     m_videoDisplaySize = videoBox;
-    updateTextTrackRepresentationStyle();
-
-    return true;
-}
-
-void MediaControlTextTrackContainerElement::updateSizes(ForceUpdate force)
-{
-    if (updateVideoDisplaySize() || force == ForceUpdate::Yes)
-        updateCueStyles();
-}
-
-void MediaControlTextTrackContainerElement::updateCueStyles()
-{
-    if (!document().page())
-        return;
-
-    auto mediaElement = parentMediaElement(this);
-    if (!mediaElement)
-        return;
-
+    m_updateTextTrackRepresentationStyle = true;
     mediaElement->syncTextTrackBounds();
 
-    for (auto& activeCue : mediaElement->currentlyActiveCues())
-        activeCue.data()->recalculateStyles();
-
-    updateActiveCuesFontSize();
-    updateDisplay();
-    updateTextStrokeStyle();
+    // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately.
+    m_updateTimer.startOneShot(0_s);
 }
 
 RefPtr<Image> MediaControlTextTrackContainerElement::createTextTrackRepresentationImage()
@@ -1487,20 +1465,14 @@
 #if !RELEASE_LOG_DISABLED
 const Logger& MediaControlTextTrackContainerElement::logger() const
 {
-    if (!m_logger)
-        m_logger = &document().logger();
-
-    return *m_logger;
+    return document().logger();
 }
 
 const void* MediaControlTextTrackContainerElement::logIdentifier() const
 {
-    if (!m_logIdentifier) {
-        if (auto mediaElement = parentMediaElement(this))
-            m_logIdentifier = mediaElement->logIdentifier();
-    }
-
-    return m_logIdentifier;
+    if (auto mediaElement = parentMediaElement(this))
+        return mediaElement->logIdentifier();
+    return nullptr;
 }
 
 WTFLogChannel& MediaControlTextTrackContainerElement::logChannel() const

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/html/shadow/MediaControlElements.h (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/html/shadow/MediaControlElements.h	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/html/shadow/MediaControlElements.h	2020-02-20 00:41:55 UTC (rev 256997)
@@ -31,7 +31,6 @@
 
 #if ENABLE(VIDEO)
 
-#include "GenericTaskQueue.h"
 #include "MediaControlElementTypes.h"
 #include "TextTrackRepresentation.h"
 #include <wtf/LoggerHelper.h>
@@ -483,7 +482,6 @@
 
     enum class ForceUpdate { Yes, No };
     void updateSizes(ForceUpdate force = ForceUpdate::No);
-    void layoutIfNecessary();
 
     void updateDisplay();
     void enteredFullscreen();
@@ -490,37 +488,34 @@
     void exitedFullscreen();
 
 private:
-    explicit MediaControlTextTrackContainerElement(Document&);
-
-    bool updateVideoDisplaySize();
-    void updateCueStyles();
+    void updateTimerFired();
     void updateActiveCuesFontSize();
     void updateTextStrokeStyle();
     void processActiveVTTCue(VTTCue&);
-    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
 
-    RefPtr<Image> createTextTrackRepresentationImage() override;
-    void textTrackRepresentationBoundsChanged(const IntRect&) override;
-    void updateTextTrackRepresentation();
-    void clearTextTrackRepresentation();
-    void updateTextTrackRepresentationStyle();
-
 #if !RELEASE_LOG_DISABLED
     const Logger& logger() const final;
     const void* logIdentifier() const final;
     WTFLogChannel& logChannel() const final;
     const char* logClassName() const final { return "MediaControlTextTrackContainerElement"; }
-    mutable RefPtr<Logger> m_logger;
-    mutable const void* m_logIdentifier { nullptr };
 #endif
 
+    explicit MediaControlTextTrackContainerElement(Document&);
+
+    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
+
+    RefPtr<Image> createTextTrackRepresentationImage() override;
+    void textTrackRepresentationBoundsChanged(const IntRect&) override;
+    void updateTextTrackRepresentation();
+    void clearTextTrackRepresentation();
+    void updateStyleForTextTrackRepresentation();
     std::unique_ptr<TextTrackRepresentation> m_textTrackRepresentation;
 
-    GenericTaskQueue<Timer> m_taskQueue;
+    Timer m_updateTimer;
     IntRect m_videoDisplaySize;
-    int m_fontSize { 0 };
-    bool m_fontSizeIsImportant { false };
-    bool m_waitingForFirstLayout { true };
+    int m_fontSize;
+    bool m_fontSizeIsImportant;
+    bool m_updateTextTrackRepresentationStyle;
 };
 
 #endif

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp	2020-02-20 00:41:55 UTC (rev 256997)
@@ -36,11 +36,10 @@
 class NullTextTrackRepresentation : public TextTrackRepresentation {
 public:
     virtual ~NullTextTrackRepresentation() = default;
-    void update() final { }
-    PlatformLayer* platformLayer() final { return nullptr; }
-    void setContentScale(float) final { }
-    IntRect bounds() const final { return IntRect(); }
-    void setHidden(bool) const final { }
+    void update() override { }
+    PlatformLayer* platformLayer() override { return nullptr; }
+    void setContentScale(float) override { }
+    IntRect bounds() const override { return IntRect(); }
 };
 
 #if !(PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)))

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/TextTrackRepresentation.h (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/TextTrackRepresentation.h	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/TextTrackRepresentation.h	2020-02-20 00:41:55 UTC (rev 256997)
@@ -55,7 +55,6 @@
     virtual PlatformLayer* platformLayer() = 0;
     virtual void setContentScale(float) = 0;
     virtual IntRect bounds() const = 0;
-    virtual void setHidden(bool) const = 0;
 };
 
 }

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2020-02-20 00:41:55 UTC (rev 256997)
@@ -408,7 +408,7 @@
 
 MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlayer* player)
     : MediaPlayerPrivateAVFoundation(player)
-    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(logger(), logIdentifier()))
+    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>())
     , m_videoFullscreenGravity(MediaPlayer::VideoGravity::ResizeAspect)
     , m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithPlayer:makeWeakPtr(*this)]))
     , m_videoFrameHasDrawn(false)
@@ -1119,7 +1119,6 @@
 
 void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame(FloatRect frame)
 {
-    ALWAYS_LOG(LOGIDENTIFIER, "width = ", frame.size().width(), ", height = ", frame.size().height());
     m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
 }
 
@@ -1589,13 +1588,17 @@
         createImageGenerator();
     ASSERT(m_imageGenerator);
 
+#if !RELEASE_LOG_DISABLED
     MonotonicTime start = MonotonicTime::now();
+#endif
 
     [m_imageGenerator.get() setMaximumSize:CGSize(rect.size())];
     RetainPtr<CGImageRef> rawImage = adoptCF([m_imageGenerator.get() copyCGImageAtTime:CMTimeMakeWithSeconds(time, 600) actualTime:nil error:nil]);
     RetainPtr<CGImageRef> image = adoptCF(CGImageCreateCopyWithColorSpace(rawImage.get(), sRGBColorSpaceRef()));
 
+#if !RELEASE_LOG_DISABLED
     INFO_LOG(LOGIDENTIFIER, "creating image took ", (MonotonicTime::now() - start).seconds());
+#endif
 
     return image;
 }
@@ -2042,7 +2045,9 @@
 
 void MediaPlayerPrivateAVFoundationObjC::updateAudioTracks()
 {
+#if !RELEASE_LOG_DISABLED
     size_t count = m_audioTracks.size();
+#endif
 
     Vector<String> characteristics = player()->preferredAudioCharacteristics();
     if (!m_audibleGroup) {
@@ -2058,12 +2063,16 @@
     for (auto& track : m_audioTracks)
         track->resetPropertiesFromTrack();
 
-    ALWAYS_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_audioTracks.size());
+#if !RELEASE_LOG_DISABLED
+    INFO_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_audioTracks.size());
+#endif
 }
 
 void MediaPlayerPrivateAVFoundationObjC::updateVideoTracks()
 {
+#if !RELEASE_LOG_DISABLED
     size_t count = m_videoTracks.size();
+#endif
 
     determineChangedTracksFromNewTracksAndOldItems(m_cachedTracks.get(), AVMediaTypeVideo, m_videoTracks, &VideoTrackPrivateAVFObjC::create, player(), &MediaPlayer::removeVideoTrack, &MediaPlayer::addVideoTrack);
 
@@ -2078,7 +2087,9 @@
     for (auto& track : m_audioTracks)
         track->resetPropertiesFromTrack();
 
-    ALWAYS_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_videoTracks.size());
+#if !RELEASE_LOG_DISABLED
+    INFO_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_videoTracks.size());
+#endif
 }
 
 bool MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation() const
@@ -2250,11 +2261,15 @@
         m_pixelBufferConformer = makeUnique<PixelBufferConformerCV>((__bridge CFDictionaryRef)attributes);
     }
 
+#if !RELEASE_LOG_DISABLED
     MonotonicTime start = MonotonicTime::now();
+#endif
 
     m_lastImage = m_pixelBufferConformer->createImageFromPixelBuffer(m_lastPixelBuffer.get());
 
+#if !RELEASE_LOG_DISABLED
     INFO_LOG(LOGIDENTIFIER, "creating buffer took ", (MonotonicTime::now() - start).seconds());
+#endif
 #endif // HAVE(CORE_VIDEO)
 }
 
@@ -3470,6 +3485,7 @@
 #endif
             }
 
+#if !RELEASE_LOG_DISABLED
             if (player->logger().willLog(player->logChannel(), WTFLogLevel::Debug) && !([keyPath isEqualToString:@"loadedTimeRanges"] || [keyPath isEqualToString:@"seekableTimeRanges"])) {
                 auto identifier = Logger::LogSiteIdentifier("MediaPlayerPrivateAVFoundation", "observeValueForKeyPath", player->logIdentifier());
 
@@ -3483,6 +3499,7 @@
                 } else
                     player->logger().debug(player->logChannel(), identifier, willChange ? "will" : "did", " change '", [keyPath UTF8String], "'");
             }
+#endif
         });
     });
 }

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2020-02-20 00:41:55 UTC (rev 256997)
@@ -63,7 +63,9 @@
 class MediaPlayerPrivateMediaSourceAVFObjC
     : public CanMakeWeakPtr<MediaPlayerPrivateMediaSourceAVFObjC>
     , public MediaPlayerPrivateInterface
+#if !RELEASE_LOG_DISABLED
     , private LoggerHelper
+#endif
 {
 public:
     explicit MediaPlayerPrivateMediaSourceAVFObjC(MediaPlayer*);
@@ -148,6 +150,7 @@
     const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const;
     bool shouldCheckHardwareSupport() const;
 
+#if !RELEASE_LOG_DISABLED
     const Logger& logger() const final { return m_logger.get(); }
     const char* logClassName() const override { return "MediaPlayerPrivateMediaSourceAVFObjC"; }
     const void* logIdentifier() const final { return reinterpret_cast<const void*>(m_logIdentifier); }
@@ -155,6 +158,7 @@
 
     const void* mediaPlayerLogIdentifier() { return logIdentifier(); }
     const Logger& mediaPlayerLogger() { return logger(); }
+#endif
 
     enum SeekState {
         Seeking,
@@ -323,11 +327,14 @@
     RefPtr<MediaPlaybackTarget> m_playbackTarget;
     bool m_shouldPlayToTarget { false };
 #endif
-    Ref<const Logger> m_logger;
-    const void* m_logIdentifier;
     std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
 
     Ref<EffectiveRateChangedListener> m_effectiveRateChangedListener;
+
+#if !RELEASE_LOG_DISABLED
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
+#endif
 };
 
 String convertEnumerationToString(MediaPlayerPrivateMediaSourceAVFObjC::SeekState);

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2020-02-20 00:41:55 UTC (rev 256997)
@@ -137,10 +137,12 @@
     , m_playing(0)
     , m_seeking(false)
     , m_loadingProgressed(false)
+    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>())
+    , m_effectiveRateChangedListener(EffectiveRateChangedListener::create(*this, [m_synchronizer timebase]))
+#if !RELEASE_LOG_DISABLED
     , m_logger(player->mediaPlayerLogger())
     , m_logIdentifier(player->mediaPlayerLogIdentifier())
-    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(m_logger, m_logIdentifier))
-    , m_effectiveRateChangedListener(EffectiveRateChangedListener::create(*this, [m_synchronizer timebase]))
+#endif
 {
     auto logSiteIdentifier = LOGIDENTIFIER;
     ALWAYS_LOG(logSiteIdentifier);
@@ -1223,10 +1225,12 @@
     return true;
 }
 
+#if !RELEASE_LOG_DISABLED
 WTFLogChannel& MediaPlayerPrivateMediaSourceAVFObjC::logChannel() const
 {
     return LogMediaSource;
 }
+#endif
 
 }
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h	2020-02-20 00:41:55 UTC (rev 256997)
@@ -58,8 +58,10 @@
 class VideoFullscreenLayerManagerObjC;
 class VideoTrackPrivateMediaStream;
 
-class MediaPlayerPrivateMediaStreamAVFObjC final : public MediaPlayerPrivateInterface, private MediaStreamPrivate::Observer, private MediaStreamTrackPrivate::Observer, public SampleBufferDisplayLayer::Client
+class MediaPlayerPrivateMediaStreamAVFObjC final : public CanMakeWeakPtr<MediaPlayerPrivateMediaStreamAVFObjC>, public MediaPlayerPrivateInterface, private MediaStreamPrivate::Observer, private MediaStreamTrackPrivate::Observer
+#if !RELEASE_LOG_DISABLED
     , private LoggerHelper
+#endif
 {
 public:
     explicit MediaPlayerPrivateMediaStreamAVFObjC(MediaPlayer*);
@@ -87,10 +89,12 @@
     PlatformLayer* displayLayer();
     PlatformLayer* backgroundLayer();
 
+#if !RELEASE_LOG_DISABLED
     const Logger& logger() const final { return m_logger.get(); }
     const char* logClassName() const override { return "MediaPlayerPrivateMediaStreamAVFObjC"; }
     const void* logIdentifier() const final { return reinterpret_cast<const void*>(m_logIdentifier); }
     WTFLogChannel& logChannel() const final;
+#endif
 
 private:
     // MediaPlayerPrivateInterface
@@ -257,17 +261,13 @@
     PlaybackState m_playbackState { PlaybackState::None };
     MediaSample::VideoRotation m_videoRotation { MediaSample::VideoRotation::None };
     CGAffineTransform m_videoTransform;
-    std::unique_ptr<SampleBufferDisplayLayer> m_sampleBufferDisplayLayer;
+    std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
 
+#if !RELEASE_LOG_DISABLED
     Ref<const Logger> m_logger;
     const void* m_logIdentifier;
-    std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
+#endif
 
-    // SampleBufferDisplayLayer::Client
-    void sampleBufferDisplayLayerStatusDidChange(SampleBufferDisplayLayer&) final;
-
-    RetainPtr<WebRootSampleBufferBoundsChangeListener> m_boundsChangeListener;
-
     bool m_videoMirrored { false };
     bool m_playing { false };
     bool m_muted { false };

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm	2020-02-20 00:41:55 UTC (rev 256997)
@@ -183,10 +183,11 @@
     : m_player(player)
     , m_statusChangeListener(adoptNS([[WebAVSampleBufferStatusChangeListener alloc] initWithParent:this]))
     , m_clock(PAL::Clock::create())
+    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>())
+#if !RELEASE_LOG_DISABLED
     , m_logger(player->mediaPlayerLogger())
     , m_logIdentifier(player->mediaPlayerLogIdentifier())
-    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(m_logger, m_logIdentifier))
-    , m_boundsChangeListener(adoptNS([[WebRootSampleBufferBoundsChangeListener alloc] initWithParent:this]))
+#endif
 {
     INFO_LOG(LOGIDENTIFIER);
 }
@@ -1213,10 +1214,12 @@
     });
 }
 
+#if !RELEASE_LOG_DISABLED
 WTFLogChannel& MediaPlayerPrivateMediaStreamAVFObjC::logChannel() const
 {
     return LogMedia;
 }
+#endif
 
 }
 

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h	2020-02-20 00:41:55 UTC (rev 256997)
@@ -31,7 +31,6 @@
 #include "VideoFullscreenLayerManager.h"
 #include "WebVideoContainerLayer.h"
 #include <wtf/Function.h>
-#include <wtf/LoggerHelper.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RetainPtr.h>
 
@@ -39,10 +38,10 @@
 
 namespace WebCore {
 
-class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager , public LoggerHelper {
+class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    VideoFullscreenLayerManagerObjC(const Logger&, const void*);
+    VideoFullscreenLayerManagerObjC();
 
     PlatformLayer *videoInlineLayer() const final { return m_videoInlineLayer.get(); }
     PlatformLayer *videoFullscreenLayer() const final { return m_videoFullscreenLayer.get(); }
@@ -58,14 +57,6 @@
     void syncTextTrackBounds() final;
 
 private:
-    const Logger& logger() const final { return m_logger.get(); }
-    const void* logIdentifier() const final { return m_logIdentifier; }
-    const char* logClassName() const final { return "VideoFullscreenLayerManagerObjC"; }
-    WTFLogChannel& logChannel() const final;
-
-    Ref<const Logger> m_logger;
-    const void* m_logIdentifier;
-
     RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
     RetainPtr<WebVideoContainerLayer> m_videoInlineLayer;
     RetainPtr<PlatformLayer> m_videoFullscreenLayer;

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm	2020-02-20 00:41:55 UTC (rev 256997)
@@ -27,7 +27,6 @@
 #import "VideoFullscreenLayerManagerObjC.h"
 
 #import "Color.h"
-#import "Logging.h"
 #import "TextTrackRepresentation.h"
 #import "WebCoreCALayerExtras.h"
 #import <mach/mach_init.h>
@@ -40,17 +39,13 @@
 
 namespace WebCore {
 
-VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC(const Logger& logger, const void* logIdentifier)
+VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC()
     : VideoFullscreenLayerManager()
-    , m_logger(logger)
-    , m_logIdentifier(logIdentifier)
 {
 }
 
 void VideoFullscreenLayerManagerObjC::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize)
 {
-    ALWAYS_LOG(LOGIDENTIFIER, contentSize.width(), ", ", contentSize.height());
-
     m_videoLayer = videoLayer;
     m_videoInlineFrame = CGRectMake(0, 0, contentSize.width(), contentSize.height());
 
@@ -86,8 +81,6 @@
         return;
     }
 
-    ALWAYS_LOG(LOGIDENTIFIER);
-
     m_videoFullscreenLayer = videoFullscreenLayer;
 
     [CATransaction begin];
@@ -128,8 +121,6 @@
 
 void VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame(FloatRect videoFullscreenFrame)
 {
-    ALWAYS_LOG(LOGIDENTIFIER, videoFullscreenFrame.x(), ", ", videoFullscreenFrame.y(), ", ", videoFullscreenFrame.width(), ", ", videoFullscreenFrame.height());
-
     m_videoFullscreenFrame = videoFullscreenFrame;
     if (!m_videoFullscreenLayer)
         return;
@@ -140,8 +131,6 @@
 
 void VideoFullscreenLayerManagerObjC::didDestroyVideoLayer()
 {
-    ALWAYS_LOG(LOGIDENTIFIER);
-
     [m_videoLayer removeFromSuperlayer];
 
     m_videoInlineLayer = nil;
@@ -158,9 +147,6 @@
     if (!m_videoFullscreenLayer || !m_textTrackRepresentationLayer)
         return;
 
-    if (m_textTrackRepresentationLayer.get().bounds == m_videoFullscreenFrame)
-        return;
-
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
 
@@ -171,8 +157,6 @@
 
 void VideoFullscreenLayerManagerObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
 {
-    ALWAYS_LOG(LOGIDENTIFIER);
-
     PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
     if (representationLayer == m_textTrackRepresentationLayer) {
         syncTextTrackBounds();
@@ -196,10 +180,5 @@
 
 }
 
-WTFLogChannel& VideoFullscreenLayerManagerObjC::logChannel() const
-{
-    return LogMedia;
 }
 
-}
-

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.h (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.h	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.h	2020-02-20 00:41:55 UTC (rev 256997)
@@ -28,10 +28,9 @@
 
 #if (PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))) && ENABLE(VIDEO_TRACK)
 
-#include "GenericTaskQueue.h"
-#include "TextTrackRepresentation.h"
-#include <QuartzCore/CALayer.h>
-#include <wtf/RetainPtr.h>
+#import "TextTrackRepresentation.h"
+#import <QuartzCore/CALayer.h>
+#import <wtf/RetainPtr.h>
 
 @class WebCoreTextTrackRepresentationCocoaHelper;
 
@@ -44,17 +43,13 @@
 
     TextTrackRepresentationClient& client() const { return m_client; }
 
-    PlatformLayer* platformLayer() final { return m_layer.get(); }
+    PlatformLayer* platformLayer() override { return m_layer.get(); }
+    IntRect bounds() const override;
 
-    IntRect bounds() const final;
-    void boundsChanged();
-
 private:
-    void update() final;
-    void setContentScale(float) final;
-    void setHidden(bool) const final;
+    void update() override;
+    void setContentScale(float) override;
 
-    GenericTaskQueue<Timer> m_taskQueue;
     TextTrackRepresentationClient& m_client;
     RetainPtr<CALayer> m_layer;
     RetainPtr<WebCoreTextTrackRepresentationCocoaHelper> m_delegate;

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm	2020-02-20 00:41:55 UTC (rev 256997)
@@ -92,7 +92,7 @@
     });
 #else
     if (_parent && [keyPath isEqual:@"bounds"] && object == _parent->platformLayer())
-        _parent->boundsChanged();
+        _parent->client().textTrackRepresentationBoundsChanged(_parent->bounds());
 #endif
 }
 
@@ -137,21 +137,9 @@
     [m_layer.get() setContentsScale:scale];
 }
 
-void TextTrackRepresentationCocoa::setHidden(bool hidden) const
-{
-    [m_layer.get() setHidden:hidden];
-}
-
 IntRect TextTrackRepresentationCocoa::bounds() const
 {
     return enclosingIntRect(FloatRect([m_layer.get() bounds]));
 }
 
-void TextTrackRepresentationCocoa::boundsChanged()
-{
-    m_taskQueue.enqueueTask([this] () {
-        client().textTrackRepresentationBoundsChanged(bounds());
-    });
-}
-
 #endif // (PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))) && ENABLE(VIDEO_TRACK)

Modified: branches/safari-609.1.20.0-branch/Source/WebCore/rendering/RenderMediaControlElements.cpp (256996 => 256997)


--- branches/safari-609.1.20.0-branch/Source/WebCore/rendering/RenderMediaControlElements.cpp	2020-02-20 00:41:50 UTC (rev 256996)
+++ branches/safari-609.1.20.0-branch/Source/WebCore/rendering/RenderMediaControlElements.cpp	2020-02-20 00:41:55 UTC (rev 256997)
@@ -104,7 +104,7 @@
     ASSERT(mediaControlElementType(element()) == MediaTextTrackDisplayContainer);
 
     LayoutStateDisabler layoutStateDisabler(view().frameView().layoutContext());
-    static_cast<MediaControlTextTrackContainerElement*>(element())->layoutIfNecessary();
+    static_cast<MediaControlTextTrackContainerElement*>(element())->updateSizes();
 }
 
 #endif // ENABLE(VIDEO_TRACK)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to