WebKit Bugzilla
Attachment 341893 Details for
Bug 186258
: Simplify and remove some unused video element code (helpful for ARC-compatibility)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186258-20180603222758.patch (text/plain), 63.52 KB, created by
Darin Adler
on 2018-06-03 22:27:59 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-06-03 22:27:59 PDT
Size:
63.52 KB
patch
obsolete
>Subversion Revision: 232461 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 64b0f12a6de55cb72ed70ddca1a2e5dbed50fad5..cdfd612c3c66291b04817c7bf8e24821ddd5e049 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,96 @@ >+2018-06-03 Darin Adler <darin@apple.com> >+ >+ Simplify and remove some unused video element code (helpful for ARC-compatibility) >+ https://bugs.webkit.org/show_bug.cgi?id=186258 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ My main mission was to remove the PlatformMedia struct, which had a union >+ of Objective-C object pointers in it, which doesn't work in ARC. However, I >+ found some other unused code to remove and simple mistakes to fix. >+ >+ * Modules/mediasource/VideoPlaybackQuality.cpp: >+ (WebCore::VideoPlaybackQuality::create): Use unsigned instead of unsigned long, >+ since IDL "unsigned long" really means unsigned. >+ (WebCore::VideoPlaybackQuality::VideoPlaybackQuality): Ditto. >+ * Modules/mediasource/VideoPlaybackQuality.h: Updated for the above. >+ >+ * html/HTMLMediaElement.cpp: >+ (WebCore::HTMLMediaElement::platformMedia const): Deleted. >+ * html/HTMLMediaElement.h: Updated for the above. >+ >+ * platform/graphics/MediaPlayer.cpp: >+ (WebCore::MediaPlayer::MediaPlayer): Moved initialization of many data members >+ to the class definition. >+ (WebCore::MediaPlayer::load): Use nullptr instead of 0. >+ (WebCore::MediaPlayer::platformMedia const): Deleted. >+ (WebCore::MediaPlayer::videoPlaybackQualityMetrics): Updated name of return type. >+ (WebCore::MediaPlayer::avPlayer const): Added. Replaces platformMedia for the one >+ case where it was being used. >+ * platform/graphics/MediaPlayer.h: Removed unneeded includes. Re-sorted things. >+ Updated for the above. Removed PlatformMedia struct and NoPlatformMedia constant. >+ Removed explicit constructor in MediaEngineSupportParameters. Renamed >+ PlatformVideoPlaybackQualityMetrics struct to VideoPlaybackQualityMetrics, >+ removed its constructor, and changed types from unsigned long to unsigned. >+ Un-nested #if statements. Removed some Chromium-specific comments. >+ >+ * platform/graphics/MediaPlayerPrivate.h: Removed unneeded includes and >+ forward declarations. Removed platformMedia. Updated return type for >+ videoPlaybackQualityMetrics. Added avPlayer. >+ >+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: >+ Removed platformMedia. >+ >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: >+ Marked avPlayer final since it now overrides a virtual function. >+ Removed platformMedia. >+ >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMedia const): Deleted. >+ >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: >+ Removed platformMedia. Updated return type for videoPlaybackQualityMetrics. >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformMedia const): Deleted. >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics): >+ Updated return type, changed to use aggregate initialization instead of >+ calling a constructor, and added casts to unsigned. >+ >+ * platform/graphics/cocoa/WebCoreDecompressionSession.h: Switched from >+ unsigned long to unsigned for frame counts and from long to int for >+ quality of service tier. >+ >+ * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: >+ (WebCore::MockMediaPlayerMediaSource::load): Pass two references. >+ (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics): >+ Updated return type. >+ * platform/mock/mediasource/MockMediaPlayerMediaSource.h: Updated for the above. >+ >+ * platform/mock/mediasource/MockMediaSourcePrivate.cpp: >+ (WebCore::MockMediaSourcePrivate::create): Return a Ref, take references. >+ (WebCore::MockMediaSourcePrivate::MockMediaSourcePrivate): Moved most data >+ member initialization into the class definition. Take references. >+ (WebCore::MockMediaSourcePrivate::~MockMediaSourcePrivate): Use a modern for loop. >+ (WebCore::MockMediaSourcePrivate::durationChanged): Update since m_player is a >+ reference. >+ (WebCore::MockMediaSourcePrivate::markEndOfStream): Ditto. >+ (WebCore::MockMediaSourcePrivate::readyState): Ditto. >+ (WebCore::MockMediaSourcePrivate::setReadyState): Ditto. >+ (WebCore::MockMediaSourcePrivate::waitForSeekCompleted): Ditto. >+ (WebCore::MockMediaSourcePrivate::seekCompleted): Ditto. >+ (WebCore::MockMediaSourcePrivate::removeSourceBuffer): Use Vector::removeFirst >+ instead of find/remove pairs. >+ (WebCore::MockMediaSourcePrivate::sourceBufferPrivateDidChangeActiveState): Ditto. >+ (WebCore::MockMediaSourcePrivate::seekToTime): Use modern for loop. >+ (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics): Updated return >+ type, changed to use aggregate initialization instead of calling a constructor. >+ * platform/mock/mediasource/MockMediaSourcePrivate.h: Updated for the above. >+ >+ * platform/mock/mediasource/MockSourceBufferPrivate.cpp: >+ (WebCore::MockSourceBufferPrivate::readyState): Updated since player is now >+ a reference. >+ (WebCore::MockSourceBufferPrivate::setReadyState): Ditto. >+ > 2018-06-03 Michael Catanzaro <mcatanzaro@igalia.com> > > REGRESSION(r232338): [GTK] Broke a few layout tests >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 17a1d447b3257fce8edef02ba685903393507892..e595b7dc13af4d04def8f29f82aada1c3c2d2156 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,43 @@ >+2018-06-03 Darin Adler <darin@apple.com> >+ >+ Simplify and remove some unused video element code (helpful for ARC-compatibility) >+ https://bugs.webkit.org/show_bug.cgi?id=186258 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView/WebVideoFullscreenController.h: Removed some unneeded includes and >+ forward declarations. Also moved all fields into the .mm file. Also removed >+ methods that don't need to be public. >+ >+ * WebView/WebVideoFullscreenController.mm: Added additional includes. Removed >+ #if COMPILER(CLANG) since that's all we use on Mac. Moved fields into an >+ unnamed category in here and also replaced the HUDWindowControllerDelegate >+ with the unnamed category. Removed unused NSWindow category defining the >+ isOnActiveSpace, which is not called anywhere in this file at this time. >+ (-[WebVideoFullscreenController setupVideoOverlay:]): Deleted. Moved the code >+ into setVideoElement. >+ (-[WebVideoFullscreenController windowDidLoad]): Slightly rearranged the code >+ and removed unneeded typecast. >+ (-[WebVideoFullscreenController videoElement]): Updated to not rely on a >+ using statement at the top of the file. >+ (-[WebVideoFullscreenController setVideoElement:]): Added a comment about >+ the many side effects and special considerations that this method that sounds >+ like a setter has. Updated code to use the new MediaPlayer::avPlayer function >+ instead of the old HTMLVideoElement::platformMedia function. Also straightened >+ out the logic a bit and added some FIXME comments about small problems noticed >+ but not fixed. >+ (-[WebVideoFullscreenController delegate]): Deleted. Was never called. >+ (-[WebVideoFullscreenController setDelegate:]): Deleted. Was never called. >+ (-[WebVideoFullscreenController windowDidExitFullscreen]): Removed unneeded >+ typecast. Removed call to updatePowerAssertions method. >+ (-[WebVideoFullscreenController windowDidEnterFullscreen]): Removed call to >+ updatePowerAssertions method. >+ (-[WebVideoFullscreenController updatePowerAssertions]): Deleted. This method >+ set _displaySleepEnabler to nullptr, but nothing was ever setting it to anything >+ else, so this was dead code that did nothing. >+ (-[WebVideoFullscreenController rateChanged:]): Removed call to >+ updatePowerAssertions method. >+ > 2018-06-02 Darin Adler <darin@apple.com> > > [Cocoa] Update some code to be more ARC-compatible to prepare for future ARC adoption >diff --git a/Source/WebCore/Modules/mediasource/VideoPlaybackQuality.cpp b/Source/WebCore/Modules/mediasource/VideoPlaybackQuality.cpp >index f19561f303ce6dc814d190b523dcf5e62b315c5e..ac7498c7b91c5f23f6eeef90e5b01e6aae30a0ed 100644 >--- a/Source/WebCore/Modules/mediasource/VideoPlaybackQuality.cpp >+++ b/Source/WebCore/Modules/mediasource/VideoPlaybackQuality.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2013 Apple Inc. All rights reserved. >+ * Copyright (C) 2013-2018 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,12 +28,12 @@ > > namespace WebCore { > >-Ref<VideoPlaybackQuality> VideoPlaybackQuality::create(double creationTime, unsigned long totalVideoFrames, unsigned long droppedVideoFrames, unsigned long corruptedVideoFrames, double totalFrameDelay) >+Ref<VideoPlaybackQuality> VideoPlaybackQuality::create(double creationTime, unsigned totalVideoFrames, unsigned droppedVideoFrames, unsigned corruptedVideoFrames, double totalFrameDelay) > { > return adoptRef(*new VideoPlaybackQuality(creationTime, totalVideoFrames, droppedVideoFrames, corruptedVideoFrames, totalFrameDelay)); > } > >-VideoPlaybackQuality::VideoPlaybackQuality(double creationTime, unsigned long totalVideoFrames, unsigned long droppedVideoFrames, unsigned long corruptedVideoFrames, double totalFrameDelay) >+VideoPlaybackQuality::VideoPlaybackQuality(double creationTime, unsigned totalVideoFrames, unsigned droppedVideoFrames, unsigned corruptedVideoFrames, double totalFrameDelay) > : m_creationTime(creationTime) > , m_totalVideoFrames(totalVideoFrames) > , m_droppedVideoFrames(droppedVideoFrames) >diff --git a/Source/WebCore/Modules/mediasource/VideoPlaybackQuality.h b/Source/WebCore/Modules/mediasource/VideoPlaybackQuality.h >index e92ac92e5e2b49e23b17d3e8b631d50c1243a66a..bb9516d2ad88b72c3d121a4464d552d28d338969 100644 >--- a/Source/WebCore/Modules/mediasource/VideoPlaybackQuality.h >+++ b/Source/WebCore/Modules/mediasource/VideoPlaybackQuality.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2013 Apple Inc. All rights reserved. >+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -33,21 +33,21 @@ namespace WebCore { > class VideoPlaybackQuality : public RefCounted<VideoPlaybackQuality> { > WTF_MAKE_NONCOPYABLE(VideoPlaybackQuality) > public: >- static Ref<VideoPlaybackQuality> create(double creationTime, unsigned long totalVideoFrames, unsigned long droppedVideoFrames, unsigned long corruptedVideoFrames, double totalFrameDelay); >+ static Ref<VideoPlaybackQuality> create(double creationTime, unsigned totalVideoFrames, unsigned droppedVideoFrames, unsigned corruptedVideoFrames, double totalFrameDelay); > > double creationTime() const { return m_creationTime; } >- unsigned long totalVideoFrames() const { return m_totalVideoFrames; } >- unsigned long droppedVideoFrames() const { return m_droppedVideoFrames; } >- unsigned long corruptedVideoFrames() const { return m_corruptedVideoFrames; } >+ unsigned totalVideoFrames() const { return m_totalVideoFrames; } >+ unsigned droppedVideoFrames() const { return m_droppedVideoFrames; } >+ unsigned corruptedVideoFrames() const { return m_corruptedVideoFrames; } > double totalFrameDelay() const { return m_totalFrameDelay; } > >-protected: >- VideoPlaybackQuality(double creationTime, unsigned long totalVideoFrames, unsigned long droppedVideoFrames, unsigned long corruptedVideoFrames, double totalFrameDelay); >+private: >+ VideoPlaybackQuality(double creationTime, unsigned totalVideoFrames, unsigned droppedVideoFrames, unsigned corruptedVideoFrames, double totalFrameDelay); > > double m_creationTime; >- unsigned long m_totalVideoFrames; >- unsigned long m_droppedVideoFrames; >- unsigned long m_corruptedVideoFrames; >+ unsigned m_totalVideoFrames; >+ unsigned m_droppedVideoFrames; >+ unsigned m_corruptedVideoFrames; > double m_totalFrameDelay; > }; > >diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp >index 1dc7cb4de27f4ecc1294d31d977a4f030e3da4ee..1fd124ffed85f6118b64bfddaf0c2843831d11c9 100644 >--- a/Source/WebCore/html/HTMLMediaElement.cpp >+++ b/Source/WebCore/html/HTMLMediaElement.cpp >@@ -6023,11 +6023,6 @@ void HTMLMediaElement::willStopBeingFullscreenElement() > fullscreenModeChanged(VideoFullscreenModeNone); > } > >-PlatformMedia HTMLMediaElement::platformMedia() const >-{ >- return m_player ? m_player->platformMedia() : NoPlatformMedia; >-} >- > PlatformLayer* HTMLMediaElement::platformLayer() const > { > return m_player ? m_player->platformLayer() : nullptr; >diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h >index e2f8ef424eceeb2f413b665f63dfd1aa12c4429e..237c360c3a8023a34240bfd390d1f555489a77bd 100644 >--- a/Source/WebCore/html/HTMLMediaElement.h >+++ b/Source/WebCore/html/HTMLMediaElement.h >@@ -171,7 +171,6 @@ public: > > bool doesHaveAttribute(const AtomicString&, AtomicString* value = nullptr) const override; > >- WEBCORE_EXPORT PlatformMedia platformMedia() const; > PlatformLayer* platformLayer() const; > bool isVideoLayerInline(); > void setPreparedToReturnVideoLayerToInline(bool); >diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp >index 50a36accd5f287fb747f72d6d4bc6db94997527a..3b714ed6cda73161fea71742af395a90b0b24a21 100644 >--- a/Source/WebCore/platform/graphics/MediaPlayer.cpp >+++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007-2015 Apple Inc. All rights reserved. >+ * Copyright (C) 2007-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -24,9 +24,9 @@ > */ > > #include "config.h" >+#include "MediaPlayer.h" > > #if ENABLE(VIDEO) >-#include "MediaPlayer.h" > > #include "ContentType.h" > #include "DeprecatedGlobalSettings.h" >@@ -86,8 +86,6 @@ > > namespace WebCore { > >-const PlatformMedia NoPlatformMedia = { PlatformMedia::None, {0} }; >- > #if !RELEASE_LOG_DISABLED > static RefPtr<Logger>& nullLogger() > { >@@ -115,7 +113,6 @@ public: > void play() override { } > void pause() override { } > >- PlatformMedia platformMedia() const override { return NoPlatformMedia; } > PlatformLayer* platformLayer() const override { return 0; } > > FloatSize naturalSize() const override { return FloatSize(); } >@@ -352,15 +349,6 @@ MediaPlayer::MediaPlayer(MediaPlayerClient& client) > : m_client(&client) > , m_reloadTimer(*this, &MediaPlayer::reloadTimerFired) > , m_private(std::make_unique<NullMediaPlayerPrivate>(this)) >- , m_currentMediaEngine(0) >- , m_preload(Auto) >- , m_visible(false) >- , m_volume(1.0f) >- , m_muted(false) >- , m_preservesPitch(true) >- , m_privateBrowsing(false) >- , m_shouldPrepareToRender(false) >- , m_contentMIMETypeWasInferredFromExtension(false) > { > } > >@@ -412,7 +400,7 @@ bool MediaPlayer::load(const URL& url, const ContentType& contentType, const Str > } > } > >- loadWithNextMediaEngine(0); >+ loadWithNextMediaEngine(nullptr); > return m_currentMediaEngine; > } > >@@ -427,7 +415,7 @@ bool MediaPlayer::load(const URL& url, const ContentType& contentType, MediaSour > m_url = url; > m_keySystem = emptyString(); > m_contentMIMETypeWasInferredFromExtension = false; >- loadWithNextMediaEngine(0); >+ loadWithNextMediaEngine(nullptr); > return m_currentMediaEngine; > } > #endif >@@ -441,7 +429,7 @@ bool MediaPlayer::load(MediaStreamPrivate& mediaStream) > m_keySystem = emptyString(); > m_contentType = { }; > m_contentMIMETypeWasInferredFromExtension = false; >- loadWithNextMediaEngine(0); >+ loadWithNextMediaEngine(nullptr); > return m_currentMediaEngine; > } > #endif >@@ -571,6 +559,7 @@ void MediaPlayer::setShouldBufferData(bool shouldBuffer) > } > > #if ENABLE(LEGACY_ENCRYPTED_MEDIA) >+ > std::unique_ptr<LegacyCDMSession> MediaPlayer::createSession(const String& keySystem, LegacyCDMSessionClient* client) > { > return m_private->createSession(keySystem, client); >@@ -585,9 +574,11 @@ void MediaPlayer::keyAdded() > { > m_private->keyAdded(); > } >+ > #endif > > #if ENABLE(ENCRYPTED_MEDIA) >+ > void MediaPlayer::cdmInstanceAttached(CDMInstance& instance) > { > m_private->cdmInstanceAttached(instance); >@@ -602,6 +593,7 @@ void MediaPlayer::attemptToDecryptWithInstance(CDMInstance& instance) > { > m_private->attemptToDecryptWithInstance(instance); > } >+ > #endif > > MediaTime MediaPlayer::duration() const >@@ -689,17 +681,13 @@ bool MediaPlayer::inMediaDocument() const > return m_visible && client().mediaPlayerIsInMediaDocument(); > } > >-PlatformMedia MediaPlayer::platformMedia() const >-{ >- return m_private->platformMedia(); >-} >- > PlatformLayer* MediaPlayer::platformLayer() const > { > return m_private->platformLayer(); > } > > #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) >+ > void MediaPlayer::setVideoFullscreenLayer(PlatformLayer* layer, WTF::Function<void()>&& completionHandler) > { > m_private->setVideoFullscreenLayer(layer, WTFMove(completionHandler)); >@@ -729,9 +717,11 @@ MediaPlayer::VideoFullscreenMode MediaPlayer::fullscreenMode() const > { > return client().mediaPlayerFullscreenMode(); > } >+ > #endif > > #if PLATFORM(IOS) >+ > NSArray* MediaPlayer::timedMetadata() const > { > return m_private->timedMetadata(); >@@ -746,6 +736,7 @@ String MediaPlayer::errorLog() const > { > return m_private->errorLog(); > } >+ > #endif > > MediaPlayer::NetworkState MediaPlayer::networkState() >@@ -944,6 +935,7 @@ bool MediaPlayer::supportsPictureInPicture() const > } > > #if USE(NATIVE_FULLSCREEN_VIDEO) >+ > void MediaPlayer::enterFullscreen() > { > m_private->enterFullscreen(); >@@ -953,9 +945,11 @@ void MediaPlayer::exitFullscreen() > { > m_private->exitFullscreen(); > } >+ > #endif > > #if ENABLE(WIRELESS_PLAYBACK_TARGET) >+ > bool MediaPlayer::isCurrentPlaybackTargetWireless() const > { > return m_private->isCurrentPlaybackTargetWireless(); >@@ -1000,6 +994,7 @@ void MediaPlayer::setShouldPlayToPlaybackTarget(bool shouldPlay) > { > m_private->setShouldPlayToPlaybackTarget(shouldPlay); > } >+ > #endif > > double MediaPlayer::maxFastForwardRate() const >@@ -1013,10 +1008,12 @@ double MediaPlayer::minFastReverseRate() const > } > > #if USE(NATIVE_FULLSCREEN_VIDEO) >+ > bool MediaPlayer::canEnterFullscreen() const > { > return m_private->canEnterFullscreen(); > } >+ > #endif > > void MediaPlayer::acceleratedRenderingStateChanged() >@@ -1223,13 +1220,16 @@ void MediaPlayer::characteristicChanged() > } > > #if ENABLE(WEB_AUDIO) >+ > AudioSourceProvider* MediaPlayer::audioSourceProvider() > { > return m_private->audioSourceProvider(); > } >-#endif // WEB_AUDIO >+ >+#endif > > #if ENABLE(LEGACY_ENCRYPTED_MEDIA) >+ > RefPtr<ArrayBuffer> MediaPlayer::cachedKeyForKeyId(const String& keyId) const > { > return client().mediaPlayerCachedKeyForKeyId(keyId); >@@ -1244,13 +1244,16 @@ String MediaPlayer::mediaKeysStorageDirectory() const > { > return client().mediaPlayerMediaKeysStorageDirectory(); > } >+ > #endif > > #if ENABLE(ENCRYPTED_MEDIA) >+ > void MediaPlayer::initializationDataEncountered(const String& initDataType, RefPtr<ArrayBuffer>&& initData) > { > client().mediaPlayerInitializationDataEncountered(initDataType, WTFMove(initData)); > } >+ > #endif > > String MediaPlayer::referrer() const >@@ -1425,7 +1428,7 @@ bool MediaPlayer::ended() const > } > > #if ENABLE(MEDIA_SOURCE) >-std::optional<PlatformVideoPlaybackQualityMetrics> MediaPlayer::videoPlaybackQualityMetrics() >+std::optional<VideoPlaybackQualityMetrics> MediaPlayer::videoPlaybackQualityMetrics() > { > if (!m_private) > return std::nullopt; >@@ -1502,6 +1505,15 @@ void MediaPlayer::applicationDidBecomeActive() > m_private->applicationDidBecomeActive(); > } > >+#if ENABLE(VIDEO) && USE(AVFOUNDATION) >+ >+AVPlayer* MediaPlayer::avPlayer() const >+{ >+ return m_private->avPlayer(); >+} >+ >+#endif >+ > #if !RELEASE_LOG_DISABLED > const Logger& MediaPlayer::mediaPlayerLogger() > { >diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h >index f6a1dc369ffe84cdf12ac37c52b5896def455a8a..f4c772069782fca9e9c6ff37e9e7336f1f9a2bc5 100644 >--- a/Source/WebCore/platform/graphics/MediaPlayer.h >+++ b/Source/WebCore/platform/graphics/MediaPlayer.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007-2014 Apple Inc. All rights reserved. >+ * Copyright (C) 2007-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -26,12 +26,11 @@ > #pragma once > > #if ENABLE(VIDEO) >-#include "GraphicsTypes3D.h" > > #include "AudioTrackPrivate.h" > #include "ContentType.h" >+#include "GraphicsTypes3D.h" > #include "InbandTextTrackPrivate.h" >-#include "IntRect.h" > #include "LayoutRect.h" > #include "LegacyCDMSession.h" > #include "MediaPlayerEnums.h" >@@ -44,14 +43,10 @@ > #include "URL.h" > #include "VideoTrackPrivate.h" > #include <JavaScriptCore/Uint8Array.h> >-#include <wtf/Forward.h> > #include <wtf/Function.h> > #include <wtf/HashSet.h> > #include <wtf/Logger.h> > #include <wtf/MediaTime.h> >-#include <wtf/Noncopyable.h> >-#include <wtf/Ref.h> >-#include <wtf/RefCounted.h> > #include <wtf/WallTime.h> > #include <wtf/text/StringHash.h> > >@@ -59,62 +54,31 @@ > #include "PlatformTextTrack.h" > #endif > >-OBJC_CLASS AVAsset; > OBJC_CLASS AVPlayer; > OBJC_CLASS NSArray; >-OBJC_CLASS QTMovie; >- >-class AVCFPlayer; >-class QTMovieGWorld; >-class QTMovieVisualContext; > > namespace WebCore { > > class AudioSourceProvider; >-class AuthenticationChallenge; >-#if ENABLE(ENCRYPTED_MEDIA) > class CDMInstance; >-#endif >+class CachedResourceLoader; >+class GraphicsContext3D; >+class GraphicsContext; >+class LegacyCDMSessionClient; > class MediaPlaybackTarget; >-#if ENABLE(MEDIA_SOURCE) >+class MediaPlayer; >+class MediaPlayerPrivateInterface; >+class MediaPlayerRequestInstallMissingPluginsCallback; > class MediaSourcePrivateClient; >-#endif >-#if ENABLE(MEDIA_STREAM) > class MediaStreamPrivate; >-#endif >-class MediaPlayerPrivateInterface; >+class PlatformTimeRanges; > class TextTrackRepresentation; >-struct Cookie; > >-// Structure that will hold every native >-// types supported by the current media player. >-// We have to do that has multiple media players >-// backend can live at runtime. >-struct PlatformMedia { >- enum { >- None, >- QTMovieType, >- QTMovieGWorldType, >- QTMovieVisualContextType, >- AVFoundationMediaPlayerType, >- AVFoundationCFMediaPlayerType, >- AVFoundationAssetType, >- } type; >- >- union { >- QTMovie* qtMovie; >- QTMovieGWorld* qtMovieGWorld; >- QTMovieVisualContext* qtMovieVisualContext; >- AVPlayer* avfMediaPlayer; >- AVCFPlayer* avcfMediaPlayer; >- AVAsset* avfAsset; >- } media; >-}; >+struct Cookie; >+struct GraphicsDeviceAdapter; >+struct MediaPlayerFactory; > > struct MediaEngineSupportParameters { >- >- MediaEngineSupportParameters() = default; >- > ContentType type; > URL url; > bool isMediaSource { false }; >@@ -122,43 +86,13 @@ struct MediaEngineSupportParameters { > Vector<ContentType> contentTypesRequiringHardwareSupport; > }; > >-struct PlatformVideoPlaybackQualityMetrics { >- PlatformVideoPlaybackQualityMetrics(unsigned long totalVideoFrames, unsigned long droppedVideoFrames, unsigned long corruptedVideoFrames, double totalFrameDelay) >- : totalVideoFrames(totalVideoFrames) >- , droppedVideoFrames(droppedVideoFrames) >- , corruptedVideoFrames(corruptedVideoFrames) >- , totalFrameDelay(totalFrameDelay) >- { >- } >- >- unsigned long totalVideoFrames; >- unsigned long droppedVideoFrames; >- unsigned long corruptedVideoFrames; >+struct VideoPlaybackQualityMetrics { >+ unsigned totalVideoFrames; >+ unsigned droppedVideoFrames; >+ unsigned corruptedVideoFrames; > double totalFrameDelay; > }; > >-extern const PlatformMedia NoPlatformMedia; >- >-class LegacyCDMSessionClient; >-class CachedResourceLoader; >-class ContentType; >-class GraphicsContext; >-class GraphicsContext3D; >-class IntRect; >-class IntSize; >-class MediaPlayer; >-class PlatformTimeRanges; >- >-struct MediaPlayerFactory; >- >-#if PLATFORM(WIN) && USE(AVFOUNDATION) >-struct GraphicsDeviceAdapter; >-#endif >- >-#if USE(GSTREAMER) >-class MediaPlayerRequestInstallMissingPluginsCallback; >-#endif >- > class MediaPlayerClient { > public: > virtual ~MediaPlayerClient() = default; >@@ -224,7 +158,7 @@ public: > virtual void mediaPlayerActiveSourceBuffersChanged(const MediaPlayer*) { } > > #if PLATFORM(WIN) && USE(AVFOUNDATION) >- virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const { return 0; } >+ virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const { return nullptr; } > #endif > > #if ENABLE(LEGACY_ENCRYPTED_MEDIA) >@@ -256,9 +190,9 @@ public: > virtual bool mediaPlayerPlatformVolumeConfigurationRequired() const { return false; } > virtual bool mediaPlayerIsPaused() const { return true; } > virtual bool mediaPlayerIsLooping() const { return false; } >- virtual CachedResourceLoader* mediaPlayerCachedResourceLoader() { return 0; } >+ virtual CachedResourceLoader* mediaPlayerCachedResourceLoader() { return nullptr; } > virtual RefPtr<PlatformMediaResourceLoader> mediaPlayerCreateResourceLoader() { return nullptr; } >- virtual bool doesHaveAttribute(const AtomicString&, AtomicString* = 0) const { return false; } >+ virtual bool doesHaveAttribute(const AtomicString&, AtomicString* = nullptr) const { return false; } > virtual bool mediaPlayerShouldUsePersistentCache() const { return true; } > virtual const String& mediaPlayerMediaCacheDirectory() const { return emptyString(); } > >@@ -271,15 +205,17 @@ public: > virtual void mediaPlayerDidRemoveVideoTrack(VideoTrackPrivate&) { } > > virtual void textTrackRepresentationBoundsChanged(const IntRect&) { } >-#if ENABLE(AVF_CAPTIONS) >- virtual Vector<RefPtr<PlatformTextTrack>> outOfBandTrackSources() { return Vector<RefPtr<PlatformTextTrack>>(); } > #endif >+ >+#if ENABLE(VIDEO_TRACK) && ENABLE(AVF_CAPTIONS) >+ virtual Vector<RefPtr<PlatformTextTrack>> outOfBandTrackSources() { return Vector<RefPtr<PlatformTextTrack>>(); } > #endif > > #if PLATFORM(IOS) > virtual String mediaPlayerNetworkInterfaceName() const { return String(); } > virtual bool mediaPlayerGetRawCookies(const URL&, Vector<Cookie>&) const { return false; } > #endif >+ > virtual void mediaPlayerHandlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType) { } > > virtual String mediaPlayerSourceApplicationIdentifier() const { return emptyString(); } >@@ -329,7 +265,6 @@ public: > bool canSaveMediaData() const; > bool requiresImmediateCompositing() const; > bool doesHaveAttribute(const AtomicString&, AtomicString* value = nullptr) const; >- PlatformMedia platformMedia() const; > PlatformLayer* platformLayer() const; > > #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) >@@ -443,10 +378,6 @@ public: > // The destination texture may need to be resized to to the dimensions of the source texture or re-defined to the required internalFormat. > // The current restrictions require that format shoud be RGB or RGBA, type should be UNSIGNED_BYTE and level should be 0. It may be lifted in the future. > >- // Each platform port can have its own implementation on this function. The default implementation for it is a single "return false" in MediaPlayerPrivate.h. >- // In chromium, the implementation is based on GL_CHROMIUM_copy_texture extension which is documented at >- // http://src.chromium.org/viewvc/chrome/trunk/src/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt and implemented at >- // http://src.chromium.org/viewvc/chrome/trunk/src/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc via shaders. > bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject texture, GC3Denum target, GC3Dint level, GC3Denum internalFormat, GC3Denum format, GC3Denum type, bool premultiplyAlpha, bool flipY); > > NativeImagePtr nativeImageForCurrentTime(); >@@ -579,11 +510,12 @@ public: > void setTextTrackRepresentation(TextTrackRepresentation*); > void syncTextTrackBounds(); > void tracksChanged(); >-#if ENABLE(AVF_CAPTIONS) >+#endif >+ >+#if ENABLE(VIDEO_TRACK) && ENABLE(AVF_CAPTIONS) > void notifyTrackModeChanged(); > Vector<RefPtr<PlatformTextTrack>> outOfBandTrackSources(); > #endif >-#endif > > #if PLATFORM(IOS) > String mediaPlayerNetworkInterfaceName() const; >@@ -606,7 +538,7 @@ public: > unsigned long long fileSize() const; > > #if ENABLE(MEDIA_SOURCE) >- std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); >+ std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); > #endif > > void handlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType); >@@ -633,6 +565,10 @@ public: > void applicationWillResignActive(); > void applicationDidBecomeActive(); > >+#if ENABLE(VIDEO) && USE(AVFOUNDATION) >+ WEBCORE_EXPORT AVPlayer *avPlayer() const; >+#endif >+ > private: > MediaPlayer(MediaPlayerClient&); > >@@ -643,19 +579,19 @@ private: > MediaPlayerClient* m_client; > Timer m_reloadTimer; > std::unique_ptr<MediaPlayerPrivateInterface> m_private; >- const MediaPlayerFactory* m_currentMediaEngine; >+ const MediaPlayerFactory* m_currentMediaEngine { nullptr }; > URL m_url; > ContentType m_contentType; > String m_keySystem; > IntSize m_size; >- Preload m_preload; >- bool m_visible; >- double m_volume; >- bool m_muted; >- bool m_preservesPitch; >- bool m_privateBrowsing; >- bool m_shouldPrepareToRender; >- bool m_contentMIMETypeWasInferredFromExtension; >+ Preload m_preload { Auto }; >+ bool m_visible { false }; >+ double m_volume { 1 }; >+ bool m_muted { false }; >+ bool m_preservesPitch { true }; >+ bool m_privateBrowsing { false }; >+ bool m_shouldPrepareToRender { false }; >+ bool m_contentMIMETypeWasInferredFromExtension { false }; > bool m_initializingMediaEngine { false }; > > #if ENABLE(MEDIA_SOURCE) >diff --git a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h >index f660361107491695e7395ee2fe9c1429a1f53407..0b678d39d3e68e1c1291692062cfe1f8188707d7 100644 >--- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h >+++ b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2009-2014 Apple Inc. All rights reserved. >+ * Copyright (C) 2009-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -23,23 +23,15 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef MediaPlayerPrivate_h >-#define MediaPlayerPrivate_h >+#pragma once > > #if ENABLE(VIDEO) > > #include "MediaPlayer.h" > #include "PlatformTimeRanges.h" >-#include <wtf/Function.h> >-#include <wtf/Forward.h> > > namespace WebCore { > >-class IntRect; >-class IntSize; >-class MediaPlaybackTarget; >-class PlatformTextTrack; >- > class MediaPlayerPrivateInterface { > WTF_MAKE_NONCOPYABLE(MediaPlayerPrivateInterface); WTF_MAKE_FAST_ALLOCATED; > public: >@@ -56,7 +48,6 @@ public: > virtual void cancelLoad() = 0; > > virtual void prepareToPlay() { } >- virtual PlatformMedia platformMedia() const { return NoPlatformMedia; } > virtual PlatformLayer* platformLayer() const { return 0; } > > #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) >@@ -274,7 +265,7 @@ public: > virtual bool ended() const { return false; } > > #if ENABLE(MEDIA_SOURCE) >- virtual std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() { return std::nullopt; } >+ virtual std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() { return std::nullopt; } > #endif > > #if ENABLE(AVF_CAPTIONS) >@@ -287,9 +278,12 @@ public: > > virtual void applicationWillResignActive() { } > virtual void applicationDidBecomeActive() { } >+ >+#if ENABLE(VIDEO) && USE(AVFOUNDATION) >+ virtual AVPlayer *avPlayer() const { return nullptr; } >+#endif > }; > > } > > #endif >-#endif >diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >index 110a99c24289da9c211c8ff7a0577e41c2b524d7..703f35dfd0d2015c11ef3f0ee52d29b6d9d81a73 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >+++ b/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h >@@ -172,7 +172,6 @@ protected: > void cancelLoad() override = 0; > > void prepareToPlay() override; >- PlatformMedia platformMedia() const override = 0; > > void play() override; > void pause() override; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >index f464703cf97f48a491eb0c90597b3c67adf1fb14..ffe2a942cab47042163cbb0f4613d75987dd63e3 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2011-2014 Apple Inc. All rights reserved. >+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -23,8 +23,7 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef MediaPlayerPrivateAVFoundationObjC_h >-#define MediaPlayerPrivateAVFoundationObjC_h >+#pragma once > > #if ENABLE(VIDEO) && USE(AVFOUNDATION) > >@@ -37,7 +36,6 @@ OBJC_CLASS AVAssetImageGenerator; > OBJC_CLASS AVAssetResourceLoadingRequest; > OBJC_CLASS AVMediaSelectionGroup; > OBJC_CLASS AVOutputContext; >-OBJC_CLASS AVPlayer; > OBJC_CLASS AVPlayerItem; > OBJC_CLASS AVPlayerItemLegibleOutput; > OBJC_CLASS AVPlayerItemTrack; >@@ -94,7 +92,7 @@ public: > void processCue(NSArray *, NSArray *, const MediaTime&); > void flushCues(); > #endif >- AVPlayer *avPlayer() const { return m_avPlayer.get(); } >+ AVPlayer *avPlayer() const final { return m_avPlayer.get(); } > > #if HAVE(AVFOUNDATION_LOADER_DELEGATE) > bool shouldWaitForLoadingOfResource(AVAssetResourceLoadingRequest*); >@@ -170,8 +168,6 @@ private: > > void cancelLoad() override; > >- PlatformMedia platformMedia() const override; >- > void platformSetVisible(bool) override; > void platformPlay() override; > void platformPause() override; >@@ -436,4 +432,3 @@ private: > } > > #endif >-#endif >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >index 84a19bf1e3694fd08ed2be53d762c15a4469b511..d7316e0fdc5d3dca297350b7b94dc267f34ff488 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >@@ -1154,15 +1154,6 @@ MediaPlayerPrivateAVFoundation::ItemStatus MediaPlayerPrivateAVFoundationObjC::p > return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusReadyToPlay; > } > >-PlatformMedia MediaPlayerPrivateAVFoundationObjC::platformMedia() const >-{ >- INFO_LOG(LOGIDENTIFIER); >- PlatformMedia pm; >- pm.type = PlatformMedia::AVFoundationMediaPlayerType; >- pm.media.avfMediaPlayer = m_avPlayer.get(); >- return pm; >-} >- > PlatformLayer* MediaPlayerPrivateAVFoundationObjC::platformLayer() const > { > return m_videoFullscreenLayerManager->videoInlineLayer(); >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >index cea8bf29921de2c22b703cc237e2f1122dff1939..1e55190df3d41619fdaf7d9de27dee16f209fdc1 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >@@ -153,7 +153,6 @@ private: > void cancelLoad() override; > > void prepareToPlay() override; >- PlatformMedia platformMedia() const override; > PlatformLayer* platformLayer() const override; > > bool supportsPictureInPicture() const override { return true; } >@@ -227,7 +226,7 @@ private: > > size_t extraMemoryCost() const override; > >- std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; >+ std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; > > #if ENABLE(WIRELESS_PLAYBACK_TARGET) > bool isCurrentPlaybackTargetWireless() const override; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >index b9d725d0706f00fe892a9674d4d2ff47d6a47283..d082624f9252943923894ee5dbf63dca250c4648 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2013-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -275,14 +275,6 @@ void MediaPlayerPrivateMediaSourceAVFObjC::prepareToPlay() > { > } > >-PlatformMedia MediaPlayerPrivateMediaSourceAVFObjC::platformMedia() const >-{ >- PlatformMedia pm; >- pm.type = PlatformMedia::AVFoundationAssetType; >- pm.media.avfAsset = m_asset.get(); >- return pm; >-} >- > PlatformLayer* MediaPlayerPrivateMediaSourceAVFObjC::platformLayer() const > { > return m_videoFullscreenLayerManager->videoInlineLayer(); >@@ -665,27 +657,27 @@ size_t MediaPlayerPrivateMediaSourceAVFObjC::extraMemoryCost() const > return 0; > } > >-std::optional<PlatformVideoPlaybackQualityMetrics> MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics() >+std::optional<VideoPlaybackQualityMetrics> MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics() > { > if (m_decompressionSession) { >- return PlatformVideoPlaybackQualityMetrics( >+ return VideoPlaybackQualityMetrics { > m_decompressionSession->totalVideoFrames(), > m_decompressionSession->droppedVideoFrames(), > m_decompressionSession->corruptedVideoFrames(), > m_decompressionSession->totalFrameDelay().toDouble() >- ); >+ }; > } > > auto metrics = [m_sampleBufferDisplayLayer videoPerformanceMetrics]; > if (!metrics) > return std::nullopt; > >- return PlatformVideoPlaybackQualityMetrics( >- [metrics totalNumberOfVideoFrames], >- [metrics numberOfDroppedVideoFrames], >- [metrics numberOfCorruptedVideoFrames], >+ return VideoPlaybackQualityMetrics { >+ static_cast<unsigned>([metrics totalNumberOfVideoFrames]), >+ static_cast<unsigned>([metrics numberOfDroppedVideoFrames]), >+ static_cast<unsigned>([metrics numberOfCorruptedVideoFrames]), > [metrics totalFrameDelay] >- ); >+ }; > } > > #pragma mark - >diff --git a/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.h b/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.h >index f196c2016ccf730a71012b722bad9d5fd4a75e83..0d8ebb1f931eca3112f1e30820c7651b7a0ead7a 100644 >--- a/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.h >+++ b/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.h >@@ -73,9 +73,9 @@ public: > RetainPtr<CVPixelBufferRef> imageForTime(const MediaTime&, ImageForTimeFlags = ExactTime); > void flush(); > >- unsigned long totalVideoFrames() { return m_totalVideoFrames; } >- unsigned long droppedVideoFrames() { return m_droppedVideoFrames; } >- unsigned long corruptedVideoFrames() { return m_corruptedVideoFrames; } >+ unsigned totalVideoFrames() { return m_totalVideoFrames; } >+ unsigned droppedVideoFrames() { return m_droppedVideoFrames; } >+ unsigned corruptedVideoFrames() { return m_corruptedVideoFrames; } > MediaTime totalFrameDelay() { return m_totalFrameDelay; } > > private: >@@ -122,15 +122,15 @@ private: > std::function<void()> m_notificationCallback; > std::function<void()> m_hasAvailableFrameCallback; > RetainPtr<CFArrayRef> m_qosTiers; >- long m_currentQosTier { 0 }; >- unsigned long m_framesSinceLastQosCheck { 0 }; >+ int m_currentQosTier { 0 }; >+ unsigned m_framesSinceLastQosCheck { 0 }; > double m_decodeRatioMovingAverage { 0 }; > > bool m_invalidated { false }; > int m_framesBeingDecoded { 0 }; >- unsigned long m_totalVideoFrames { 0 }; >- unsigned long m_droppedVideoFrames { 0 }; >- unsigned long m_corruptedVideoFrames { 0 }; >+ unsigned m_totalVideoFrames { 0 }; >+ unsigned m_droppedVideoFrames { 0 }; >+ unsigned m_corruptedVideoFrames { 0 }; > MediaTime m_totalFrameDelay; > }; > >diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp b/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp >index 723c8159a1caf471b091da44d48b09d58a32892e..b57adccd047fd91bdd8c40a35ce2fd16372fc6e3 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp >+++ b/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp >@@ -94,7 +94,7 @@ void MockMediaPlayerMediaSource::load(const String&) > > void MockMediaPlayerMediaSource::load(const String&, MediaSourcePrivateClient* source) > { >- m_mediaSourcePrivate = MockMediaSourcePrivate::create(this, source); >+ m_mediaSourcePrivate = MockMediaSourcePrivate::create(*this, *source); > } > > void MockMediaPlayerMediaSource::cancelLoad() >@@ -268,7 +268,7 @@ void MockMediaPlayerMediaSource::seekCompleted() > }); > } > >-std::optional<PlatformVideoPlaybackQualityMetrics> MockMediaPlayerMediaSource::videoPlaybackQualityMetrics() >+std::optional<VideoPlaybackQualityMetrics> MockMediaPlayerMediaSource::videoPlaybackQualityMetrics() > { > return m_mediaSourcePrivate ? m_mediaSourcePrivate->videoPlaybackQualityMetrics() : std::nullopt; > } >diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h b/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h >index d7cfd719b8b7def8b1484ceb8b2a79f40b8b0a96..031a10ec0b834a557ab77d6826fc9505d393c242 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h >+++ b/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h >@@ -81,7 +81,7 @@ private: > MediaTime currentMediaTime() const override; > MediaTime durationMediaTime() const override; > void seekWithTolerance(const MediaTime&, const MediaTime&, const MediaTime&) override; >- std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; >+ std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; > > MediaPlayer* m_player; > RefPtr<MockMediaSourcePrivate> m_mediaSourcePrivate; >diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp >index 8ff24acb0b39a8e139e45dd01933a4260fcbe7b3..5f8215efe5119ca8b3effd11a0c0a136868742f1 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp >+++ b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2013 Apple Inc. All rights reserved. >+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -35,27 +35,23 @@ > > namespace WebCore { > >-RefPtr<MockMediaSourcePrivate> MockMediaSourcePrivate::create(MockMediaPlayerMediaSource* parent, MediaSourcePrivateClient* client) >+Ref<MockMediaSourcePrivate> MockMediaSourcePrivate::create(MockMediaPlayerMediaSource& parent, MediaSourcePrivateClient& client) > { >- RefPtr<MockMediaSourcePrivate> mediaSourcePrivate = adoptRef(new MockMediaSourcePrivate(parent, client)); >- client->setPrivateAndOpen(*mediaSourcePrivate); >- return mediaSourcePrivate; >+ auto source = adoptRef(*new MockMediaSourcePrivate(parent, client)); >+ client.setPrivateAndOpen(source.copyRef()); >+ return source; > } > >-MockMediaSourcePrivate::MockMediaSourcePrivate(MockMediaPlayerMediaSource* parent, MediaSourcePrivateClient* client) >+MockMediaSourcePrivate::MockMediaSourcePrivate(MockMediaPlayerMediaSource& parent, MediaSourcePrivateClient& client) > : m_player(parent) > , m_client(client) >- , m_isEnded(false) >- , m_totalVideoFrames(0) >- , m_droppedVideoFrames(0) >- , m_corruptedVideoFrames(0) > { > } > > MockMediaSourcePrivate::~MockMediaSourcePrivate() > { >- for (auto it = m_sourceBuffers.begin(), end = m_sourceBuffers.end(); it != end; ++it) >- (*it)->clearMediaSource(); >+ for (auto& buffer : m_sourceBuffers) >+ buffer->clearMediaSource(); > } > > MediaSourcePrivate::AddStatus MockMediaSourcePrivate::addSourceBuffer(const ContentType& contentType, RefPtr<SourceBufferPrivate>& outPrivate) >@@ -75,13 +71,8 @@ MediaSourcePrivate::AddStatus MockMediaSourcePrivate::addSourceBuffer(const Cont > void MockMediaSourcePrivate::removeSourceBuffer(SourceBufferPrivate* buffer) > { > ASSERT(m_sourceBuffers.contains(buffer)); >- >- size_t pos = m_activeSourceBuffers.find(buffer); >- if (pos != notFound) >- m_activeSourceBuffers.remove(pos); >- >- pos = m_sourceBuffers.find(buffer); >- m_sourceBuffers.remove(pos); >+ m_activeSourceBuffers.removeFirst(buffer); >+ m_sourceBuffers.removeFirst(buffer); > } > > MediaTime MockMediaSourcePrivate::duration() >@@ -96,13 +87,13 @@ std::unique_ptr<PlatformTimeRanges> MockMediaSourcePrivate::buffered() > > void MockMediaSourcePrivate::durationChanged() > { >- m_player->updateDuration(duration()); >+ m_player.updateDuration(duration()); > } > > void MockMediaSourcePrivate::markEndOfStream(EndOfStreamStatus status) > { > if (status == EosNoError) >- m_player->setNetworkState(MediaPlayer::Loaded); >+ m_player.setNetworkState(MediaPlayer::Loaded); > m_isEnded = true; > } > >@@ -113,22 +104,22 @@ void MockMediaSourcePrivate::unmarkEndOfStream() > > MediaPlayer::ReadyState MockMediaSourcePrivate::readyState() const > { >- return m_player->readyState(); >+ return m_player.readyState(); > } > > void MockMediaSourcePrivate::setReadyState(MediaPlayer::ReadyState readyState) > { >- m_player->setReadyState(readyState); >+ m_player.setReadyState(readyState); > } > > void MockMediaSourcePrivate::waitForSeekCompleted() > { >- m_player->waitForSeekCompleted(); >+ m_player.waitForSeekCompleted(); > } > > void MockMediaSourcePrivate::seekCompleted() > { >- m_player->seekCompleted(); >+ m_player.seekCompleted(); > } > > void MockMediaSourcePrivate::sourceBufferPrivateDidChangeActiveState(MockSourceBufferPrivate* buffer, bool active) >@@ -136,11 +127,8 @@ void MockMediaSourcePrivate::sourceBufferPrivateDidChangeActiveState(MockSourceB > if (active && !m_activeSourceBuffers.contains(buffer)) > m_activeSourceBuffers.append(buffer); > >- if (!active) { >- size_t position = m_activeSourceBuffers.find(buffer); >- if (position != notFound) >- m_activeSourceBuffers.remove(position); >- } >+ if (!active) >+ m_activeSourceBuffers.removeFirst(buffer); > } > > static bool MockSourceBufferPrivateHasAudio(MockSourceBufferPrivate* sourceBuffer) >@@ -171,29 +159,28 @@ void MockMediaSourcePrivate::seekToTime(const MediaTime& time) > MediaTime MockMediaSourcePrivate::seekToTime(const MediaTime& targetTime, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold) > { > MediaTime seekTime = targetTime; >- for (auto it = m_activeSourceBuffers.begin(), end = m_activeSourceBuffers.end(); it != end; ++it) { >- MediaTime sourceSeekTime = (*it)->fastSeekTimeForMediaTime(targetTime, negativeThreshold, positiveThreshold); >+ for (auto& buffer : m_activeSourceBuffers) { >+ MediaTime sourceSeekTime = buffer->fastSeekTimeForMediaTime(targetTime, negativeThreshold, positiveThreshold); > if (abs(targetTime - sourceSeekTime) > abs(targetTime - seekTime)) > seekTime = sourceSeekTime; > } > >- for (auto it = m_activeSourceBuffers.begin(), end = m_activeSourceBuffers.end(); it != end; ++it) >- (*it)->seekToTime(seekTime); >- >+ for (auto& buffer : m_activeSourceBuffers) >+ buffer->seekToTime(seekTime); >+ > return seekTime; > } > >-std::optional<PlatformVideoPlaybackQualityMetrics> MockMediaSourcePrivate::videoPlaybackQualityMetrics() >+std::optional<VideoPlaybackQualityMetrics> MockMediaSourcePrivate::videoPlaybackQualityMetrics() > { >- return PlatformVideoPlaybackQualityMetrics( >+ return VideoPlaybackQualityMetrics { > m_totalVideoFrames, > m_droppedVideoFrames, > m_corruptedVideoFrames, > m_totalFrameDelay.toDouble() >- ); >+ }; > } > >-}; >+} > > #endif >- >diff --git a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h >index e1910250f09182f35c2f206f6e0664565d65b996..4d94566c3248678be36f85ce869c15e35894f910 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h >+++ b/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2013 Apple Inc. All rights reserved. >+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -23,8 +23,7 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef MockMediaSourcePrivate_h >-#define MockMediaSourcePrivate_h >+#pragma once > > #if ENABLE(MEDIA_SOURCE) > >@@ -35,11 +34,10 @@ namespace WebCore { > > class MockMediaPlayerMediaSource; > class MockSourceBufferPrivate; >-class TimeRanges; > > class MockMediaSourcePrivate final : public MediaSourcePrivate { > public: >- static RefPtr<MockMediaSourcePrivate> create(MockMediaPlayerMediaSource*, MediaSourcePrivateClient*); >+ static Ref<MockMediaSourcePrivate> create(MockMediaPlayerMediaSource&, MediaSourcePrivateClient&); > virtual ~MockMediaSourcePrivate(); > > const Vector<MockSourceBufferPrivate*>& activeSourceBuffers() const { return m_activeSourceBuffers; } >@@ -50,12 +48,12 @@ public: > MediaTime duration(); > std::unique_ptr<PlatformTimeRanges> buffered(); > >- MockMediaPlayerMediaSource* player() const { return m_player; } >+ MockMediaPlayerMediaSource& player() const { return m_player; } > > void seekToTime(const MediaTime&); > MediaTime seekToTime(const MediaTime&, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold); > >- std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); >+ std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); > > void incrementTotalVideoFrames() { ++m_totalVideoFrames; } > void incrementDroppedFrames() { ++m_droppedVideoFrames; } >@@ -63,7 +61,7 @@ public: > void incrementTotalFrameDelayBy(const MediaTime& delay) { m_totalFrameDelay += delay; } > > private: >- MockMediaSourcePrivate(MockMediaPlayerMediaSource*, MediaSourcePrivateClient*); >+ MockMediaSourcePrivate(MockMediaPlayerMediaSource&, MediaSourcePrivateClient&); > > // MediaSourcePrivate Overrides > AddStatus addSourceBuffer(const ContentType&, RefPtr<SourceBufferPrivate>&) override; >@@ -80,21 +78,18 @@ private: > > friend class MockSourceBufferPrivate; > >- MockMediaPlayerMediaSource* m_player; >- RefPtr<MediaSourcePrivateClient> m_client; >+ MockMediaPlayerMediaSource& m_player; >+ Ref<MediaSourcePrivateClient> m_client; > Vector<RefPtr<MockSourceBufferPrivate>> m_sourceBuffers; > Vector<MockSourceBufferPrivate*> m_activeSourceBuffers; >- bool m_isEnded; >+ bool m_isEnded { false }; > >- unsigned long m_totalVideoFrames; >- unsigned long m_droppedVideoFrames; >- unsigned long m_corruptedVideoFrames; >+ unsigned m_totalVideoFrames { 0 }; >+ unsigned m_droppedVideoFrames { 0 }; >+ unsigned m_corruptedVideoFrames { 0 }; > MediaTime m_totalFrameDelay; > }; > > } > > #endif // ENABLE(MEDIA_SOURCE) >- >-#endif // MockMediaSourcePrivate_h >- >diff --git a/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp b/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp >index 02463476e6c449daffc3f69a495068edb3c6f342..7f705cc030fa75c74ec205501afad2fff6640955 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp >+++ b/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp >@@ -220,13 +220,13 @@ void MockSourceBufferPrivate::removedFromMediaSource() > > MediaPlayer::ReadyState MockSourceBufferPrivate::readyState() const > { >- return m_mediaSource ? m_mediaSource->player()->readyState() : MediaPlayer::HaveNothing; >+ return m_mediaSource ? m_mediaSource->player().readyState() : MediaPlayer::HaveNothing; > } > > void MockSourceBufferPrivate::setReadyState(MediaPlayer::ReadyState readyState) > { > if (m_mediaSource) >- m_mediaSource->player()->setReadyState(readyState); >+ m_mediaSource->player().setReadyState(readyState); > } > > void MockSourceBufferPrivate::setActive(bool isActive) >diff --git a/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.h b/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.h >index 2aa7196c2eb4d6bb461de192d29d067f1611239f..eaed00c0b3aa60bbd10bd87ef6bcde97f6d18771 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.h >+++ b/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2009 Apple Inc. All rights reserved. >+ * Copyright (C) 2009-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -27,45 +27,16 @@ > > #if PLATFORM(MAC) && ENABLE(VIDEO) > >-#import <AppKit/NSScreen.h> > #import <AppKit/NSWindowController.h> >-#import <wtf/RefPtr.h> >- >-namespace PAL { >-class SleepDisabler; >-} > > namespace WebCore { > class HTMLVideoElement; > } > >-@protocol WebVideoFullscreenControllerDelegate; >-@class WebVideoFullscreenHUDWindowController; >-@class WebWindowFadeAnimation; >-@class CALayer; >- >-@interface WebVideoFullscreenController : NSWindowController { >-@private >- RefPtr<WebCore::HTMLVideoElement> _videoElement; // (retain) >- id <WebVideoFullscreenControllerDelegate> _delegate; // (assign) >- >- NSWindow *_backgroundFullscreenWindow; // (retain) >- WebVideoFullscreenHUDWindowController *_hudController; // (retain) >- >- WebWindowFadeAnimation *_fadeAnimation; // (retain) >- >- BOOL _isEndingFullscreen; >- BOOL _forceDisableAnimation; >- >- std::unique_ptr<PAL::SleepDisabler> _displaySleepDisabler; >-} >- >-- (id <WebVideoFullscreenControllerDelegate>)delegate; >-- (void)setDelegate:(id <WebVideoFullscreenControllerDelegate>)delegate; >+@interface WebVideoFullscreenController : NSWindowController > >-- (void)setupVideoOverlay:(CALayer*)layer; >-- (void)setVideoElement:(WebCore::HTMLVideoElement*)videoElement; >-- (WebCore::HTMLVideoElement*)videoElement; >+- (void)setVideoElement:(WebCore::HTMLVideoElement *)videoElement; >+- (WebCore::HTMLVideoElement *)videoElement; > > - (void)enterFullscreen:(NSScreen *)screen; > - (void)exitFullscreen; >diff --git a/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm b/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm >index af001da054a2dfe10266c34a95da24a95aad719b..e03af4cbd600757de5acd6e8e836644526a28955 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2009-2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2009-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -23,12 +23,13 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#if ENABLE(VIDEO) && PLATFORM(MAC) >- > #import "WebVideoFullscreenController.h" > >+#if ENABLE(VIDEO) && PLATFORM(MAC) >+ > #import "WebVideoFullscreenHUDWindowController.h" > #import "WebWindowAnimation.h" >+#import <AVFoundation/AVPlayer.h> > #import <AVFoundation/AVPlayerLayer.h> > #import <Carbon/Carbon.h> > #import <WebCore/HTMLVideoElement.h> >@@ -37,17 +38,25 @@ > #import <wtf/RetainPtr.h> > #import <wtf/SoftLinking.h> > >-using WebCore::HTMLVideoElement; >- >-#if COMPILER(CLANG) > #pragma clang diagnostic push > #pragma clang diagnostic ignored "-Wdeprecated-declarations" >-#endif > > SOFT_LINK_FRAMEWORK(AVFoundation) > SOFT_LINK_CLASS(AVFoundation, AVPlayerLayer) > >-using WebCore::PlatformMedia; >+@interface WebVideoFullscreenController () <WebVideoFullscreenHUDWindowControllerDelegate> { >+ RefPtr<WebCore::HTMLVideoElement> _videoElement; >+ >+ NSWindow *_backgroundFullscreenWindow; // (retain) >+ WebVideoFullscreenHUDWindowController *_hudController; // (retain) >+ >+ WebWindowFadeAnimation *_fadeAnimation; // (retain) >+ >+ BOOL _isEndingFullscreen; >+ BOOL _forceDisableAnimation; >+} >+@end >+ > @interface WebVideoFullscreenWindow : NSWindow<NSAnimationDelegate> { > SEL _controllerActionOnAnimationEnd; > WebWindowScaleAnimation *_fullscreenAnimation; // (retain) >@@ -55,17 +64,8 @@ @interface WebVideoFullscreenWindow : NSWindow<NSAnimationDelegate> { > - (void)animateFromRect:(NSRect)startRect toRect:(NSRect)endRect withSubAnimation:(NSAnimation *)subAnimation controllerAction:(SEL)controllerAction; > @end > >-@interface WebVideoFullscreenController(HUDWindowControllerDelegate) <WebVideoFullscreenHUDWindowControllerDelegate> >-- (void)requestExitFullscreenWithAnimation:(BOOL)animation; >-- (void)updateMenuAndDockForFullscreen; >-- (void)updatePowerAssertions; >-@end >- >-@interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard) >-- (BOOL)isOnActiveSpace; >-@end >- > @implementation WebVideoFullscreenController >+ > - (id)init > { > // Do not defer window creation, to make sure -windowNumber is created (needed by WebWindowScaleAnimation). >@@ -91,57 +91,58 @@ - (WebVideoFullscreenWindow *)fullscreenWindow > return (WebVideoFullscreenWindow *)[super window]; > } > >-- (void)setupVideoOverlay:(CALayer *)layer >-{ >- WebVideoFullscreenWindow *window = [self fullscreenWindow]; >- [(NSView*)[window contentView] setLayer:layer]; >- [[window contentView] setWantsLayer:YES]; >-} >- > - (void)windowDidLoad > { >- WebVideoFullscreenWindow *window = [self fullscreenWindow]; >+ auto window = [self fullscreenWindow]; >+ auto contentView = [window contentView]; >+ > [window setHasShadow:YES]; // This is nicer with a shadow. > [window setLevel:NSPopUpMenuWindowLevel-1]; >- [(NSView*)[window contentView] setLayer:[CALayer layer]]; >- [[window contentView] setWantsLayer:YES]; >+ >+ [contentView setLayer:[CALayer layer]]; >+ [contentView setWantsLayer:YES]; > > [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidResignActive:) name:NSApplicationDidResignActiveNotification object:NSApp]; > [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidChangeScreenParameters:) name:NSApplicationDidChangeScreenParametersNotification object:NSApp]; > } > >-- (HTMLVideoElement*)videoElement >+- (WebCore::HTMLVideoElement *)videoElement > { > return _videoElement.get(); > } > >-- (void)setVideoElement:(HTMLVideoElement*)videoElement >+// FIXME: This method is not really a setter. The caller relies on its side effects, and it's >+// called once each time we enter full screen. So it should have a differena name. >+- (void)setVideoElement:(WebCore::HTMLVideoElement *)videoElement > { >+ ASSERT(videoElement); > _videoElement = videoElement; > >- if (!_videoElement) >+ if (![self isWindowLoaded]) >+ return; >+ auto corePlayer = videoElement->player(); >+ if (!corePlayer) >+ return; >+ auto player = corePlayer->avPlayer(); >+ if (!player) > return; > >- if ([self isWindowLoaded]) { >- if (_videoElement->platformMedia().type == PlatformMedia::AVFoundationMediaPlayerType) { >- AVPlayer *player = _videoElement->platformMedia().media.avfMediaPlayer; >- RetainPtr<AVPlayerLayer> layer = adoptNS([allocAVPlayerLayerInstance() init]); >- [self setupVideoOverlay:layer.get()]; >- [layer.get() setPlayer:player]; >+ auto contentView = [[self fullscreenWindow] contentView]; > >- [player addObserver:self forKeyPath:@"rate" options:0 context:nullptr]; >- } >- } >-} >+ auto layer = adoptNS([allocAVPlayerLayerInstance() init]); >+ [layer setPlayer:player]; > >-- (id <WebVideoFullscreenControllerDelegate>)delegate >-{ >- return _delegate; >-} >+ [contentView setLayer:layer.get()]; > >-- (void)setDelegate:(id <WebVideoFullscreenControllerDelegate>)delegate >-{ >- _delegate = delegate; >+ // FIXME: The windowDidLoad method already called this, so it should >+ // not be necessary to do it again here. >+ [contentView setWantsLayer:YES]; >+ >+ // FIXME: This can be called multiple times, and won't necessarily be >+ // balanced by calls to windowDidExitFullscreen in some cases, so it >+ // would be better to change things so the observer is reliably added >+ // only once and guaranteed removed even in unusual edge cases. >+ [player addObserver:self forKeyPath:@"rate" options:0 context:nullptr]; > } > > - (CGFloat)clearFadeAnimation >@@ -156,15 +157,14 @@ - (CGFloat)clearFadeAnimation > > - (void)windowDidExitFullscreen > { >- CALayer *layer = [(NSView*)[[self window] contentView] layer]; >+ CALayer *layer = [[[self window] contentView] layer]; > if ([layer isKindOfClass:getAVPlayerLayerClass()]) >- [[(AVPlayerLayer*)layer player] removeObserver:self forKeyPath:@"rate"]; >+ [[(AVPlayerLayer *)layer player] removeObserver:self forKeyPath:@"rate"]; > > [self clearFadeAnimation]; > [[self window] close]; > [self setWindow:nil]; > [self updateMenuAndDockForFullscreen]; >- [self updatePowerAssertions]; > [_hudController setDelegate:nil]; > [_hudController release]; > _hudController = nil; >@@ -185,7 +185,6 @@ - (void)windowDidEnterFullscreen > [_hudController setDelegate:self]; > > [self updateMenuAndDockForFullscreen]; >- [self updatePowerAssertions]; > [NSCursor setHiddenUntilMouseMoves:YES]; > > // Give the HUD keyboard focus initially >@@ -338,11 +337,6 @@ - (void)updateMenuAndDockForFullscreen > NSApp.presentationOptions = options; > } > >-- (void)updatePowerAssertions >-{ >- _displaySleepDisabler = nullptr; >-} >- > // MARK: - > // MARK: Window callback > >@@ -387,7 +381,6 @@ - (void)rateChanged:(NSNotification *)unusedNotification > { > UNUSED_PARAM(unusedNotification); > [_hudController updateRate]; >- [self updatePowerAssertions]; > } > > @end >@@ -527,8 +520,6 @@ - (void)mouseMoved:(NSEvent *)theEvent > > @end > >-#if COMPILER(CLANG) > #pragma clang diagnostic pop >-#endif > >-#endif /* ENABLE(VIDEO) */ >+#endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dbates
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186258
: 341893 |
341953
|
341957