Diff
Modified: trunk/Source/WTF/ChangeLog (265114 => 265115)
--- trunk/Source/WTF/ChangeLog 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WTF/ChangeLog 2020-07-30 23:08:00 UTC (rev 265115)
@@ -1,3 +1,22 @@
+2020-07-30 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -[AVContentKeyRequest willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:]
+ https://bugs.webkit.org/show_bug.cgi?id=214659
+ <rdar://problem/63555006>
+
+ Reviewed by Darin Adler.
+
+ Add a new Observer template class. This allows classes to provide support for listeners without requiring
+ those listeners to subclass from a pure-virtual (and CanMakeWeakPtr capable) client class. Instead, clients
+ can just create one of these Observer objects, and pass a WeakPtr to that observer to the notifying object.
+ When the client object destroys the observer, it is automatically unregistered when the observing object
+ uses a WeakHashSet.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/Observer.h: Added.
+ (WTF::Observer<Out):
+
2020-07-30 Keith Miller <[email protected]>
Compute number of PAC bits from what the OS says its address space is
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (265114 => 265115)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2020-07-30 23:08:00 UTC (rev 265115)
@@ -686,6 +686,7 @@
C6F050790D9C432A99085E75 /* ASCIILiteral.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ASCIILiteral.cpp; sourceTree = "<group>"; };
C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomDevice.cpp; sourceTree = "<group>"; };
CD00360D21501F7800F4ED4C /* StringToIntegerConversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StringToIntegerConversion.h; sourceTree = "<group>"; };
+ CD48A87024C8A21600F5800C /* Observer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Observer.h; sourceTree = "<group>"; };
CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; };
CD6D9FCD1EEF3AD4008B0671 /* Algorithms.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Algorithms.h; sourceTree = "<group>"; };
@@ -1126,6 +1127,7 @@
7E29C33D15FFD79B00516D61 /* ObjCRuntimeExtras.h */,
8348BA0D21FBC0D400FD3054 /* ObjectIdentifier.cpp */,
83A8AC3D1FABBE94002064AC /* ObjectIdentifier.h */,
+ CD48A87024C8A21600F5800C /* Observer.h */,
1AFDE6521953B23D00C48FFA /* Optional.h */,
1A4656181C7FC68E00F5920F /* OptionSet.h */,
275DFB6B238BDF72001230E2 /* OptionSetHash.h */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (265114 => 265115)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2020-07-30 23:08:00 UTC (rev 265115)
@@ -156,6 +156,7 @@
OSRandomSource.h
ObjCRuntimeExtras.h
ObjectIdentifier.h
+ Observer.h
OptionSet.h
OptionSetHash.h
Optional.h
Added: trunk/Source/WTF/wtf/Observer.h (0 => 265115)
--- trunk/Source/WTF/wtf/Observer.h (rev 0)
+++ trunk/Source/WTF/wtf/Observer.h 2020-07-30 23:08:00 UTC (rev 265115)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Function.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/WeakPtr.h>
+
+namespace WTF {
+
+template<typename> class Observer;
+
+template <typename Out, typename... In>
+class Observer<Out(In...)> : public CanMakeWeakPtr<Observer<Out(In...)>> {
+ WTF_MAKE_NONCOPYABLE(Observer);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ Observer(Function<Out(In...)>&& callback)
+ : m_callback(WTFMove(callback))
+ {
+ ASSERT(m_callback);
+ }
+
+ Out operator()(In... in) const
+ {
+ ASSERT(m_callback);
+ return m_callback(std::forward<In>(in)...);
+ }
+
+private:
+ Function<Out(In...)> m_callback;
+};
+
+}
+
+using WTF::Observer;
+
Modified: trunk/Source/WebCore/ChangeLog (265114 => 265115)
--- trunk/Source/WebCore/ChangeLog 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/ChangeLog 2020-07-30 23:08:00 UTC (rev 265115)
@@ -1,3 +1,34 @@
+2020-07-30 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -[AVContentKeyRequest willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:]
+ https://bugs.webkit.org/show_bug.cgi?id=214659
+ <rdar://problem/63555006>
+
+ Reviewed by Darin Adler.
+
+ Use the new WTF::Observer object as the listener type for notifying clients of display changes. When a displayChanged
+ event is observed, use the new AVContentKeyRequest -willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:
+ to set the keyStatus for that request appropriately.
+
+ * Modules/encryptedmedia/MediaKeySession.cpp:
+ (WebCore::MediaKeySession::MediaKeySession):
+ (WebCore::MediaKeySession::displayID):
+ (WebCore::MediaKeySession::displayChanged):
+ * Modules/encryptedmedia/MediaKeySession.h:
+ * dom/Document.cpp:
+ (WebCore::Document::windowScreenDidChange):
+ (WebCore::Document::addDisplayChangedObserver):
+ * dom/Document.h:
+ * platform/encryptedmedia/CDMInstanceSession.h:
+ (WebCore::CDMInstanceSession::displayChanged):
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (-[WebCoreFPSContentKeySessionDelegate contentKeySession:externalProtectionStatusDidChangeForContentKeyRequest:]):
+ (WebCore::CDMInstanceFairPlayStreamingAVFObjC::externalProtectionStatusDidChangeForContentKeyRequest):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::displayChanged):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::externalProtectionStatusDidChangeForContentKeyRequest):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID):
+
2020-07-30 James Darpinian <[email protected]>
[WebGL2] Buffer updates
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (265114 => 265115)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2020-07-30 23:08:00 UTC (rev 265115)
@@ -76,6 +76,7 @@
, m_sessionType(sessionType)
, m_implementation(WTFMove(implementation))
, m_instanceSession(WTFMove(instanceSession))
+ , m_displayChangedObserver([this] (auto displayID) { displayChanged(displayID); })
{
// https://w3c.github.io/encrypted-media/#dom-mediakeys-createsession
// W3C Editor's Draft 09 November 2016
@@ -105,6 +106,8 @@
m_instanceSession->setLogger(m_logger, m_logIdentifier);
#endif
m_instanceSession->setClient(makeWeakPtr(*this));
+
+ document.addDisplayChangedObserver(m_displayChangedObserver);
}
MediaKeySession::~MediaKeySession()
@@ -722,6 +725,18 @@
m_sessionId = sessionId;
}
+PlatformDisplayID MediaKeySession::displayID()
+{
+ auto* document = downcast<Document>(scriptExecutionContext());
+ if (!document)
+ return 0;
+
+ if (auto* page = document->page())
+ return page->displayID();
+
+ return 0;
+}
+
void MediaKeySession::updateExpiration(double)
{
notImplemented();
@@ -790,6 +805,11 @@
}
#endif
+void MediaKeySession::displayChanged(PlatformDisplayID displayID)
+{
+ m_instanceSession->displayChanged(displayID);
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (265114 => 265115)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h 2020-07-30 23:08:00 UTC (rev 265115)
@@ -37,6 +37,7 @@
#include "MediaKeyMessageType.h"
#include "MediaKeySessionType.h"
#include "MediaKeyStatus.h"
+#include <wtf/Observer.h>
#include <wtf/RefCounted.h>
#include <wtf/UniqueRef.h>
#include <wtf/Vector.h>
@@ -99,6 +100,7 @@
void updateKeyStatuses(CDMInstanceSessionClient::KeyStatusVector&&) override;
void sendMessage(CDMMessageType, Ref<SharedBuffer>&& message) final;
void sessionIdChanged(const String&) final;
+ PlatformDisplayID displayID() final;
// EventTarget
EventTargetInterface eventTargetInterface() const override { return MediaKeySessionEventTargetInterfaceType; }
@@ -110,6 +112,9 @@
const char* activeDOMObjectName() const final;
bool virtualHasPendingActivity() const final;
+ // DisplayChangedObserver
+ void displayChanged(PlatformDisplayID);
+
#if !RELEASE_LOG_DISABLED
// LoggerHelper
const WTF::Logger& logger() const { return m_logger; }
@@ -137,6 +142,9 @@
double m_firstDecryptTime { 0 };
double m_latestDecryptTime { 0 };
Vector<std::pair<Ref<SharedBuffer>, MediaKeyStatus>> m_statuses;
+
+ using DisplayChangedObserver = Observer<void(PlatformDisplayID)>;
+ DisplayChangedObserver m_displayChangedObserver;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/PAL/ChangeLog (265114 => 265115)
--- trunk/Source/WebCore/PAL/ChangeLog 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/PAL/ChangeLog 2020-07-30 23:08:00 UTC (rev 265115)
@@ -1,3 +1,13 @@
+2020-07-30 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -[AVContentKeyRequest willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:]
+ https://bugs.webkit.org/show_bug.cgi?id=214659
+ <rdar://problem/63555006>
+
+ Reviewed by Darin Adler.
+
+ * pal/spi/cocoa/AVFoundationSPI.h:
+
2020-07-29 Jer Noble <[email protected]>
Support HDR decode in SW VP9
Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h (265114 => 265115)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h 2020-07-30 23:08:00 UTC (rev 265115)
@@ -196,6 +196,12 @@
@interface AVContentKeySession (AVContentKeyGroup_Support)
- (nonnull AVContentKeyReportGroup *)makeContentKeyGroup;
@end
+
+@interface AVContentKeyRequest (OutputObscured)
+NS_ASSUME_NONNULL_BEGIN
+- (BOOL)willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:(NSArray<NSNumber *> *)displays;
+NS_ASSUME_NONNULL_END
+@end
#endif // HAVE(AVCONTENTKEYSESSION)
#if ENABLE(MEDIA_SOURCE) && !USE(APPLE_INTERNAL_SDK)
Modified: trunk/Source/WebCore/dom/Document.cpp (265114 => 265115)
--- trunk/Source/WebCore/dom/Document.cpp 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/dom/Document.cpp 2020-07-30 23:08:00 UTC (rev 265115)
@@ -6465,6 +6465,11 @@
if (view->usesCompositing())
view->compositor().windowScreenDidChange(displayID);
}
+
+ for (auto& observer : copyToVector(m_displayChangedObservers)) {
+ if (observer)
+ (*observer)(displayID);
+ }
}
String Document::displayStringModifiedByEncoding(const String& string) const
@@ -6519,6 +6524,12 @@
return listener;
}
+void Document::addDisplayChangedObserver(const DisplayChangedObserver& observer)
+{
+ ASSERT(!m_displayChangedObservers.contains(observer));
+ m_displayChangedObservers.add(observer);
+}
+
#if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS_FAMILY)
DeviceMotionController& Document::deviceMotionController() const
Modified: trunk/Source/WebCore/dom/Document.h (265114 => 265115)
--- trunk/Source/WebCore/dom/Document.h 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/dom/Document.h 2020-07-30 23:08:00 UTC (rev 265115)
@@ -72,6 +72,7 @@
#include <wtf/HashSet.h>
#include <wtf/Logger.h>
#include <wtf/ObjectIdentifier.h>
+#include <wtf/Observer.h>
#include <wtf/UniqueRef.h>
#include <wtf/WeakHashSet.h>
#include <wtf/WeakPtr.h>
@@ -1169,6 +1170,9 @@
WEBCORE_EXPORT void removeMediaCanStartListener(MediaCanStartListener&);
MediaCanStartListener* takeAnyMediaCanStartListener();
+ using DisplayChangedObserver = WTF::Observer<void(PlatformDisplayID)>;
+ void addDisplayChangedObserver(const DisplayChangedObserver&);
+
#if ENABLE(FULLSCREEN_API)
FullscreenManager& fullscreenManager() { return m_fullscreenManager; }
const FullscreenManager& fullscreenManager() const { return m_fullscreenManager; }
@@ -1842,6 +1846,7 @@
RenderPtr<RenderView> m_renderView;
WeakHashSet<MediaCanStartListener> m_mediaCanStartListeners;
+ WeakHashSet<DisplayChangedObserver> m_displayChangedObservers;
#if ENABLE(FULLSCREEN_API)
UniqueRef<FullscreenManager> m_fullscreenManager;
Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h (265114 => 265115)
--- trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h 2020-07-30 23:08:00 UTC (rev 265115)
@@ -54,6 +54,8 @@
virtual void updateKeyStatuses(KeyStatusVector&&) = 0;
virtual void sendMessage(CDMMessageType, Ref<SharedBuffer>&& message) = 0;
virtual void sessionIdChanged(const String&) = 0;
+ using PlatformDisplayID = uint32_t;
+ virtual PlatformDisplayID displayID() = 0;
};
class CDMInstanceSession : public RefCounted<CDMInstanceSession> {
@@ -102,6 +104,9 @@
virtual void removeSessionData(const String& sessionId, LicenseType, RemoveSessionDataCallback&&) = 0;
virtual void storeRecordOfKeyUsage(const String& sessionId) = 0;
+
+ using PlatformDisplayID = uint32_t;
+ virtual void displayChanged(PlatformDisplayID) { }
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h (265114 => 265115)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h 2020-07-30 23:08:00 UTC (rev 265115)
@@ -66,6 +66,7 @@
virtual void sessionIdentifierChanged(NSData*) = 0;
virtual void groupSessionIdentifierChanged(AVContentKeyReportGroup*, NSData*) = 0;
virtual void outputObscuredDueToInsufficientExternalProtectionChanged(bool) = 0;
+ virtual void externalProtectionStatusDidChangeForContentKeyRequest(AVContentKeyRequest*) = 0;
};
class CDMInstanceFairPlayStreamingAVFObjC final : public CDMInstance, public AVContentKeySessionDelegateClient, public CanMakeWeakPtr<CDMInstanceFairPlayStreamingAVFObjC> {
@@ -111,6 +112,7 @@
void sessionIdentifierChanged(NSData*) final;
void groupSessionIdentifierChanged(AVContentKeyReportGroup*, NSData*) final;
void outputObscuredDueToInsufficientExternalProtectionChanged(bool) final;
+ void externalProtectionStatusDidChangeForContentKeyRequest(AVContentKeyRequest*) final;
using Keys = Vector<Ref<SharedBuffer>>;
CDMInstanceSessionFairPlayStreamingAVFObjC* sessionForKeyIDs(const Keys&) const;
@@ -154,6 +156,7 @@
void closeSession(const String&, CloseSessionCallback&&) final;
void removeSessionData(const String&, LicenseType, RemoveSessionDataCallback&&) final;
void storeRecordOfKeyUsage(const String&) final;
+ void displayChanged(PlatformDisplayID) final;
void setClient(WeakPtr<CDMInstanceSessionClient>&&) final;
void clearClient() final;
@@ -168,6 +171,7 @@
void sessionIdentifierChanged(NSData*) final;
void groupSessionIdentifierChanged(AVContentKeyReportGroup*, NSData*) final;
void outputObscuredDueToInsufficientExternalProtectionChanged(bool) final;
+ void externalProtectionStatusDidChangeForContentKeyRequest(AVContentKeyRequest*) final;
using Keys = CDMInstanceFairPlayStreamingAVFObjC::Keys;
Keys keyIDs();
@@ -196,6 +200,8 @@
const char* logClassName() const { return "CDMInstanceSessionFairPlayStreamingAVFObjC"; }
#endif
+ void updateProtectionStatusForDisplayID(PlatformDisplayID);
+
Ref<CDMInstanceFairPlayStreamingAVFObjC> m_instance;
RetainPtr<AVContentKeyReportGroup> m_group;
RetainPtr<AVContentKeySession> m_session;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (265114 => 265115)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2020-07-30 23:08:00 UTC (rev 265115)
@@ -159,6 +159,13 @@
_parent->groupSessionIdentifierChanged(reportGroup, reportGroup.contentProtectionSessionIdentifier);
}
+- (void)contentKeySession:(AVContentKeySession *)session externalProtectionStatusDidChangeForContentKeyRequest:(AVContentKeyRequest *)keyRequest
+{
+ UNUSED_PARAM(session);
+ if (_parent)
+ _parent->externalProtectionStatusDidChangeForContentKeyRequest(keyRequest);
+}
+
@end
namespace WebCore {
@@ -517,6 +524,17 @@
}
}
+void CDMInstanceFairPlayStreamingAVFObjC::externalProtectionStatusDidChangeForContentKeyRequest(AVContentKeyRequest* request)
+{
+ if (auto* session = sessionForRequest(request)) {
+ session->externalProtectionStatusDidChangeForContentKeyRequest(request);
+ return;
+ }
+
+ ASSERT_NOT_REACHED();
+ ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "- no responsible session; dropping");
+}
+
CDMInstanceSessionFairPlayStreamingAVFObjC* CDMInstanceFairPlayStreamingAVFObjC::sessionForKeyIDs(const Keys& keyIDs) const
{
for (auto& sessionInterface : m_sessions) {
@@ -981,6 +999,11 @@
// no-op; key usage data is stored automatically.
}
+void CDMInstanceSessionFairPlayStreamingAVFObjC::displayChanged(PlatformDisplayID displayID)
+{
+ updateProtectionStatusForDisplayID(displayID);
+}
+
void CDMInstanceSessionFairPlayStreamingAVFObjC::setClient(WeakPtr<CDMInstanceSessionClient>&& client)
{
m_client = WTFMove(client);
@@ -1347,6 +1370,32 @@
m_client->updateKeyStatuses(keyStatuses());
}
+void CDMInstanceSessionFairPlayStreamingAVFObjC::externalProtectionStatusDidChangeForContentKeyRequest(AVContentKeyRequest* request)
+{
+ UNUSED_PARAM(request);
+ if (!m_client)
+ return;
+
+ updateProtectionStatusForDisplayID(m_client->displayID());
+}
+
+void CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID(PlatformDisplayID displayID)
+{
+ if (m_requests.isEmpty())
+ return;
+
+ auto keyRequestHasInsufficientProtectionForDisplayID = [displayID] (auto& request) -> bool {
+ if ([request respondsToSelector:@selector(willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:)])
+ return [request willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:@[ @(displayID) ]];
+ return false;
+ };
+
+ bool outputWillBeObscured = WTF::anyOf(m_requests, [&](Request& request) {
+ return WTF::anyOf(request.requests, keyRequestHasInsufficientProtectionForDisplayID);
+ });
+ outputObscuredDueToInsufficientExternalProtectionChanged(outputWillBeObscured);
+}
+
bool CDMInstanceSessionFairPlayStreamingAVFObjC::ensureSessionOrGroup()
{
if (m_session || m_group)
Modified: trunk/Source/WebKit/ChangeLog (265114 => 265115)
--- trunk/Source/WebKit/ChangeLog 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebKit/ChangeLog 2020-07-30 23:08:00 UTC (rev 265115)
@@ -1,3 +1,18 @@
+2020-07-30 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -[AVContentKeyRequest willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:]
+ https://bugs.webkit.org/show_bug.cgi?id=214659
+ <rdar://problem/63555006>
+
+ Reviewed by Darin Adler.
+
+ Support clients in the GPU process asking for (and receiving updates to) the current displayID.
+
+ * GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp:
+ (WebKit::RemoteCDMInstanceSessionProxy::displayIDChanged):
+ * GPUProcess/media/RemoteCDMInstanceSessionProxy.h:
+ * GPUProcess/media/RemoteCDMInstanceSessionProxy.messages.in:
+
2020-07-30 Antoine Quint <[email protected]>
[ iOS ] webanimations/accelerated-animation-with-easing.html is still flaky
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp (265114 => 265115)
--- trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp 2020-07-30 23:08:00 UTC (rev 265115)
@@ -127,6 +127,11 @@
m_session->storeRecordOfKeyUsage(sessionId);
}
+void RemoteCDMInstanceSessionProxy::displayIDChanged(PlatformDisplayID displayID)
+{
+ m_session->displayChanged(displayID);
+}
+
void RemoteCDMInstanceSessionProxy::updateKeyStatuses(KeyStatusVector&& keyStatuses)
{
if (!m_cdm)
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.h (265114 => 265115)
--- trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.h 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.h 2020-07-30 23:08:00 UTC (rev 265115)
@@ -73,15 +73,18 @@
void closeSession(const String& sessionId, CloseSessionCallback&&);
void removeSessionData(const String& sessionId, LicenseType, RemoveSessionDataCallback&&);
void storeRecordOfKeyUsage(const String& sessionId);
+ void displayIDChanged(PlatformDisplayID);
// CDMInstanceSessionClient
void updateKeyStatuses(KeyStatusVector&&) final;
void sendMessage(WebCore::CDMMessageType, Ref<WebCore::SharedBuffer>&& message) final;
void sessionIdChanged(const String&) final;
+ PlatformDisplayID displayID() final { return m_displayID; }
WeakPtr<RemoteCDMProxy> m_cdm;
Ref<WebCore::CDMInstanceSession> m_session;
RemoteCDMInstanceSessionIdentifier m_identifier;
+ PlatformDisplayID m_displayID { 0 };
};
}
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.messages.in (265114 => 265115)
--- trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.messages.in 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.messages.in 2020-07-30 23:08:00 UTC (rev 265115)
@@ -32,6 +32,7 @@
CloseSession(String sessionId) -> () Async
RemoveSessionData(String sessionId, WebCore::CDMInstanceSession::LicenseType type) -> (WebCore::CDMInstanceSession::KeyStatusVector changedKeys, Optional<IPC::SharedBufferDataReference> message, bool succeeded) Async
StoreRecordOfKeyUsage(String sessionId)
+ DisplayIDChanged(uint32_t displayID)
}
#endif
Modified: trunk/Tools/ChangeLog (265114 => 265115)
--- trunk/Tools/ChangeLog 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Tools/ChangeLog 2020-07-30 23:08:00 UTC (rev 265115)
@@ -1,3 +1,15 @@
+2020-07-30 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -[AVContentKeyRequest willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:]
+ https://bugs.webkit.org/show_bug.cgi?id=214659
+ <rdar://problem/63555006>
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WTF/Observer.cpp: Added.
+ (TestWebKitAPI::TEST):
+
2020-07-30 David Kilzer <[email protected]>
check-webkit-style should enforce acronym capitalization at start/end of an identifier
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (265114 => 265115)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-07-30 22:27:30 UTC (rev 265114)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-07-30 23:08:00 UTC (rev 265115)
@@ -979,6 +979,7 @@
CD2D0D1A213465560018C784 /* NowPlaying.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD2D0D19213465560018C784 /* NowPlaying.mm */; };
CD3065E02165682E00E895DF /* VideoQualityDisplayCompositing.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD3065DF2165682E00E895DF /* VideoQualityDisplayCompositing.mm */; };
CD321B041E3A85FA00EB21C8 /* video-with-muted-audio-and-webaudio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD321B031E3A84B700EB21C8 /* video-with-muted-audio-and-webaudio.html */; };
+ CD48A87324C8A66F00F5800C /* Observer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD48A87224C8A66F00F5800C /* Observer.cpp */; };
CD577799211CE0E4001B371E /* web-audio-only.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD577798211CDE8F001B371E /* web-audio-only.html */; };
CD57779C211CE91F001B371E /* audio-with-web-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD57779A211CE6B7001B371E /* audio-with-web-audio.html */; };
CD57779D211CE91F001B371E /* video-with-audio-and-web-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CD57779B211CE6CE001B371E /* video-with-audio-and-web-audio.html */; };
@@ -2650,6 +2651,7 @@
CD2D0D19213465560018C784 /* NowPlaying.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NowPlaying.mm; sourceTree = "<group>"; };
CD3065DF2165682E00E895DF /* VideoQualityDisplayCompositing.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoQualityDisplayCompositing.mm; sourceTree = "<group>"; };
CD321B031E3A84B700EB21C8 /* video-with-muted-audio-and-webaudio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "video-with-muted-audio-and-webaudio.html"; sourceTree = "<group>"; };
+ CD48A87224C8A66F00F5800C /* Observer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Observer.cpp; sourceTree = "<group>"; };
CD5393C91757BAC400C07123 /* SHA1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SHA1.cpp; sourceTree = "<group>"; };
CD5451E919E41F9D0016936F /* CSSParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSParser.cpp; sourceTree = "<group>"; };
CD5497B315857F0C00B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
@@ -4131,6 +4133,7 @@
CE78705C2107AB8C0053AC67 /* MoveOnlyLifecycleLogger.h */,
FEB6F74E1B2BA44E009E4922 /* NakedPtr.cpp */,
A57D54F21F338C3600A97AA7 /* NeverDestroyed.cpp */,
+ CD48A87224C8A66F00F5800C /* Observer.cpp */,
1AFDE6541953B2C000C48FFA /* Optional.cpp */,
CE50D8C81C8665CE0072EA5A /* OptionSet.cpp */,
E32B549122810AC0008AD702 /* Packed.cpp */,
@@ -4856,6 +4859,7 @@
E32B549222810AC4008AD702 /* Packed.cpp in Sources */,
E38D65CA23A45FAA0063D69A /* PackedRef.cpp in Sources */,
E38D65CB23A45FAA0063D69A /* PackedRefPtr.cpp in Sources */,
+ CD48A87324C8A66F00F5800C /* Observer.cpp in Sources */,
7C83DF591D0A590C00FEBCF3 /* ParkingLot.cpp in Sources */,
53EC25411E96FD87000831B9 /* PriorityQueue.cpp in Sources */,
7C83DF131D0A590C00FEBCF3 /* RedBlackTree.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/Observer.cpp (0 => 265115)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/Observer.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Observer.cpp 2020-07-30 23:08:00 UTC (rev 265115)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <wtf/Observer.h>
+
+namespace TestWebKitAPI {
+
+TEST(WTF_Observer, Basic)
+{
+ bool testValue = false;
+
+ Observer<void(bool)> observer([&] (bool value) {
+ testValue = value;
+ });
+
+ observer(true);
+
+ EXPECT_TRUE(testValue);
+}
+
+TEST(WTF_Observer, Weak)
+{
+ bool testValue = false;
+
+ auto uniqueObserver = WTF::makeUnique<Observer<void(bool)>>([&] (bool value) {
+ testValue = value;
+ });
+
+ auto weakObserver = makeWeakPtr(uniqueObserver.get());
+
+ ASSERT_TRUE(static_cast<bool>(weakObserver));
+
+ (*weakObserver)(true);
+
+ EXPECT_TRUE(testValue);
+
+ uniqueObserver = nullptr;
+
+ EXPECT_FALSE(static_cast<bool>(weakObserver));
+}
+
+
+}