<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[224707] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/224707">224707</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2017-11-10 15:02:14 -0800 (Fri, 10 Nov 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a FairPlay Streaming based CDM for Modern EME
https://bugs.webkit.org/show_bug.cgi?id=179499
<rdar://problem/35445033>

Reviewed by Eric Carlson.

Source/WebCore:

Tests: platform/mac/media/encrypted-media/fps-createMediaKeys.html
       platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html

Add new CDMFairPlayStreaming and CDMInstanceFairPlayStreamingAVFObjC platform classes which implement
the basics of FairPlay Streaming support in Modern EME.

Drive-by fixes:

- Add a != operator to FourCC
- Add a virtual setStorageDirectory() method to CDMInstance (and default implementations to CDMClearKey
  and MockCDM)
- Move ISOVTTCue into the platform/graphics/iso directory and update all the places where it is called.

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::mediaKeysStorageDirectory const):
* Modules/encryptedmedia/MediaKeySession.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/encryptedmedia/CDMFactory.cpp:
* platform/encryptedmedia/CDMInstance.h:
* platform/encryptedmedia/CDMRestrictions.h:
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::CDMInstanceClearKey::setStorageDirectory):
* platform/encryptedmedia/clearkey/CDMClearKey.h:
* platform/graphics/FourCC.h:
(WebCore::FourCC::operator!= const):
* platform/graphics/iso/ISOBox.cpp: Added.
(WebCore::ISOBox::peekBox):
(WebCore::ISOBox::read):
(WebCore::ISOBox::parse):
(WebCore::ISOFullBox::parse):
* platform/graphics/iso/ISOBox.h: Added.
(WebCore::ISOBox::minimumBoxSize):
(WebCore::ISOBox::size const):
(WebCore::ISOBox::boxType const):
(WebCore::ISOBox::extendedType const):
(WebCore::ISOBox::checkedRead):
(WebCore::ISOFullBox::version const):
(WebCore::ISOFullBox::flags const):
* platform/graphics/iso/ISOOriginalFormatBox.cpp: Added.
(WebCore::ISOOriginalFormatBox::parse):
* platform/graphics/iso/ISOOriginalFormatBox.h: Added.
(WebCore::ISOOriginalFormatBox::boxTypeName):
(WebCore::ISOOriginalFormatBox::dataFormat const):
* platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp: Added.
(WebCore::ISOProtectionSchemeInfoBox::parse):
* platform/graphics/iso/ISOProtectionSchemeInfoBox.h: Added.
(WebCore::ISOProtectionSchemeInfoBox::boxTypeName):
(WebCore::ISOProtectionSchemeInfoBox::schemeTypeBox const):
(WebCore::ISOProtectionSchemeInfoBox::schemeInformationBox const):
* platform/graphics/iso/ISOSchemeInformationBox.cpp: Added.
(WebCore::ISOSchemeInformationBox::parse):
* platform/graphics/iso/ISOSchemeInformationBox.h: Added.
(WebCore::ISOSchemeInformationBox::boxTypeName):
(WebCore::ISOSchemeInformationBox::schemeSpecificData const):
* platform/graphics/iso/ISOSchemeTypeBox.cpp: Added.
(WebCore::ISOSchemeTypeBox::parse):
* platform/graphics/iso/ISOSchemeTypeBox.h: Added.
(WebCore::ISOSchemeTypeBox::boxTypeName):
(WebCore::ISOSchemeTypeBox::schemeType const):
(WebCore::ISOSchemeTypeBox::schemeVersion const):
* platform/graphics/iso/ISOTrackEncryptionBox.cpp: Added.
(WebCore::ISOTrackEncryptionBox::parse):
* platform/graphics/iso/ISOTrackEncryptionBox.h: Added.
(WebCore::ISOTrackEncryptionBox::boxTypeName):
(WebCore::ISOTrackEncryptionBox::defaultCryptByteBlock const):
(WebCore::ISOTrackEncryptionBox::defaultSkipByteBlock const):
(WebCore::ISOTrackEncryptionBox::defaultIsProtected const):
(WebCore::ISOTrackEncryptionBox::defaultPerSampleIVSize const):
(WebCore::ISOTrackEncryptionBox::defaultKID const):
(WebCore::ISOTrackEncryptionBox::defaultConstantIV const):
* platform/graphics/iso/ISOVTTCue.cpp: Added.
(WebCore::ISOStringBox::contents):
(WebCore::vttIdBoxType):
(WebCore::vttSettingsBoxType):
(WebCore::vttPayloadBoxType):
(WebCore::vttCurrentTimeBoxType):
(WebCore::vttCueSourceIDBoxType):
(WebCore::ISOWebVTTCue::ISOWebVTTCue):
(WebCore::ISOWebVTTCue::parse):
* platform/graphics/iso/ISOVTTCue.h: Renamed from Source/WebCore/platform/graphics/ISOVTTCue.h.
(WebCore::ISOWebVTTCue::boxTypeName):
(WebCore::ISOWebVTTCue::presentationTime const):
(WebCore::ISOWebVTTCue::duration const):
(WebCore::ISOWebVTTCue::sourceID const):
(WebCore::ISOWebVTTCue::id const):
(WebCore::ISOWebVTTCue::originalStartTime const):
(WebCore::ISOWebVTTCue::settings const):
(WebCore::ISOWebVTTCue::cueText const):
* platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: Added.
(WebCore::extractSinfData):
(WebCore::extractSchemeAndKeyIdFromSinf):
(WebCore::extractKeyIDsSinf):
(WebCore::sanitizeSinf):
(WebCore::CDMFactory::platformRegisterFactories):
(WebCore::CDMFactoryFairPlayStreaming::singleton):
(WebCore::CDMFactoryFairPlayStreaming::createCDM):
(WebCore::CDMFactoryFairPlayStreaming::supportsKeySystem):
(WebCore::CDMPrivateFairPlayStreaming::supportsInitDataType const):
(WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
(WebCore::CDMPrivateFairPlayStreaming::supportsConfigurationWithRestrictions const):
(WebCore::CDMPrivateFairPlayStreaming::supportsSessionTypeWithConfiguration const):
(WebCore::CDMPrivateFairPlayStreaming::supportsRobustness const):
(WebCore::CDMPrivateFairPlayStreaming::distinctiveIdentifiersRequirement const):
(WebCore::CDMPrivateFairPlayStreaming::persistentStateRequirement const):
(WebCore::CDMPrivateFairPlayStreaming::distinctiveIdentifiersAreUniquePerOriginAndClearable const):
(WebCore::CDMPrivateFairPlayStreaming::createInstance):
(WebCore::CDMPrivateFairPlayStreaming::loadAndInitialize):
(WebCore::CDMPrivateFairPlayStreaming::supportsServerCertificates const):
(WebCore::CDMPrivateFairPlayStreaming::supportsSessions const):
(WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
(WebCore::CDMPrivateFairPlayStreaming::sanitizeResponse const):
(WebCore::CDMPrivateFairPlayStreaming::sanitizeSessionId const):
* platform/graphics/avfoundation/CDMFairPlayStreaming.h: Added.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: Added.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: Added.
(-[WebCoreFPSContentKeySessionDelegate initWithParent:]):
(-[WebCoreFPSContentKeySessionDelegate invalidate]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvideContentKeyRequest:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvideRenewingContentKeyRequest:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvidePersistableContentKeyRequest:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:didUpdatePersistableContentKey:forContentKeyIdentifier:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequest:didFailWithError:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:shouldRetryContentKeyRequest:reason:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySessionContentProtectionSessionIdentifierDidChange:]):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::~CDMInstanceFairPlayStreamingAVFObjC):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsPersistableState):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsPersistentKeys):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setDistinctiveIdentifiersAllowed):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setPersistentStateAllowed):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setServerCertificate):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::isLicenseTypeSupported const):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::storeRecordOfKeyUsage):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::keySystem const):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRenewingRequest):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvidePersistableRequest):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
(WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
* testing/MockCDMFactory.cpp:
(WebCore::MockCDMInstance::setStorageDirectory):
* testing/MockCDMFactory.h:

Source/WTF:

* wtf/Platform.h:

LayoutTests:

* platform/mac/TestExpectations:
* platform/mac/media/encrypted-media/fps-createMediaKeys-expected.txt: Added.
* platform/mac/media/encrypted-media/fps-createMediaKeys.html: Added.
* platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess-expected.txt: Added.
* platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfPlatformh">trunk/Source/WTF/wtf/Platform.h</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeySessioncpp">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeySessionh">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepageSettingsyaml">trunk/Source/WebCore/page/Settings.yaml</a></li>
<li><a href="#trunkSourceWebCoreplatformencryptedmediaCDMFactorycpp">trunk/Source/WebCore/platform/encryptedmedia/CDMFactory.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformencryptedmediaCDMInstanceh">trunk/Source/WebCore/platform/encryptedmedia/CDMInstance.h</a></li>
<li><a href="#trunkSourceWebCoreplatformencryptedmediaCDMRestrictionsh">trunk/Source/WebCore/platform/encryptedmedia/CDMRestrictions.h</a></li>
<li><a href="#trunkSourceWebCoreplatformencryptedmediaclearkeyCDMClearKeycpp">trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformencryptedmediaclearkeyCDMClearKeyh">trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFourCCh">trunk/Source/WebCore/platform/graphics/FourCC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationInbandTextTrackPrivateAVFcpp">trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockCDMFactorycpp">trunk/Source/WebCore/testing/MockCDMFactory.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockCDMFactoryh">trunk/Source/WebCore/testing/MockCDMFactory.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacmediaencryptedmediafpscreateMediaKeysexpectedtxt">trunk/LayoutTests/platform/mac/media/encrypted-media/fps-createMediaKeys-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacmediaencryptedmediafpscreateMediaKeyshtml">trunk/LayoutTests/platform/mac/media/encrypted-media/fps-createMediaKeys.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacmediaencryptedmediafpsrequestMediaKeySystemAccessexpectedtxt">trunk/LayoutTests/platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacmediaencryptedmediafpsrequestMediaKeySystemAccesshtml">trunk/LayoutTests/platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationCDMFairPlayStreamingcpp">trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationCDMFairPlayStreamingh">trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMInstanceFairPlayStreamingAVFObjCh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMInstanceFairPlayStreamingAVFObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm</a></li>
<li>trunk/Source/WebCore/platform/graphics/iso/</li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOBoxcpp">trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOBoxh">trunk/Source/WebCore/platform/graphics/iso/ISOBox.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOOriginalFormatBoxcpp">trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOOriginalFormatBoxh">trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOProtectionSchemeInfoBoxcpp">trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOProtectionSchemeInfoBoxh">trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOSchemeInformationBoxcpp">trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOSchemeInformationBoxh">trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOSchemeTypeBoxcpp">trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOSchemeTypeBoxh">trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOTrackEncryptionBoxcpp">trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOTrackEncryptionBoxh">trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOVTTCuecpp">trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsisoISOVTTCueh">trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsISOVTTCuecpp">trunk/Source/WebCore/platform/graphics/ISOVTTCue.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsISOVTTCueh">trunk/Source/WebCore/platform/graphics/ISOVTTCue.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/LayoutTests/ChangeLog 2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-11-10  Jer Noble  <jer.noble@apple.com>
+
+        Add a FairPlay Streaming based CDM for Modern EME
+        https://bugs.webkit.org/show_bug.cgi?id=179499
+        <rdar://problem/35445033>
+
+        Reviewed by Eric Carlson.
+
+        * platform/mac/TestExpectations:
+        * platform/mac/media/encrypted-media/fps-createMediaKeys-expected.txt: Added.
+        * platform/mac/media/encrypted-media/fps-createMediaKeys.html: Added.
+        * platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess-expected.txt: Added.
+        * platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html: Added.
+
</ins><span class="cx"> 2017-11-10  Megan Gardner  <megan_gardner@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Rebase some layout tests
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations  2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/LayoutTests/platform/mac/TestExpectations     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -1740,3 +1740,7 @@
</span><span class="cx"> webkit.org/b/175998 http/tests/security/mixedContent/insecure-css-with-secure-cookies.html [ Pass Failure ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/179342 http/tests/workers/service/registration-task-queue-scheduling-1.html [ Pass Failure ]
</span><ins>+
+# AVContentKeySession not available pre-High Sierra
+[ ElCapitan Sierra ] platform/mac/media/encrypted-media/fps-createMediaKeys.html [ Skip ]
+[ ElCapitan Sierra ] platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html [ Skip ]
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacmediaencryptedmediafpscreateMediaKeysexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-createMediaKeys-expected.txt (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-createMediaKeys-expected.txt                            (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-createMediaKeys-expected.txt       2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+RUN(promise = navigator.requestMediaKeySystemAccess("com.apple.fps", capabilities))
+Promise resolved OK
+RUN(promise = access.createMediaKeys())
+Promise resolved OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacmediaencryptedmediafpscreateMediaKeyshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-createMediaKeys.html (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-createMediaKeys.html                            (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-createMediaKeys.html       2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+    <title>fps-requestMediaKeySystemAccess</title>
+    <script src="../../../../media/video-test.js"></script>
+    <script>
+    var capabilities = [{
+        initDataTypes: ['sinf'],
+        videoCapabilities: [{ contentType: 'video/mp4', robustness: '' }],
+        distinctiveIdentifier: 'not-allowed',
+        persistentState: 'not-allowed',
+        sessionTypes: ['temporary'],
+    }];
+    var promise;
+    var access;
+
+    function startTest() {
+        run('promise = navigator.requestMediaKeySystemAccess("com.apple.fps", capabilities)');
+        shouldResolve(promise).then(gotAccess, endTest);
+    }
+
+    function gotAccess(access) {
+        window.access = access;
+        run('promise = access.createMediaKeys()');
+        shouldResolve(promise).then(endTest, endTest);
+    }
+
+    window.addEventListener('load', startTest);
+    </script>
+</head>
+<body>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacmediaencryptedmediafpsrequestMediaKeySystemAccessexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess-expected.txt (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess-expected.txt   2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+RUN(promise = navigator.requestMediaKeySystemAccess("com.apple.fps", capabilities))
+Promise resolved OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacmediaencryptedmediafpsrequestMediaKeySystemAccesshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html   2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+    <title>fps-requestMediaKeySystemAccess</title>
+    <script src="../../../../media/video-test.js"></script>
+    <script>
+    var capabilities = [{
+        initDataTypes: ['sinf'],
+        videoCapabilities: [{ contentType: 'video/mp4', robustness: '' }],
+        distinctiveIdentifier: 'not-allowed',
+        persistentState: 'not-allowed',
+        sessionTypes: ['temporary'],
+    }];
+    var promise;
+
+    function startTest() {
+        run('promise = navigator.requestMediaKeySystemAccess("com.apple.fps", capabilities)');
+        shouldResolve(promise).then(endTest);
+    }
+
+    window.addEventListener('load', startTest);
+    </script>
+</head>
+<body>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WTF/ChangeLog  2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-11-10  Jer Noble  <jer.noble@apple.com>
+
+        Add a FairPlay Streaming based CDM for Modern EME
+        https://bugs.webkit.org/show_bug.cgi?id=179499
+        <rdar://problem/35445033>
+
+        Reviewed by Eric Carlson.
+
+        * wtf/Platform.h:
+
</ins><span class="cx"> 2017-11-10  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Platform.h (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Platform.h  2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WTF/wtf/Platform.h     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -1276,4 +1276,8 @@
</span><span class="cx"> #define HAVE_STACK_BOUNDS_FOR_NEW_THREAD 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300)
+#define HAVE_AVCONTENTKEYSESSION 1
+#endif
+
</ins><span class="cx"> #endif /* WTF_Platform_h */
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt      2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -104,6 +104,7 @@
</span><span class="cx">     "${WEBCORE_DIR}/platform/graphics/filters"
</span><span class="cx">     "${WEBCORE_DIR}/platform/graphics/harfbuzz"
</span><span class="cx">     "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng"
</span><ins>+    "${WEBCORE_DIR}/platform/graphics/iso"
</ins><span class="cx">     "${WEBCORE_DIR}/platform/graphics/opentype"
</span><span class="cx">     "${WEBCORE_DIR}/platform/graphics/transforms"
</span><span class="cx">     "${WEBCORE_DIR}/platform/mediastream"
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/ChangeLog      2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -1,3 +1,167 @@
</span><ins>+2017-11-10  Jer Noble  <jer.noble@apple.com>
+
+        Add a FairPlay Streaming based CDM for Modern EME
+        https://bugs.webkit.org/show_bug.cgi?id=179499
+        <rdar://problem/35445033>
+
+        Reviewed by Eric Carlson.
+
+        Tests: platform/mac/media/encrypted-media/fps-createMediaKeys.html
+               platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html
+
+        Add new CDMFairPlayStreaming and CDMInstanceFairPlayStreamingAVFObjC platform classes which implement
+        the basics of FairPlay Streaming support in Modern EME.
+
+        Drive-by fixes:
+
+        - Add a != operator to FourCC
+        - Add a virtual setStorageDirectory() method to CDMInstance (and default implementations to CDMClearKey
+          and MockCDM)
+        - Move ISOVTTCue into the platform/graphics/iso directory and update all the places where it is called.
+
+        * Modules/encryptedmedia/MediaKeySession.cpp:
+        (WebCore::MediaKeySession::mediaKeysStorageDirectory const):
+        * Modules/encryptedmedia/MediaKeySession.h:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/encryptedmedia/CDMFactory.cpp:
+        * platform/encryptedmedia/CDMInstance.h:
+        * platform/encryptedmedia/CDMRestrictions.h:
+        * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
+        (WebCore::CDMInstanceClearKey::setStorageDirectory):
+        * platform/encryptedmedia/clearkey/CDMClearKey.h:
+        * platform/graphics/FourCC.h:
+        (WebCore::FourCC::operator!= const):
+        * platform/graphics/iso/ISOBox.cpp: Added.
+        (WebCore::ISOBox::peekBox):
+        (WebCore::ISOBox::read):
+        (WebCore::ISOBox::parse):
+        (WebCore::ISOFullBox::parse):
+        * platform/graphics/iso/ISOBox.h: Added.
+        (WebCore::ISOBox::minimumBoxSize):
+        (WebCore::ISOBox::size const):
+        (WebCore::ISOBox::boxType const):
+        (WebCore::ISOBox::extendedType const):
+        (WebCore::ISOBox::checkedRead):
+        (WebCore::ISOFullBox::version const):
+        (WebCore::ISOFullBox::flags const):
+        * platform/graphics/iso/ISOOriginalFormatBox.cpp: Added.
+        (WebCore::ISOOriginalFormatBox::parse):
+        * platform/graphics/iso/ISOOriginalFormatBox.h: Added.
+        (WebCore::ISOOriginalFormatBox::boxTypeName):
+        (WebCore::ISOOriginalFormatBox::dataFormat const):
+        * platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp: Added.
+        (WebCore::ISOProtectionSchemeInfoBox::parse):
+        * platform/graphics/iso/ISOProtectionSchemeInfoBox.h: Added.
+        (WebCore::ISOProtectionSchemeInfoBox::boxTypeName):
+        (WebCore::ISOProtectionSchemeInfoBox::schemeTypeBox const):
+        (WebCore::ISOProtectionSchemeInfoBox::schemeInformationBox const):
+        * platform/graphics/iso/ISOSchemeInformationBox.cpp: Added.
+        (WebCore::ISOSchemeInformationBox::parse):
+        * platform/graphics/iso/ISOSchemeInformationBox.h: Added.
+        (WebCore::ISOSchemeInformationBox::boxTypeName):
+        (WebCore::ISOSchemeInformationBox::schemeSpecificData const):
+        * platform/graphics/iso/ISOSchemeTypeBox.cpp: Added.
+        (WebCore::ISOSchemeTypeBox::parse):
+        * platform/graphics/iso/ISOSchemeTypeBox.h: Added.
+        (WebCore::ISOSchemeTypeBox::boxTypeName):
+        (WebCore::ISOSchemeTypeBox::schemeType const):
+        (WebCore::ISOSchemeTypeBox::schemeVersion const):
+        * platform/graphics/iso/ISOTrackEncryptionBox.cpp: Added.
+        (WebCore::ISOTrackEncryptionBox::parse):
+        * platform/graphics/iso/ISOTrackEncryptionBox.h: Added.
+        (WebCore::ISOTrackEncryptionBox::boxTypeName):
+        (WebCore::ISOTrackEncryptionBox::defaultCryptByteBlock const):
+        (WebCore::ISOTrackEncryptionBox::defaultSkipByteBlock const):
+        (WebCore::ISOTrackEncryptionBox::defaultIsProtected const):
+        (WebCore::ISOTrackEncryptionBox::defaultPerSampleIVSize const):
+        (WebCore::ISOTrackEncryptionBox::defaultKID const):
+        (WebCore::ISOTrackEncryptionBox::defaultConstantIV const):
+        * platform/graphics/iso/ISOVTTCue.cpp: Added.
+        (WebCore::ISOStringBox::contents):
+        (WebCore::vttIdBoxType):
+        (WebCore::vttSettingsBoxType):
+        (WebCore::vttPayloadBoxType):
+        (WebCore::vttCurrentTimeBoxType):
+        (WebCore::vttCueSourceIDBoxType):
+        (WebCore::ISOWebVTTCue::ISOWebVTTCue):
+        (WebCore::ISOWebVTTCue::parse):
+        * platform/graphics/iso/ISOVTTCue.h: Renamed from Source/WebCore/platform/graphics/ISOVTTCue.h.
+        (WebCore::ISOWebVTTCue::boxTypeName):
+        (WebCore::ISOWebVTTCue::presentationTime const):
+        (WebCore::ISOWebVTTCue::duration const):
+        (WebCore::ISOWebVTTCue::sourceID const):
+        (WebCore::ISOWebVTTCue::id const):
+        (WebCore::ISOWebVTTCue::originalStartTime const):
+        (WebCore::ISOWebVTTCue::settings const):
+        (WebCore::ISOWebVTTCue::cueText const):
+        * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: Added.
+        (WebCore::extractSinfData):
+        (WebCore::extractSchemeAndKeyIdFromSinf):
+        (WebCore::extractKeyIDsSinf):
+        (WebCore::sanitizeSinf):
+        (WebCore::CDMFactory::platformRegisterFactories):
+        (WebCore::CDMFactoryFairPlayStreaming::singleton):
+        (WebCore::CDMFactoryFairPlayStreaming::createCDM):
+        (WebCore::CDMFactoryFairPlayStreaming::supportsKeySystem):
+        (WebCore::CDMPrivateFairPlayStreaming::supportsInitDataType const):
+        (WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
+        (WebCore::CDMPrivateFairPlayStreaming::supportsConfigurationWithRestrictions const):
+        (WebCore::CDMPrivateFairPlayStreaming::supportsSessionTypeWithConfiguration const):
+        (WebCore::CDMPrivateFairPlayStreaming::supportsRobustness const):
+        (WebCore::CDMPrivateFairPlayStreaming::distinctiveIdentifiersRequirement const):
+        (WebCore::CDMPrivateFairPlayStreaming::persistentStateRequirement const):
+        (WebCore::CDMPrivateFairPlayStreaming::distinctiveIdentifiersAreUniquePerOriginAndClearable const):
+        (WebCore::CDMPrivateFairPlayStreaming::createInstance):
+        (WebCore::CDMPrivateFairPlayStreaming::loadAndInitialize):
+        (WebCore::CDMPrivateFairPlayStreaming::supportsServerCertificates const):
+        (WebCore::CDMPrivateFairPlayStreaming::supportsSessions const):
+        (WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
+        (WebCore::CDMPrivateFairPlayStreaming::sanitizeResponse const):
+        (WebCore::CDMPrivateFairPlayStreaming::sanitizeSessionId const):
+        * platform/graphics/avfoundation/CDMFairPlayStreaming.h: Added.
+        * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: Added.
+        * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: Added.
+        (-[WebCoreFPSContentKeySessionDelegate initWithParent:]):
+        (-[WebCoreFPSContentKeySessionDelegate invalidate]):
+        (-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvideContentKeyRequest:]):
+        (-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvideRenewingContentKeyRequest:]):
+        (-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvidePersistableContentKeyRequest:]):
+        (-[WebCoreFPSContentKeySessionDelegate contentKeySession:didUpdatePersistableContentKey:forContentKeyIdentifier:]):
+        (-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequest:didFailWithError:]):
+        (-[WebCoreFPSContentKeySessionDelegate contentKeySession:shouldRetryContentKeyRequest:reason:]):
+        (-[WebCoreFPSContentKeySessionDelegate contentKeySessionContentProtectionSessionIdentifierDidChange:]):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::~CDMInstanceFairPlayStreamingAVFObjC):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsPersistableState):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsPersistentKeys):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setDistinctiveIdentifiersAllowed):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setPersistentStateAllowed):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setServerCertificate):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::isLicenseTypeSupported const):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::storeRecordOfKeyUsage):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keySystem const):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRenewingRequest):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvidePersistableRequest):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+        (WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
+        (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
+        * testing/MockCDMFactory.cpp:
+        (WebCore::MockCDMInstance::setStorageDirectory):
+        * testing/MockCDMFactory.h:
+
</ins><span class="cx"> 2017-11-10  Antoine Quint  <graouts@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Web Animations] Implement getAnimations()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeySessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp  2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -40,7 +40,10 @@
</span><span class="cx"> #include "MediaKeyStatusMap.h"
</span><span class="cx"> #include "MediaKeys.h"
</span><span class="cx"> #include "NotImplemented.h"
</span><ins>+#include "Page.h"
</ins><span class="cx"> #include "SecurityOrigin.h"
</span><ins>+#include "SecurityOriginData.h"
+#include "Settings.h"
</ins><span class="cx"> #include "SharedBuffer.h"
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -677,6 +680,23 @@
</span><span class="cx">     m_closedPromise.resolve();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String MediaKeySession::mediaKeysStorageDirectory() const
+{
+    auto* document = downcast<Document>(scriptExecutionContext());
+    if (!document)
+        return emptyString();
+
+    auto* page = document->page();
+    if (!page || page->usesEphemeralSession())
+        return emptyString();
+
+    auto storageDirectory = document->settings().mediaKeysStorageDirectory();
+    if (storageDirectory.isEmpty())
+        return emptyString();
+
+    return FileSystem::pathByAppendingComponent(storageDirectory, SecurityOriginData::fromSecurityOrigin(document->securityOrigin()).databaseIdentifier());
+}
+
</ins><span class="cx"> bool MediaKeySession::hasPendingActivity() const
</span><span class="cx"> {
</span><span class="cx">     notImplemented();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeySessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h    2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h       2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx">     void updateKeyStatuses(CDMInstance::KeyStatusVector&&);
</span><span class="cx">     void updateExpiration(double);
</span><span class="cx">     void sessionClosed();
</span><ins>+    String mediaKeysStorageDirectory() const;
</ins><span class="cx"> 
</span><span class="cx">     // EventTarget
</span><span class="cx">     EventTargetInterface eventTargetInterface() const override { return MediaKeySessionEventTargetInterfaceType; }
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/Sources.txt    2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -1510,7 +1510,6 @@
</span><span class="cx"> platform/graphics/GraphicsLayerTransform.cpp
</span><span class="cx"> platform/graphics/GraphicsLayerUpdater.cpp
</span><span class="cx"> platform/graphics/GraphicsTypes.cpp
</span><del>-platform/graphics/ISOVTTCue.cpp
</del><span class="cx"> platform/graphics/Image.cpp
</span><span class="cx"> platform/graphics/ImageBuffer.cpp
</span><span class="cx"> platform/graphics/ImageDecoder.cpp
</span><span class="lines">@@ -1595,6 +1594,14 @@
</span><span class="cx"> platform/graphics/gpu/GPUTexture.cpp
</span><span class="cx"> platform/graphics/gpu/GPUTextureDescriptor.cpp
</span><span class="cx"> 
</span><ins>+platform/graphics/iso/ISOBox.cpp
+platform/graphics/iso/ISOOriginalFormatBox.cpp
+platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp
+platform/graphics/iso/ISOSchemeInformationBox.cpp
+platform/graphics/iso/ISOSchemeTypeBox.cpp
+platform/graphics/iso/ISOTrackEncryptionBox.cpp
+platform/graphics/iso/ISOVTTCue.cpp
+
</ins><span class="cx"> platform/graphics/opentype/OpenTypeMathData.cpp
</span><span class="cx"> 
</span><span class="cx"> platform/graphics/transforms/AffineTransform.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -193,7 +193,6 @@
</span><span class="cx">          07AB996918DA3C010018771E /* RTCConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AB996518DA3C010018771E /* RTCConfiguration.h */; };
</span><span class="cx">          07AB996B18DA3C010018771E /* RTCIceServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AB996718DA3C010018771E /* RTCIceServer.h */; };
</span><span class="cx">          07ABEF6E1D8A1C7600F21972 /* MediaDevicesEnumerationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 07ABEF6D1D8A1C7600F21972 /* MediaDevicesEnumerationRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-               07AC47021952102100EE9723 /* ISOVTTCue.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AC47001952102100EE9723 /* ISOVTTCue.h */; };
</del><span class="cx">           07AFF4221EFB144900B545B3 /* CoreAudioCaptureSourceIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AFF4201EFB144700B545B3 /* CoreAudioCaptureSourceIOS.h */; };
</span><span class="cx">          07AFF4231EFB144900B545B3 /* CoreAudioCaptureSourceIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07AFF4211EFB144700B545B3 /* CoreAudioCaptureSourceIOS.mm */; };
</span><span class="cx">          07B0113F1032242200FBDC33 /* AccessibilityMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */; };
</span><span class="lines">@@ -3842,8 +3841,11 @@
</span><span class="cx">          CDAB6D2917C7DE6C00C60B34 /* MediaControlsHost.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAB6D2717C7DE6C00C60B34 /* MediaControlsHost.h */; };
</span><span class="cx">          CDAB6D2E17C814EE00C60B34 /* JSMediaControlsHost.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAB6D2C17C814EE00C60B34 /* JSMediaControlsHost.h */; };
</span><span class="cx">          CDAB6D3117C9259500C60B34 /* UserAgentScripts.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAB6D2F17C9259500C60B34 /* UserAgentScripts.h */; };
</span><ins>+               CDB7045A1F7465A1003923DF /* CDMFairPlayStreaming.h in Headers */ = {isa = PBXBuildFile; fileRef = CDB704581F7465A1003923DF /* CDMFairPlayStreaming.h */; };
+               CDB7045B1F7465A1003923DF /* CDMFairPlayStreaming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB704591F7465A1003923DF /* CDMFairPlayStreaming.cpp */; };
</ins><span class="cx">           CDBEAEAC19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDBEAEAA19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.mm */; };
</span><span class="cx">          CDBEAEAD19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CDBEAEAB19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h */; };
</span><ins>+               CDC224281F756966005F077B /* CDMInstanceFairPlayStreamingAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD78A2EC1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.mm */; };
</ins><span class="cx">           CDC26B40160A8CC60026757B /* LegacyMockCDM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDC26B3C160A62B00026757B /* LegacyMockCDM.cpp */; };
</span><span class="cx">          CDC26B41160A8CCE0026757B /* LegacyMockCDM.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC26B3D160A62B00026757B /* LegacyMockCDM.h */; };
</span><span class="cx">          CDC675221EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC675201EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm */; };
</span><span class="lines">@@ -5186,8 +5188,6 @@
</span><span class="cx">          07AB996818DA3C010018771E /* RTCIceServer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCIceServer.idl; sourceTree = "<group>"; };
</span><span class="cx">          07ABEF6B1D8A1C5800F21972 /* MediaDevicesEnumerationRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaDevicesEnumerationRequest.cpp; sourceTree = "<group>"; };
</span><span class="cx">          07ABEF6D1D8A1C7600F21972 /* MediaDevicesEnumerationRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaDevicesEnumerationRequest.h; sourceTree = "<group>"; };
</span><del>-               07AC46FF1952102100EE9723 /* ISOVTTCue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOVTTCue.cpp; sourceTree = "<group>"; };
-               07AC47001952102100EE9723 /* ISOVTTCue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOVTTCue.h; sourceTree = "<group>"; };
</del><span class="cx">           07AFF4201EFB144700B545B3 /* CoreAudioCaptureSourceIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAudioCaptureSourceIOS.h; sourceTree = "<group>"; };
</span><span class="cx">          07AFF4211EFB144700B545B3 /* CoreAudioCaptureSourceIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CoreAudioCaptureSourceIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">          07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMediaControls.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -12773,6 +12773,8 @@
</span><span class="cx">          CD641EC7181ED60100EE4C41 /* MediaSample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaSample.h; sourceTree = "<group>"; };
</span><span class="cx">          CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaSessionManagerCocoa.cpp; path = cocoa/MediaSessionManagerCocoa.cpp; sourceTree = "<group>"; };
</span><span class="cx">          CD669D671D232E10004D1866 /* MediaSessionManagerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerMac.h; sourceTree = "<group>"; };
</span><ins>+               CD78A2EC1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CDMInstanceFairPlayStreamingAVFObjC.mm; sourceTree = "<group>"; };
+               CD78A2EE1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDMInstanceFairPlayStreamingAVFObjC.h; sourceTree = "<group>"; };
</ins><span class="cx">           CD7D33411C7A123F00041293 /* PixelBufferConformerCV.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PixelBufferConformerCV.cpp; path = ../cv/PixelBufferConformerCV.cpp; sourceTree = "<group>"; };
</span><span class="cx">          CD7D33421C7A123F00041293 /* PixelBufferConformerCV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PixelBufferConformerCV.h; path = ../cv/PixelBufferConformerCV.h; sourceTree = "<group>"; };
</span><span class="cx">          CD7D33451C7A16BF00041293 /* CoreVideoSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoreVideoSoftLink.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -12787,6 +12789,20 @@
</span><span class="cx">          CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenHUDWindowController.mm; sourceTree = "<group>"; };
</span><span class="cx">          CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebWindowAnimation.h; sourceTree = "<group>"; };
</span><span class="cx">          CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebWindowAnimation.mm; sourceTree = "<group>"; };
</span><ins>+               CD871C5C1FB52B6300F0B965 /* ISOSchemeTypeBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISOSchemeTypeBox.h; path = platform/graphics/iso/ISOSchemeTypeBox.h; sourceTree = SOURCE_ROOT; };
+               CD871C5E1FB52B6400F0B965 /* ISOProtectionSchemeInfoBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ISOProtectionSchemeInfoBox.cpp; path = platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp; sourceTree = SOURCE_ROOT; };
+               CD871C5F1FB52B6400F0B965 /* ISOSchemeTypeBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ISOSchemeTypeBox.cpp; path = platform/graphics/iso/ISOSchemeTypeBox.cpp; sourceTree = SOURCE_ROOT; };
+               CD871C601FB52B6500F0B965 /* ISOProtectionSchemeInfoBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISOProtectionSchemeInfoBox.h; path = platform/graphics/iso/ISOProtectionSchemeInfoBox.h; sourceTree = SOURCE_ROOT; };
+               CD871C611FB52B6500F0B965 /* ISOTrackEncryptionBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ISOTrackEncryptionBox.cpp; path = platform/graphics/iso/ISOTrackEncryptionBox.cpp; sourceTree = SOURCE_ROOT; };
+               CD871C621FB52B6500F0B965 /* ISOBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISOBox.h; path = platform/graphics/iso/ISOBox.h; sourceTree = SOURCE_ROOT; };
+               CD871C631FB52B6600F0B965 /* ISOSchemeInformationBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ISOSchemeInformationBox.cpp; path = platform/graphics/iso/ISOSchemeInformationBox.cpp; sourceTree = SOURCE_ROOT; };
+               CD871C641FB52B6700F0B965 /* ISOSchemeInformationBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISOSchemeInformationBox.h; path = platform/graphics/iso/ISOSchemeInformationBox.h; sourceTree = SOURCE_ROOT; };
+               CD871C651FB52B6700F0B965 /* ISOVTTCue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISOVTTCue.h; path = platform/graphics/iso/ISOVTTCue.h; sourceTree = SOURCE_ROOT; };
+               CD871C661FB52B6800F0B965 /* ISOTrackEncryptionBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISOTrackEncryptionBox.h; path = platform/graphics/iso/ISOTrackEncryptionBox.h; sourceTree = SOURCE_ROOT; };
+               CD871C671FB52B6800F0B965 /* ISOOriginalFormatBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISOOriginalFormatBox.h; path = platform/graphics/iso/ISOOriginalFormatBox.h; sourceTree = SOURCE_ROOT; };
+               CD871C681FB52B6900F0B965 /* ISOBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ISOBox.cpp; path = platform/graphics/iso/ISOBox.cpp; sourceTree = SOURCE_ROOT; };
+               CD871C691FB52B6900F0B965 /* ISOVTTCue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ISOVTTCue.cpp; path = platform/graphics/iso/ISOVTTCue.cpp; sourceTree = SOURCE_ROOT; };
+               CD871C6A1FB52B6A00F0B965 /* ISOOriginalFormatBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ISOOriginalFormatBox.cpp; path = platform/graphics/iso/ISOOriginalFormatBox.cpp; sourceTree = SOURCE_ROOT; };
</ins><span class="cx">           CD8A7BB9197735FE00CBD643 /* AudioSourceProviderAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AudioSourceProviderAVFObjC.mm; sourceTree = "<group>"; };
</span><span class="cx">          CD8A7BBA197735FE00CBD643 /* AudioSourceProviderAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioSourceProviderAVFObjC.h; sourceTree = "<group>"; };
</span><span class="cx">          CD8ACA861D237AA200ECC59E /* RemoteCommandListenerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteCommandListenerMac.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -12864,6 +12880,8 @@
</span><span class="cx">          CDAB6D3017C9259500C60B34 /* UserAgentScriptsData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserAgentScriptsData.cpp; sourceTree = "<group>"; };
</span><span class="cx">          CDAE8C071746B95700532D78 /* PlatformMediaSessionManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformMediaSessionManager.cpp; sourceTree = "<group>"; };
</span><span class="cx">          CDAE8C081746B95700532D78 /* PlatformMediaSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformMediaSessionManager.h; sourceTree = "<group>"; };
</span><ins>+               CDB704581F7465A1003923DF /* CDMFairPlayStreaming.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CDMFairPlayStreaming.h; sourceTree = "<group>"; };
+               CDB704591F7465A1003923DF /* CDMFairPlayStreaming.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CDMFairPlayStreaming.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           CDBEAEAA19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSelectionGroupAVFObjC.mm; sourceTree = "<group>"; };
</span><span class="cx">          CDBEAEAB19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSelectionGroupAVFObjC.h; sourceTree = "<group>"; };
</span><span class="cx">          CDC1DD4117CC2C48008CB55D /* mediaControlsApple.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = mediaControlsApple.css; sourceTree = "<group>"; };
</span><span class="lines">@@ -13242,53 +13260,53 @@
</span><span class="cx">          DE5F84CE1FA1A4AA006DB63A /* UnifiedSource422.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource422.cpp; sourceTree = "<group>"; };
</span><span class="cx">          DE5F84CF1FA1A4AB006DB63A /* UnifiedSource439.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource439.cpp; sourceTree = "<group>"; };
</span><span class="cx">          DE5F84D01FA1A4AC006DB63A /* UnifiedSource401.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource401.cpp; sourceTree = "<group>"; };
</span><del>-               DE5F853D1FA1ABB2006DB63A /* UnifiedSource8-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource8-mm.mm; sourceTree = "<group>"; };
-               DE5F853E1FA1ABB3006DB63A /* UnifiedSource15-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource15-mm.mm; sourceTree = "<group>"; };
-               DE5F853F1FA1ABB4006DB63A /* UnifiedSource28-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource28-mm.mm; sourceTree = "<group>"; };
-               DE5F85401FA1ABB5006DB63A /* UnifiedSource35-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource35-mm.mm; sourceTree = "<group>"; };
-               DE5F85411FA1ABB6006DB63A /* UnifiedSource23-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource23-mm.mm; sourceTree = "<group>"; };
-               DE5F85421FA1ABB7006DB63A /* UnifiedSource30-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource30-mm.mm; sourceTree = "<group>"; };
-               DE5F85431FA1ABB8006DB63A /* UnifiedSource44-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource44-mm.mm; sourceTree = "<group>"; };
-               DE5F85441FA1ABB9006DB63A /* UnifiedSource46-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource46-mm.mm; sourceTree = "<group>"; };
-               DE5F85451FA1ABBA006DB63A /* UnifiedSource37-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource37-mm.mm; sourceTree = "<group>"; };
-               DE5F85461FA1ABBB006DB63A /* UnifiedSource24-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource24-mm.mm; sourceTree = "<group>"; };
-               DE5F85471FA1ABBB006DB63A /* UnifiedSource25-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource25-mm.mm; sourceTree = "<group>"; };
-               DE5F85481FA1ABBC006DB63A /* UnifiedSource43-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource43-mm.mm; sourceTree = "<group>"; };
</del><ins>+                DE5F853D1FA1ABB2006DB63A /* UnifiedSource8-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource8-mm.mm"; sourceTree = "<group>"; };
+               DE5F853E1FA1ABB3006DB63A /* UnifiedSource15-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource15-mm.mm"; sourceTree = "<group>"; };
+               DE5F853F1FA1ABB4006DB63A /* UnifiedSource28-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource28-mm.mm"; sourceTree = "<group>"; };
+               DE5F85401FA1ABB5006DB63A /* UnifiedSource35-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource35-mm.mm"; sourceTree = "<group>"; };
+               DE5F85411FA1ABB6006DB63A /* UnifiedSource23-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource23-mm.mm"; sourceTree = "<group>"; };
+               DE5F85421FA1ABB7006DB63A /* UnifiedSource30-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource30-mm.mm"; sourceTree = "<group>"; };
+               DE5F85431FA1ABB8006DB63A /* UnifiedSource44-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource44-mm.mm"; sourceTree = "<group>"; };
+               DE5F85441FA1ABB9006DB63A /* UnifiedSource46-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource46-mm.mm"; sourceTree = "<group>"; };
+               DE5F85451FA1ABBA006DB63A /* UnifiedSource37-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource37-mm.mm"; sourceTree = "<group>"; };
+               DE5F85461FA1ABBB006DB63A /* UnifiedSource24-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource24-mm.mm"; sourceTree = "<group>"; };
+               DE5F85471FA1ABBB006DB63A /* UnifiedSource25-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource25-mm.mm"; sourceTree = "<group>"; };
+               DE5F85481FA1ABBC006DB63A /* UnifiedSource43-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource43-mm.mm"; sourceTree = "<group>"; };
</ins><span class="cx">           DE5F85491FA1ABBD006DB63A /* UnifiedSource4-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource4-mm.mm"; sourceTree = "<group>"; };
</span><del>-               DE5F854A1FA1ABBE006DB63A /* UnifiedSource17-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource17-mm.mm; sourceTree = "<group>"; };
-               DE5F854B1FA1ABBF006DB63A /* UnifiedSource49-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource49-mm.mm; sourceTree = "<group>"; };
-               DE5F854C1FA1ABC0006DB63A /* UnifiedSource50-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource50-mm.mm; sourceTree = "<group>"; };
-               DE5F854D1FA1ABC1006DB63A /* UnifiedSource22-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource22-mm.mm; sourceTree = "<group>"; };
-               DE5F854E1FA1ABC2006DB63A /* UnifiedSource14-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource14-mm.mm; sourceTree = "<group>"; };
-               DE5F854F1FA1ABC3006DB63A /* UnifiedSource42-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource42-mm.mm; sourceTree = "<group>"; };
-               DE5F85501FA1ABC3006DB63A /* UnifiedSource18-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource18-mm.mm; sourceTree = "<group>"; };
-               DE5F85511FA1ABC4006DB63A /* UnifiedSource31-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource31-mm.mm; sourceTree = "<group>"; };
-               DE5F85521FA1ABC5006DB63A /* UnifiedSource20-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource20-mm.mm; sourceTree = "<group>"; };
-               DE5F85531FA1ABC6006DB63A /* UnifiedSource19-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource19-mm.mm; sourceTree = "<group>"; };
-               DE5F85541FA1ABC7006DB63A /* UnifiedSource9-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource9-mm.mm; sourceTree = "<group>"; };
-               DE5F85551FA1ABC8006DB63A /* UnifiedSource36-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource36-mm.mm; sourceTree = "<group>"; };
-               DE5F85561FA1ABC9006DB63A /* UnifiedSource40-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource40-mm.mm; sourceTree = "<group>"; };
-               DE5F85571FA1ABCA006DB63A /* UnifiedSource34-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource34-mm.mm; sourceTree = "<group>"; };
-               DE5F85581FA1ABCB006DB63A /* UnifiedSource45-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource45-mm.mm; sourceTree = "<group>"; };
-               DE5F85591FA1ABCC006DB63A /* UnifiedSource39-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource39-mm.mm; sourceTree = "<group>"; };
-               DE5F855A1FA1ABCD006DB63A /* UnifiedSource21-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource21-mm.mm; sourceTree = "<group>"; };
-               DE5F855B1FA1ABCE006DB63A /* UnifiedSource33-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource33-mm.mm; sourceTree = "<group>"; };
-               DE5F855C1FA1ABCE006DB63A /* UnifiedSource38-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource38-mm.mm; sourceTree = "<group>"; };
-               DE5F855D1FA1ABCF006DB63A /* UnifiedSource26-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource26-mm.mm; sourceTree = "<group>"; };
-               DE5F855E1FA1ABD0006DB63A /* UnifiedSource16-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource16-mm.mm; sourceTree = "<group>"; };
-               DE5F855F1FA1ABD1006DB63A /* UnifiedSource7-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource7-mm.mm; sourceTree = "<group>"; };
-               DE5F85601FA1ABD2006DB63A /* UnifiedSource32-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource32-mm.mm; sourceTree = "<group>"; };
-               DE5F85611FA1ABD3006DB63A /* UnifiedSource11-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource11-mm.mm; sourceTree = "<group>"; };
-               DE5F85621FA1ABD4006DB63A /* UnifiedSource47-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource47-mm.mm; sourceTree = "<group>"; };
-               DE5F85631FA1ABD5006DB63A /* UnifiedSource10-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource10-mm.mm; sourceTree = "<group>"; };
-               DE5F85641FA1ABD5006DB63A /* UnifiedSource12-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource12-mm.mm; sourceTree = "<group>"; };
-               DE5F85651FA1ABD6006DB63A /* UnifiedSource5-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource5-mm.mm; sourceTree = "<group>"; };
-               DE5F85661FA1ABD7006DB63A /* UnifiedSource41-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource41-mm.mm; sourceTree = "<group>"; };
-               DE5F85671FA1ABD8006DB63A /* UnifiedSource48-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource48-mm.mm; sourceTree = "<group>"; };
-               DE5F85681FA1ABD9006DB63A /* UnifiedSource29-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource29-mm.mm; sourceTree = "<group>"; };
-               DE5F85691FA1ABDA006DB63A /* UnifiedSource27-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource27-mm.mm; sourceTree = "<group>"; };
-               DE5F856A1FA1ABDB006DB63A /* UnifiedSource13-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource13-mm.mm; sourceTree = "<group>"; };
-               DE5F856B1FA1ABDB006DB63A /* UnifiedSource6-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource6-mm.mm; sourceTree = "<group>"; };
</del><ins>+                DE5F854A1FA1ABBE006DB63A /* UnifiedSource17-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource17-mm.mm"; sourceTree = "<group>"; };
+               DE5F854B1FA1ABBF006DB63A /* UnifiedSource49-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource49-mm.mm"; sourceTree = "<group>"; };
+               DE5F854C1FA1ABC0006DB63A /* UnifiedSource50-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource50-mm.mm"; sourceTree = "<group>"; };
+               DE5F854D1FA1ABC1006DB63A /* UnifiedSource22-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource22-mm.mm"; sourceTree = "<group>"; };
+               DE5F854E1FA1ABC2006DB63A /* UnifiedSource14-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource14-mm.mm"; sourceTree = "<group>"; };
+               DE5F854F1FA1ABC3006DB63A /* UnifiedSource42-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource42-mm.mm"; sourceTree = "<group>"; };
+               DE5F85501FA1ABC3006DB63A /* UnifiedSource18-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource18-mm.mm"; sourceTree = "<group>"; };
+               DE5F85511FA1ABC4006DB63A /* UnifiedSource31-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource31-mm.mm"; sourceTree = "<group>"; };
+               DE5F85521FA1ABC5006DB63A /* UnifiedSource20-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource20-mm.mm"; sourceTree = "<group>"; };
+               DE5F85531FA1ABC6006DB63A /* UnifiedSource19-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource19-mm.mm"; sourceTree = "<group>"; };
+               DE5F85541FA1ABC7006DB63A /* UnifiedSource9-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource9-mm.mm"; sourceTree = "<group>"; };
+               DE5F85551FA1ABC8006DB63A /* UnifiedSource36-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource36-mm.mm"; sourceTree = "<group>"; };
+               DE5F85561FA1ABC9006DB63A /* UnifiedSource40-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource40-mm.mm"; sourceTree = "<group>"; };
+               DE5F85571FA1ABCA006DB63A /* UnifiedSource34-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource34-mm.mm"; sourceTree = "<group>"; };
+               DE5F85581FA1ABCB006DB63A /* UnifiedSource45-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource45-mm.mm"; sourceTree = "<group>"; };
+               DE5F85591FA1ABCC006DB63A /* UnifiedSource39-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource39-mm.mm"; sourceTree = "<group>"; };
+               DE5F855A1FA1ABCD006DB63A /* UnifiedSource21-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource21-mm.mm"; sourceTree = "<group>"; };
+               DE5F855B1FA1ABCE006DB63A /* UnifiedSource33-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource33-mm.mm"; sourceTree = "<group>"; };
+               DE5F855C1FA1ABCE006DB63A /* UnifiedSource38-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource38-mm.mm"; sourceTree = "<group>"; };
+               DE5F855D1FA1ABCF006DB63A /* UnifiedSource26-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource26-mm.mm"; sourceTree = "<group>"; };
+               DE5F855E1FA1ABD0006DB63A /* UnifiedSource16-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource16-mm.mm"; sourceTree = "<group>"; };
+               DE5F855F1FA1ABD1006DB63A /* UnifiedSource7-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource7-mm.mm"; sourceTree = "<group>"; };
+               DE5F85601FA1ABD2006DB63A /* UnifiedSource32-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource32-mm.mm"; sourceTree = "<group>"; };
+               DE5F85611FA1ABD3006DB63A /* UnifiedSource11-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource11-mm.mm"; sourceTree = "<group>"; };
+               DE5F85621FA1ABD4006DB63A /* UnifiedSource47-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource47-mm.mm"; sourceTree = "<group>"; };
+               DE5F85631FA1ABD5006DB63A /* UnifiedSource10-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource10-mm.mm"; sourceTree = "<group>"; };
+               DE5F85641FA1ABD5006DB63A /* UnifiedSource12-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource12-mm.mm"; sourceTree = "<group>"; };
+               DE5F85651FA1ABD6006DB63A /* UnifiedSource5-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource5-mm.mm"; sourceTree = "<group>"; };
+               DE5F85661FA1ABD7006DB63A /* UnifiedSource41-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource41-mm.mm"; sourceTree = "<group>"; };
+               DE5F85671FA1ABD8006DB63A /* UnifiedSource48-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource48-mm.mm"; sourceTree = "<group>"; };
+               DE5F85681FA1ABD9006DB63A /* UnifiedSource29-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource29-mm.mm"; sourceTree = "<group>"; };
+               DE5F85691FA1ABDA006DB63A /* UnifiedSource27-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource27-mm.mm"; sourceTree = "<group>"; };
+               DE5F856A1FA1ABDB006DB63A /* UnifiedSource13-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource13-mm.mm"; sourceTree = "<group>"; };
+               DE5F856B1FA1ABDB006DB63A /* UnifiedSource6-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource6-mm.mm"; sourceTree = "<group>"; };
</ins><span class="cx">           DE5F85B61FA23835006DB63A /* UnifiedSource468.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource468.cpp; sourceTree = "<group>"; };
</span><span class="cx">          DE5F85B71FA23835006DB63A /* UnifiedSource469.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource469.cpp; sourceTree = "<group>"; };
</span><span class="cx">          DE5F85B81FA23836006DB63A /* UnifiedSource458.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource458.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -13319,16 +13337,16 @@
</span><span class="cx">          DE5F85D11FA23854006DB63A /* UnifiedSource476.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource476.cpp; sourceTree = "<group>"; };
</span><span class="cx">          DE5F85D21FA23856006DB63A /* UnifiedSource478.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource478.cpp; sourceTree = "<group>"; };
</span><span class="cx">          DE5F85D31FA23859006DB63A /* UnifiedSource480.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource480.cpp; sourceTree = "<group>"; };
</span><del>-               DE5F86321FA2AEFF006DB63A /* UnifiedSource59-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource59-mm.mm; sourceTree = "<group>"; };
-               DE5F86331FA2AF00006DB63A /* UnifiedSource54-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource54-mm.mm; sourceTree = "<group>"; };
-               DE5F86341FA2AF01006DB63A /* UnifiedSource56-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource56-mm.mm; sourceTree = "<group>"; };
-               DE5F86351FA2AF03006DB63A /* UnifiedSource53-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource53-mm.mm; sourceTree = "<group>"; };
-               DE5F86361FA2AF04006DB63A /* UnifiedSource51-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource51-mm.mm; sourceTree = "<group>"; };
-               DE5F86371FA2AF05006DB63A /* UnifiedSource52-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource52-mm.mm; sourceTree = "<group>"; };
-               DE5F86381FA2AF06006DB63A /* UnifiedSource57-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource57-mm.mm; sourceTree = "<group>"; };
-               DE5F86391FA2AF07006DB63A /* UnifiedSource58-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource58-mm.mm; sourceTree = "<group>"; };
-               DE5F863A1FA2AF07006DB63A /* UnifiedSource60-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource60-mm.mm; sourceTree = "<group>"; };
-               DE5F863B1FA2AF08006DB63A /* UnifiedSource55-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnifiedSource55-mm.mm; sourceTree = "<group>"; };
</del><ins>+                DE5F86321FA2AEFF006DB63A /* UnifiedSource59-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource59-mm.mm"; sourceTree = "<group>"; };
+               DE5F86331FA2AF00006DB63A /* UnifiedSource54-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource54-mm.mm"; sourceTree = "<group>"; };
+               DE5F86341FA2AF01006DB63A /* UnifiedSource56-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource56-mm.mm"; sourceTree = "<group>"; };
+               DE5F86351FA2AF03006DB63A /* UnifiedSource53-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource53-mm.mm"; sourceTree = "<group>"; };
+               DE5F86361FA2AF04006DB63A /* UnifiedSource51-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource51-mm.mm"; sourceTree = "<group>"; };
+               DE5F86371FA2AF05006DB63A /* UnifiedSource52-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource52-mm.mm"; sourceTree = "<group>"; };
+               DE5F86381FA2AF06006DB63A /* UnifiedSource57-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource57-mm.mm"; sourceTree = "<group>"; };
+               DE5F86391FA2AF07006DB63A /* UnifiedSource58-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource58-mm.mm"; sourceTree = "<group>"; };
+               DE5F863A1FA2AF07006DB63A /* UnifiedSource60-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource60-mm.mm"; sourceTree = "<group>"; };
+               DE5F863B1FA2AF08006DB63A /* UnifiedSource55-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource55-mm.mm"; sourceTree = "<group>"; };
</ins><span class="cx">           DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomEventCustom.cpp; sourceTree = "<group>"; };
</span><span class="cx">          DECA7D6A1F9E61CB00E3B661 /* UnifiedSource144.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource144.cpp; sourceTree = "<group>"; };
</span><span class="cx">          DECA7D6B1F9E61CC00E3B661 /* UnifiedSource148.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource148.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -14732,6 +14750,8 @@
</span><span class="cx">                          CDE3A85217F5FCE600C5BE20 /* AudioTrackPrivateAVF.h */,
</span><span class="cx">                          CD336F6017F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h */,
</span><span class="cx">                          CD336F5F17F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm */,
</span><ins>+                               CDB704591F7465A1003923DF /* CDMFairPlayStreaming.cpp */,
+                               CDB704581F7465A1003923DF /* CDMFairPlayStreaming.h */,
</ins><span class="cx">                           CD318621199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h */,
</span><span class="cx">                          CD318620199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.mm */,
</span><span class="cx">                          07E9E12F18F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp */,
</span><span class="lines">@@ -22549,6 +22569,7 @@
</span><span class="cx">                          A75E8B7F0E1DE2B0007F2481 /* filters */,
</span><span class="cx">                          498770C11242C50D002226BA /* gpu */,
</span><span class="cx">                          441AF0A70EBA7BBF0044ED4B /* ios */,
</span><ins>+                               CD892F5A1FB52ACF009333D2 /* iso */,
</ins><span class="cx">                           B27535490B053814002CE64F /* mac */,
</span><span class="cx">                          FBC220DD1237FBEB00BCF788 /* opengl */,
</span><span class="cx">                          3721493318F0B6D600156EDC /* opentype */,
</span><span class="lines">@@ -22683,8 +22704,6 @@
</span><span class="cx">                          2D46F04F17B96FD2005647F0 /* IntSize.cpp */,
</span><span class="cx">                          B27535470B053814002CE64F /* IntSize.h */,
</span><span class="cx">                          B27535480B053814002CE64F /* IntSizeHash.h */,
</span><del>-                               07AC46FF1952102100EE9723 /* ISOVTTCue.cpp */,
-                               07AC47001952102100EE9723 /* ISOVTTCue.h */,
</del><span class="cx">                           65CC6BED16014EC0000ED27D /* Latin1TextIterator.h */,
</span><span class="cx">                          0F36E7361BD1837A002DB891 /* LayoutPoint.cpp */,
</span><span class="cx">                          141DC04B164834B900371E5A /* LayoutPoint.h */,
</span><span class="lines">@@ -23656,6 +23675,28 @@
</span><span class="cx">                  name = cocoa;
</span><span class="cx">                  sourceTree = "<group>";
</span><span class="cx">          };
</span><ins>+               CD892F5A1FB52ACF009333D2 /* iso */ = {
+                       isa = PBXGroup;
+                       children = (
+                               CD871C681FB52B6900F0B965 /* ISOBox.cpp */,
+                               CD871C621FB52B6500F0B965 /* ISOBox.h */,
+                               CD871C6A1FB52B6A00F0B965 /* ISOOriginalFormatBox.cpp */,
+                               CD871C671FB52B6800F0B965 /* ISOOriginalFormatBox.h */,
+                               CD871C5E1FB52B6400F0B965 /* ISOProtectionSchemeInfoBox.cpp */,
+                               CD871C601FB52B6500F0B965 /* ISOProtectionSchemeInfoBox.h */,
+                               CD871C631FB52B6600F0B965 /* ISOSchemeInformationBox.cpp */,
+                               CD871C641FB52B6700F0B965 /* ISOSchemeInformationBox.h */,
+                               CD871C5F1FB52B6400F0B965 /* ISOSchemeTypeBox.cpp */,
+                               CD871C5C1FB52B6300F0B965 /* ISOSchemeTypeBox.h */,
+                               CD871C611FB52B6500F0B965 /* ISOTrackEncryptionBox.cpp */,
+                               CD871C661FB52B6800F0B965 /* ISOTrackEncryptionBox.h */,
+                               CD871C691FB52B6900F0B965 /* ISOVTTCue.cpp */,
+                               CD871C651FB52B6700F0B965 /* ISOVTTCue.h */,
+                       );
+                       name = iso;
+                       path = "New Group";
+                       sourceTree = "<group>";
+               };
</ins><span class="cx">           CD94A5CB1F71CB4600F525C5 /* encryptedmedia */ = {
</span><span class="cx">                  isa = PBXGroup;
</span><span class="cx">                  children = (
</span><span class="lines">@@ -23883,6 +23924,8 @@
</span><span class="cx">                          CDECA8981EDF447D00DCB08B /* AVAssetTrackUtilities.mm */,
</span><span class="cx">                          07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */,
</span><span class="cx">                          07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */,
</span><ins>+                               CD78A2EE1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.h */,
+                               CD78A2EC1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.mm */,
</ins><span class="cx">                           CDE595941BF166D100A1CBE8 /* CDMSessionAVContentKeySession.h */,
</span><span class="cx">                          CDE595931BF166AD00A1CBE8 /* CDMSessionAVContentKeySession.mm */,
</span><span class="cx">                          CDDE02EA18B3ED6D00CF7FF1 /* CDMSessionAVFoundationObjC.h */,
</span><span class="lines">@@ -26189,6 +26232,7 @@
</span><span class="cx">                          6550B69E099DF0270090D781 /* CDATASection.h in Headers */,
</span><span class="cx">                          CDF4B7161E00B7E500E235A2 /* CDM.h in Headers */,
</span><span class="cx">                          CD94A5DE1F72F57B00F525C5 /* CDMClient.h in Headers */,
</span><ins>+                               CDB7045A1F7465A1003923DF /* CDMFairPlayStreaming.h in Headers */,
</ins><span class="cx">                           CD318623199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h in Headers */,
</span><span class="cx">                          CDE595971BF26E2100A1CBE8 /* CDMSessionMediaSourceAVFObjC.h in Headers */,
</span><span class="cx">                          5FA904CA178E61F5004C8A2D /* CertificateInfo.h in Headers */,
</span><span class="lines">@@ -27219,7 +27263,6 @@
</span><span class="cx">                          B27535760B053814002CE64F /* IntSizeHash.h in Headers */,
</span><span class="cx">                          2D0B4AAB18DA1CCD00434DE1 /* IOSurface.h in Headers */,
</span><span class="cx">                          1C21E57D183ED1FF001C289D /* IOSurfacePool.h in Headers */,
</span><del>-                               07AC47021952102100EE9723 /* ISOVTTCue.h in Headers */,
</del><span class="cx">                           7C30D9841F815AEC00268356 /* JSAbortController.h in Headers */,
</span><span class="cx">                          7C30D9861F815AEC00268356 /* JSAbortSignal.h in Headers */,
</span><span class="cx">                          418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */,
</span><span class="lines">@@ -30181,6 +30224,8 @@
</span><span class="cx">                          0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */,
</span><span class="cx">                          CDF4B7151E00B7E500E235A2 /* CDM.cpp in Sources */,
</span><span class="cx">                          CD94A5DD1F71D5D800F525C5 /* CDMClearKey.cpp in Sources */,
</span><ins>+                               CDB7045B1F7465A1003923DF /* CDMFairPlayStreaming.cpp in Sources */,
+                               CDC224281F756966005F077B /* CDMInstanceFairPlayStreamingAVFObjC.mm in Sources */,
</ins><span class="cx">                           CD318622199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.mm in Sources */,
</span><span class="cx">                          CDE595951BF16DF300A1CBE8 /* CDMSessionAVContentKeySession.mm in Sources */,
</span><span class="cx">                          CDDE02ED18B3ED6D00CF7FF1 /* CDMSessionAVFoundationObjC.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsyaml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.yaml (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.yaml  2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/page/Settings.yaml     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -678,7 +678,7 @@
</span><span class="cx"> 
</span><span class="cx"> mediaKeysStorageDirectory:
</span><span class="cx">   type: String
</span><del>-  conditional: LEGACY_ENCRYPTED_MEDIA
</del><ins>+
</ins><span class="cx"> mediaDeviceIdentifierStorageDirectory:
</span><span class="cx">   type: String
</span><span class="cx">   conditional: MEDIA_STREAM
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformencryptedmediaCDMFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMFactory.cpp (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/encryptedmedia/CDMFactory.cpp      2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMFactory.cpp 2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     registeredFactories().removeAll(&factory);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !USE(GSTREAMER)
</del><ins>+#if !USE(GSTREAMER) && !USE(AVFOUNDATION)
</ins><span class="cx"> void CDMFactory::platformRegisterFactories(Vector<CDMFactory*>&)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformencryptedmediaCDMInstanceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMInstance.h (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/encryptedmedia/CDMInstance.h       2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMInstance.h  2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx">     enum class ImplementationType {
</span><span class="cx">         Mock,
</span><span class="cx">         ClearKey,
</span><ins>+        FairPlayStreaming,
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     virtual ImplementationType implementationType() const = 0;
</span><span class="lines">@@ -67,6 +68,7 @@
</span><span class="cx">     virtual SuccessValue setDistinctiveIdentifiersAllowed(bool) = 0;
</span><span class="cx">     virtual SuccessValue setPersistentStateAllowed(bool) = 0;
</span><span class="cx">     virtual SuccessValue setServerCertificate(Ref<SharedBuffer>&&) = 0;
</span><ins>+    virtual SuccessValue setStorageDirectory(const String&) = 0;
</ins><span class="cx"> 
</span><span class="cx">     using LicenseCallback = Function<void(Ref<SharedBuffer>&& message, const String& sessionId, bool needsIndividualization, SuccessValue succeeded)>;
</span><span class="cx">     virtual void requestLicense(LicenseType, const AtomicString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformencryptedmediaCDMRestrictionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMRestrictions.h (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/encryptedmedia/CDMRestrictions.h   2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMRestrictions.h      2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA)
</span><span class="cx"> 
</span><ins>+#include "CDMSessionType.h"
</ins><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -34,7 +35,7 @@
</span><span class="cx"> struct CDMRestrictions {
</span><span class="cx">     bool distinctiveIdentifierDenied { false };
</span><span class="cx">     bool persistentStateDenied { false };
</span><del>-    HashSet<String> deniedSessionTypes;
</del><ins>+    HashSet<CDMSessionType, WTF::IntHash<CDMSessionType>, WTF::StrongEnumHashTraits<CDMSessionType>> deniedSessionTypes;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformencryptedmediaclearkeyCDMClearKeycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp    2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp       2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -335,6 +335,12 @@
</span><span class="cx">     return Failed;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+CDMInstance::SuccessValue CDMInstanceClearKey::setStorageDirectory(const String& storageDirectory)
+{
+    // Reject any persistent state storage.
+    return storageDirectory.isEmpty() ? Succeeded : Failed;
+}
+
</ins><span class="cx"> void CDMInstanceClearKey::requestLicense(LicenseType, const AtomicString&, Ref<SharedBuffer>&& initData, LicenseCallback callback)
</span><span class="cx"> {
</span><span class="cx">     static uint32_t s_sessionIdValue = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformencryptedmediaclearkeyCDMClearKeyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h      2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.h 2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx">     SuccessValue setDistinctiveIdentifiersAllowed(bool) override;
</span><span class="cx">     SuccessValue setPersistentStateAllowed(bool) override;
</span><span class="cx">     SuccessValue setServerCertificate(Ref<SharedBuffer>&&) override;
</span><ins>+    SuccessValue setStorageDirectory(const String&) override;
</ins><span class="cx"> 
</span><span class="cx">     void requestLicense(LicenseType, const AtomicString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback) override;
</span><span class="cx">     void updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FourCC.h (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FourCC.h  2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/graphics/FourCC.h     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx">     WEBCORE_EXPORT static std::optional<FourCC> fromString(const String&);
</span><span class="cx"> 
</span><span class="cx">     bool operator==(const FourCC& other) const { return value == other.value; }
</span><ins>+    bool operator!=(const FourCC& other) const { return value != other.value; }
</ins><span class="cx"> 
</span><span class="cx">     uint32_t value;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsISOVTTCuecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/ISOVTTCue.cpp (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ISOVTTCue.cpp     2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/graphics/ISOVTTCue.cpp        2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -1,153 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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. ``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
- * 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 "ISOVTTCue.h"
-
-#include "Logging.h"
-#include <runtime/ArrayBuffer.h>
-#include <runtime/DataView.h>
-#include <runtime/Int8Array.h>
-#include <runtime/JSCInlines.h>
-#include <runtime/TypedArrayInlines.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
-
-namespace JSC {
-class ArrayBuffer;
-}
-
-namespace WebCore {
-
-ISOBox::ISOBox(ArrayBuffer* data)
-{
-    m_type = peekType(data);
-    m_length = peekLength(data);
-    ASSERT(m_length >= 8);
-}
-
-String ISOBox::peekType(ArrayBuffer* data)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(data->byteLength() >= 2 * sizeof(uint32_t));
-    if (data->byteLength() < 2 * sizeof(uint32_t))
-        return emptyString();
-
-    StringBuilder builder;
-    RefPtr<Int8Array> array = JSC::Int8Array::create(data, 4, sizeof(uint32_t));
-    for (int i = 0; i < 4; ++i)
-        builder.append(array->item(i));
-    return builder.toString();
-}
-
-size_t ISOBox::peekLength(ArrayBuffer* data)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(data->byteLength() >= sizeof(uint32_t));
-    if (data->byteLength() < sizeof(uint32_t))
-        return 0;
-
-    return JSC::DataView::create(data, 0, sizeof(uint32_t))->get<uint32_t>(0, false);
-}
-
-String ISOBox::peekString(ArrayBuffer* data, unsigned offset, unsigned length)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(offset + length <= data->byteLength());
-    if (data->byteLength() < offset + length)
-        return emptyString();
-
-    return String::fromUTF8(JSC::Uint8Array::create(data, offset, length)->data(), length);
-}
-
-static const AtomicString& vttCueBoxType()
-{
-    static NeverDestroyed<AtomicString> vttc("vttc", AtomicString::ConstructFromLiteral);
-    return vttc;
-}
-
-static const AtomicString& vttIdBoxType()
-{
-    static NeverDestroyed<AtomicString> iden("iden", AtomicString::ConstructFromLiteral);
-    return iden;
-}
-
-static const AtomicString& vttSettingsBoxType()
-{
-    static NeverDestroyed<AtomicString> sttg("sttg", AtomicString::ConstructFromLiteral);
-    return sttg;
-}
-
-static const AtomicString& vttPayloadBoxType()
-{
-    static NeverDestroyed<AtomicString> payl("payl", AtomicString::ConstructFromLiteral);
-    return payl;
-}
-
-static const AtomicString& vttCurrentTimeBoxType()
-{
-    static NeverDestroyed<AtomicString> ctim("ctim", AtomicString::ConstructFromLiteral);
-    return ctim;
-}
-
-static const AtomicString& vttCueSourceIDBoxType()
-{
-    static NeverDestroyed<AtomicString> vsid("vsid", AtomicString::ConstructFromLiteral);
-    return vsid;
-}
-
-const AtomicString& ISOWebVTTCue::boxType()
-{
-    return vttCueBoxType();
-}
-
-ISOWebVTTCue::ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& duration, JSC::ArrayBuffer* buffer)
-    : ISOBox(buffer)
-    , m_presentationTime(presentationTime)
-    , m_duration(duration)
-{
-    size_t offset = ISOBox::boxHeaderSize();
-    while (offset < length() && length() - offset > ISOBox::boxHeaderSize()) {
-        RefPtr<ArrayBuffer> subBuffer = buffer->slice(offset);
-        String boxType = ISOBox::peekType(subBuffer.get());
-        size_t boxSize = ISOBox::peekLength(subBuffer.get());
-        size_t boxDataSize = boxSize - ISOBox::boxHeaderSize();
-
-        if (boxType == vttCueSourceIDBoxType())
-            m_sourceID = peekString(subBuffer.get(), ISOBox::boxHeaderSize(), boxDataSize);
-        else if (boxType == vttIdBoxType())
-            m_identifier = peekString(subBuffer.get(), ISOBox::boxHeaderSize(), boxDataSize);
-        else if (boxType == vttCurrentTimeBoxType())
-            m_originalStartTime = peekString(subBuffer.get(), ISOBox::boxHeaderSize(), boxDataSize);
-        else if (boxType == vttSettingsBoxType())
-            m_settings = peekString(subBuffer.get(), ISOBox::boxHeaderSize(), boxDataSize);
-        else if (boxType == vttPayloadBoxType())
-            m_cueText = peekString(subBuffer.get(), ISOBox::boxHeaderSize(), boxDataSize);
-        else
-            LOG(Media, "ISOWebVTTCue::ISOWebVTTCue - skipping box id = \"%s\", size = %zu", boxType.utf8().data(), boxSize);
-
-        offset += boxSize;
-    }
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsISOVTTCueh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/ISOVTTCue.h (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ISOVTTCue.h       2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/graphics/ISOVTTCue.h  2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -1,94 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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. ``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
- * 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. 
- */
-
-#ifndef ISOVTTCue_h
-#define ISOVTTCue_h
-
-#include <wtf/MediaTime.h>
-#include <wtf/text/WTFString.h>
-
-namespace JSC {
-class ArrayBuffer;
-}
-
-namespace WebCore {
-
-// An ISOBox represents a ISO-BMFF box. Data in the structure is big-endian. The layout of the data structure as follows:
-// 4 bytes : 4CC : identifier
-// 4 bytes : unsigned : length
-class ISOBox {
-public:
-    static String peekType(JSC::ArrayBuffer*);
-    static size_t peekLength(JSC::ArrayBuffer*);
-    static String peekString(JSC::ArrayBuffer*, unsigned offset, unsigned length);
-    static unsigned boxHeaderSize() { return 2 * sizeof(uint32_t); }
-
-    size_t length() const { return m_length; }
-    const AtomicString& type() const { return m_type; }
-
-protected:
-    ISOBox(JSC::ArrayBuffer*);
-    
-private:
-    size_t m_length;
-    AtomicString m_type;
-};
-
-// 4 bytes : 4CC : identifier = 'vttc'
-// 4 bytes : unsigned : length
-// N bytes : CueSourceIDBox : box : optional
-// N bytes : CueIDBox : box : optional
-// N bytes : CueTimeBox : box : optional
-// N bytes : CueSettingsBox : box : optional
-// N bytes : CuePayloadBox : box : required
-class ISOWebVTTCue : public ISOBox {
-public:
-    ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& duration, JSC::ArrayBuffer*);
-
-    static const AtomicString& boxType();
-
-    const MediaTime& presentationTime() const { return m_presentationTime; }
-    const MediaTime& duration() const { return m_duration; }
-
-    const String& sourceID() const { return m_sourceID; }
-    const String& id() const { return m_identifier; }
-    const String& originalStartTime() const { return m_originalStartTime; }
-    const String& settings() const { return m_settings; }
-    const String& cueText() const { return m_cueText; }
-
-private:
-    MediaTime m_presentationTime;
-    MediaTime m_duration;
-
-    String m_sourceID;
-    String m_identifier;
-    String m_originalStartTime;
-    String m_settings;
-    String m_cueText;
-};
-
-}
-
-#endif // ISOVTTCue_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationCDMFairPlayStreamingcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp                             (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp        2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,342 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "CDMFairPlayStreaming.h"
+
+#if ENABLE(ENCRYPTED_MEDIA)
+
+#include "CDMClearKey.h"
+#include "CDMKeySystemConfiguration.h"
+#include "CDMRestrictions.h"
+#include "CDMSessionType.h"
+#include "ISOSchemeInformationBox.h"
+#include "ISOSchemeTypeBox.h"
+#include "ISOTrackEncryptionBox.h"
+#include "InitDataRegistry.h"
+#include "NotImplemented.h"
+#include "inspector/InspectorValues.h"
+#include <runtime/ArrayBuffer.h>
+#include <runtime/DataView.h>
+#include <wtf/Algorithms.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/Base64.h>
+
+#if HAVE(AVCONTENTKEYSESSION)
+#include "CDMInstanceFairPlayStreamingAVFObjC.h"
+#endif
+
+using namespace Inspector;
+
+namespace WebCore {
+
+static Vector<Ref<SharedBuffer>> extractSinfData(const SharedBuffer& buffer)
+{
+    // JSON of the format: "{ sinf: [ <base64-encoded-string> ] }"
+    if (buffer.size() > std::numeric_limits<unsigned>::max())
+        return { };
+    String json { buffer.data(), static_cast<unsigned>(buffer.size()) };
+
+    RefPtr<InspectorValue> value;
+    if (!InspectorValue::parseJSON(json, value))
+        return { };
+
+    RefPtr<InspectorObject> object;
+    if (!value->asObject(object))
+        return { };
+
+    RefPtr<InspectorArray> sinfArray;
+    if (!object->getArray("sinf", sinfArray))
+        return { };
+
+    Vector<Ref<SharedBuffer>> sinfs;
+    sinfs.reserveInitialCapacity(sinfArray->length());
+
+    for (auto& value : *sinfArray) {
+        String keyID;
+        if (!value->asString(keyID))
+            continue;
+
+        Vector<char> sinfData;
+        if (!WTF::base64URLDecode(keyID, { sinfData }))
+            continue;
+
+        sinfs.uncheckedAppend(SharedBuffer::create(WTFMove(sinfData)));
+    }
+
+    return sinfs;
+}
+
+using SchemeAndKeyResult = Vector<std::pair<FourCC, Vector<uint8_t>>>;
+static SchemeAndKeyResult extractSchemeAndKeyIdFromSinf(const SharedBuffer& buffer)
+{
+    auto buffers = extractSinfData(buffer);
+    if (!buffers.size())
+        return { };
+
+    SchemeAndKeyResult result;
+    for (auto& buffer : buffers) {
+        unsigned offset = 0;
+        std::optional<FourCC> scheme;
+        std::optional<Vector<uint8_t>> keyID;
+
+        auto view = JSC::DataView::create(buffer->tryCreateArrayBuffer(), offset, buffer->size());
+        while (auto optionalBoxType = ISOBox::peekBox(view, offset)) {
+            auto& boxTypeName = optionalBoxType.value().first;
+            auto& boxSize = optionalBoxType.value().second;
+
+            if (boxTypeName == ISOSchemeTypeBox::boxTypeName()) {
+                ISOSchemeTypeBox schemeTypeBox;
+                if (!schemeTypeBox.read(view, offset))
+                    break;
+
+                scheme = schemeTypeBox.schemeType();
+                continue;
+            }
+
+            if (boxTypeName == ISOSchemeInformationBox::boxTypeName()) {
+                ISOSchemeInformationBox schemeInfoBox;
+                if (!schemeInfoBox.read(view, offset))
+                    break;
+
+                auto trackEncryptionBox = downcast<ISOTrackEncryptionBox>(schemeInfoBox.schemeSpecificData());
+                if (trackEncryptionBox)
+                    keyID = trackEncryptionBox->defaultKID();
+                continue;
+            }
+
+            offset += boxSize;
+        }
+        if (scheme && keyID)
+            result.append(std::make_pair(scheme.value(), WTFMove(keyID.value())));
+    }
+
+    return result;
+}
+
+static Vector<Ref<SharedBuffer>> extractKeyIDsSinf(const SharedBuffer& buffer)
+{
+    auto sinfs = extractSinfData(buffer);
+    if (sinfs.isEmpty())
+        return { };
+
+    Vector<Ref<SharedBuffer>> keyIDs;
+    for (auto& sinf : sinfs) {
+        auto results = extractSchemeAndKeyIdFromSinf(sinf);
+        if (!results.size())
+            continue;
+
+        for (auto& result : results) {
+            if (result.first == 'cbcs')
+                keyIDs.append(SharedBuffer::create(result.second.data(), result.second.size()));
+        }
+    }
+
+    return keyIDs;
+}
+
+static RefPtr<SharedBuffer> sanitizeSinf(const SharedBuffer& buffer)
+{
+    // Common SINF Box Format
+    UNUSED_PARAM(buffer);
+    notImplemented();
+    return buffer.copy();
+}
+
+void CDMFactory::platformRegisterFactories(Vector<CDMFactory*>& factories)
+{
+    factories.append(&CDMFactoryClearKey::singleton());
+    factories.append(&CDMFactoryFairPlayStreaming::singleton());
+
+    InitDataRegistry::shared().registerInitDataType("sinf", { sanitizeSinf, extractKeyIDsSinf });
+}
+
+CDMFactoryFairPlayStreaming& CDMFactoryFairPlayStreaming::singleton()
+{
+    static NeverDestroyed<CDMFactoryFairPlayStreaming> s_factory;
+    return s_factory;
+}
+
+CDMFactoryFairPlayStreaming::CDMFactoryFairPlayStreaming() = default;
+CDMFactoryFairPlayStreaming::~CDMFactoryFairPlayStreaming() = default;
+
+std::unique_ptr<CDMPrivate> CDMFactoryFairPlayStreaming::createCDM(const String& keySystem)
+{
+    if (!supportsKeySystem(keySystem))
+        return nullptr;
+
+    return std::make_unique<CDMPrivateFairPlayStreaming>();
+}
+
+bool CDMFactoryFairPlayStreaming::supportsKeySystem(const String& keySystem)
+{
+    // https://w3c.github.io/encrypted-media/#key-system
+    // "Key System strings are compared using case-sensitive matching."
+    return keySystem == "com.apple.fps" || keySystem.startsWith(ASCIILiteral("com.apple.fps."));
+}
+
+CDMPrivateFairPlayStreaming::CDMPrivateFairPlayStreaming() = default;
+CDMPrivateFairPlayStreaming::~CDMPrivateFairPlayStreaming() = default;
+
+bool CDMPrivateFairPlayStreaming::supportsInitDataType(const AtomicString& initDataType) const
+{
+    return initDataType == "sinf";
+}
+
+bool CDMPrivateFairPlayStreaming::supportsConfiguration(const CDMKeySystemConfiguration& configuration) const
+{
+    if (!configuration.initDataTypes.contains("sinf"))
+        return false;
+
+#if HAVE(AVCONTENTKEYSESSION)
+    // FIXME: verify that FairPlayStreaming does not (and cannot) expose a distinctive identifier to the client
+    if (configuration.distinctiveIdentifier == CDMRequirement::Required)
+        return false;
+    if (configuration.persistentState == CDMRequirement::Required && !CDMInstanceFairPlayStreamingAVFObjC::supportsPersistableState())
+        return false;
+
+    if (configuration.sessionTypes.contains(CDMSessionType::PersistentLicense)
+        && !configuration.sessionTypes.contains(CDMSessionType::Temporary)
+        && !CDMInstanceFairPlayStreamingAVFObjC::supportsPersistentKeys())
+        return false;
+
+    if (!configuration.audioCapabilities.isEmpty()
+        && !WTF::anyOf(configuration.audioCapabilities, [](auto& capability) {
+            return CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable(capability.contentType);
+        }))
+        return false;
+
+    if (!configuration.videoCapabilities.isEmpty()
+        && !WTF::anyOf(configuration.videoCapabilities, [](auto& capability) {
+            return CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable(capability.contentType);
+        }))
+        return false;
+
+    return true;
+#else
+    return false;
+#endif    
+}
+
+bool CDMPrivateFairPlayStreaming::supportsConfigurationWithRestrictions(const CDMKeySystemConfiguration& configuration, const CDMRestrictions& restrictions) const
+{
+    if (restrictions.persistentStateDenied
+        && !configuration.sessionTypes.isEmpty()
+        && !configuration.sessionTypes.contains(CDMSessionType::Temporary))
+        return false;
+
+    if (restrictions.persistentStateDenied && configuration.persistentState == CDMRequirement::Required)
+        return false;
+
+    if (WTF::allOf(configuration.sessionTypes, [restrictions](auto& sessionType) {
+        return restrictions.deniedSessionTypes.contains(sessionType);
+    }))
+        return false;
+
+    return supportsConfiguration(configuration);
+}
+
+bool CDMPrivateFairPlayStreaming::supportsSessionTypeWithConfiguration(CDMSessionType& sessionType, const CDMKeySystemConfiguration& configuration) const
+{
+    if (sessionType == CDMSessionType::Temporary) {
+        if (configuration.persistentState == CDMRequirement::Required)
+            return false;
+    } else if (configuration.persistentState == CDMRequirement::NotAllowed)
+        return false;
+
+    return supportsConfiguration(configuration);
+}
+
+bool CDMPrivateFairPlayStreaming::supportsRobustness(const String& robustness) const
+{
+    if (robustness.isEmpty())
+        return true;
+
+    // FIXME: Determine an enumerated list of robustness values supported by FPS.
+    return false;
+}
+
+CDMRequirement CDMPrivateFairPlayStreaming::distinctiveIdentifiersRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
+{
+    // FIXME: verify that FairPlayStreaming does not (and cannot) expose a distinctive identifier to the client
+    return CDMRequirement::NotAllowed;
+}
+
+CDMRequirement CDMPrivateFairPlayStreaming::persistentStateRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
+{
+    return CDMRequirement::Optional;
+}
+
+bool CDMPrivateFairPlayStreaming::distinctiveIdentifiersAreUniquePerOriginAndClearable(const CDMKeySystemConfiguration&) const
+{
+    return true;
+}
+
+RefPtr<CDMInstance> CDMPrivateFairPlayStreaming::createInstance()
+{
+#if HAVE(AVCONTENTKEYSESSION)
+    return adoptRef(new CDMInstanceFairPlayStreamingAVFObjC());
+#else
+    return nullptr;
+#endif
+}
+
+void CDMPrivateFairPlayStreaming::loadAndInitialize()
+{
+}
+
+bool CDMPrivateFairPlayStreaming::supportsServerCertificates() const
+{
+    return true;
+}
+
+bool CDMPrivateFairPlayStreaming::supportsSessions() const
+{
+    return true;
+}
+
+bool CDMPrivateFairPlayStreaming::supportsInitData(const AtomicString& initDataType, const SharedBuffer& initData) const
+{
+    if (!supportsInitDataType(initDataType))
+        return false;
+
+    return WTF::anyOf(extractSchemeAndKeyIdFromSinf(initData), [](auto& result) {
+        return result.first == 'cbcs' || result.first == 'cbc2' || result.first == 'cbc1';
+    });
+}
+
+RefPtr<SharedBuffer> CDMPrivateFairPlayStreaming::sanitizeResponse(const SharedBuffer& response) const
+{
+    return response.copy();
+}
+
+std::optional<String> CDMPrivateFairPlayStreaming::sanitizeSessionId(const String& sessionId) const
+{
+    return sessionId;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(ENCRYPTED_MEDIA)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationCDMFairPlayStreamingh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h                               (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h  2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "CDMFactory.h"
+#include "CDMPrivate.h"
+
+namespace WebCore {
+
+class CDMFactoryFairPlayStreaming final : public CDMFactory {
+public:
+    static CDMFactoryFairPlayStreaming& singleton();
+
+    virtual ~CDMFactoryFairPlayStreaming();
+
+    std::unique_ptr<CDMPrivate> createCDM(const String&) override;
+    bool supportsKeySystem(const String&) override;
+
+private:
+    friend class NeverDestroyed<CDMFactoryFairPlayStreaming>;
+    CDMFactoryFairPlayStreaming();
+};
+
+class CDMPrivateFairPlayStreaming final : public CDMPrivate {
+public:
+    CDMPrivateFairPlayStreaming();
+    virtual ~CDMPrivateFairPlayStreaming();
+
+    bool supportsInitDataType(const AtomicString&) const override;
+    bool supportsConfiguration(const CDMKeySystemConfiguration&) const override;
+    bool supportsConfigurationWithRestrictions(const CDMKeySystemConfiguration&, const CDMRestrictions&) const override;
+    bool supportsSessionTypeWithConfiguration(CDMSessionType&, const CDMKeySystemConfiguration&) const override;
+    bool supportsRobustness(const String&) const override;
+    CDMRequirement distinctiveIdentifiersRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const override;
+    CDMRequirement persistentStateRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const override;
+    bool distinctiveIdentifiersAreUniquePerOriginAndClearable(const CDMKeySystemConfiguration&) const override;
+    RefPtr<CDMInstance> createInstance() override;
+    void loadAndInitialize() override;
+    bool supportsServerCertificates() const override;
+    bool supportsSessions() const override;
+    bool supportsInitData(const AtomicString&, const SharedBuffer&) const override;
+    RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const override;
+    std::optional<String> sanitizeSessionId(const String&) const override;
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationInbandTextTrackPrivateAVFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp        2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp   2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -489,14 +489,19 @@
</span><span class="cx">         if (!readNativeSampleBuffer(nativeSamples, i, buffer, duration, formatDescription))
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        String type = ISOBox::peekType(buffer.get());
-        size_t boxLength = ISOBox::peekLength(buffer.get());
-        if (boxLength > buffer->byteLength()) {
-            ERROR_LOG(LOGIDENTIFIER, "chunk  type = '", type, "', size = ", boxLength, " larger than buffer length!");
</del><ins>+        auto view = JSC::DataView::create(WTFMove(buffer), 0, buffer->byteLength());
+        auto peekResult = ISOBox::peekBox(view, 0);
+        if (!peekResult)
</ins><span class="cx">             continue;
</span><ins>+
+        auto type = peekResult.value().first;
+        auto boxLength = peekResult.value().second;
+        if (boxLength > view->byteLength()) {
+            ERROR_LOG(LOGIDENTIFIER, "chunk  type = '", type.toString(), "', size = ", (size_t)boxLength, " larger than buffer length!");
+            continue;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        DEBUG_LOG(LOGIDENTIFIER, "chunk  type = '", type, "', size = ", boxLength);
</del><ins>+        DEBUG_LOG(LOGIDENTIFIER, "chunk  type = '", type.toString(), "', size = ", (size_t)boxLength);
</ins><span class="cx"> 
</span><span class="cx">         do {
</span><span class="cx">             if (m_haveReportedVTTHeader || !formatDescription)
</span><span class="lines">@@ -529,13 +534,14 @@
</span><span class="cx">             m_haveReportedVTTHeader = true;
</span><span class="cx">         } while (0);
</span><span class="cx"> 
</span><del>-        if (type == ISOWebVTTCue::boxType()) {
-            ISOWebVTTCue cueData = ISOWebVTTCue(presentationTime, duration, buffer.get());
</del><ins>+        if (type == ISOWebVTTCue::boxTypeName()) {
+            ISOWebVTTCue cueData = ISOWebVTTCue(presentationTime, duration);
+            cueData.read(view);
</ins><span class="cx">             DEBUG_LOG(LOGIDENTIFIER, "sample presentation time = ", cueData.presentationTime(), ", duration = ", cueData.duration(), ", id = '", cueData.id(), "', settings = ", cueData.settings(), ", cue text = ", cueData.cueText(), ", sourceID = ", cueData.sourceID(), ", originalStartTime = ", cueData.originalStartTime());
</span><span class="cx">             client()->parseWebVTTCueData(cueData);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        m_sampleInputBuffer.remove(0, boxLength);
</del><ins>+        m_sampleInputBuffer.remove(0, (size_t)boxLength);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -560,7 +566,7 @@
</span><span class="cx"> 
</span><span class="cx">     CMBlockBufferRef blockBuffer = CMSampleBufferGetDataBuffer(sampleBuffer);
</span><span class="cx">     size_t bufferLength = CMBlockBufferGetDataLength(blockBuffer);
</span><del>-    if (bufferLength < ISOBox::boxHeaderSize()) {
</del><ins>+    if (bufferLength < ISOBox::minimumBoxSize()) {
</ins><span class="cx">         ERROR_LOG(LOGIDENTIFIER, "CMSampleBuffer size length unexpectedly small: ", bufferLength);
</span><span class="cx">         return false;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMInstanceFairPlayStreamingAVFObjCh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h                           (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h      2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,98 @@
</span><ins>+/*
+ * Copyright (C) 2017 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
+
+#if HAVE(AVCONTENTKEYSESSION)
+
+#include "CDMInstance.h"
+#include <wtf/Function.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/WeakPtr.h>
+#include <wtf/text/WTFString.h>
+
+OBJC_CLASS AVContentKeyRequest;
+OBJC_CLASS AVContentKeySession;
+OBJC_CLASS NSData;
+OBJC_CLASS NSError;
+OBJC_CLASS NSURL;
+OBJC_CLASS WebCoreFPSContentKeySessionDelegate;
+
+namespace WebCore {
+
+class CDMInstanceFairPlayStreamingAVFObjC final : public CDMInstance {
+public:
+    CDMInstanceFairPlayStreamingAVFObjC();
+    virtual ~CDMInstanceFairPlayStreamingAVFObjC();
+
+    static bool supportsPersistableState();
+    static bool supportsPersistentKeys();
+    static bool mimeTypeIsPlayable(const String&);
+
+    ImplementationType implementationType() const final { return ImplementationType::FairPlayStreaming; }
+
+    SuccessValue initializeWithConfiguration(const CDMKeySystemConfiguration&) final;
+    SuccessValue setDistinctiveIdentifiersAllowed(bool) final;
+    SuccessValue setPersistentStateAllowed(bool) final;
+    SuccessValue setServerCertificate(Ref<SharedBuffer>&&) final;
+    SuccessValue setStorageDirectory(const String&) final;
+
+    void requestLicense(LicenseType, const AtomicString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback) final;
+    void updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback) final;
+    void loadSession(LicenseType, const String&, const String&, LoadSessionCallback) final;
+    void closeSession(const String&, CloseSessionCallback) final;
+    void removeSessionData(const String&, LicenseType, RemoveSessionDataCallback) final;
+    void storeRecordOfKeyUsage(const String&) final;
+
+    const String& keySystem() const final;
+
+    void didProvideRequest(AVContentKeyRequest *);
+    void didProvideRenewingRequest(AVContentKeyRequest *);
+    void didProvidePersistableRequest(AVContentKeyRequest *);
+    void didFailToProvideRequest(AVContentKeyRequest *, NSError *);
+    bool shouldRetryRequestForReason(AVContentKeyRequest *, NSString *);
+    void sessionIdentifierChanged(NSData *);
+
+private:
+    WeakPtr<CDMInstanceFairPlayStreamingAVFObjC> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(*this); }
+    bool isLicenseTypeSupported(LicenseType) const;
+
+    WeakPtrFactory<CDMInstanceFairPlayStreamingAVFObjC> m_weakPtrFactory;
+    RefPtr<SharedBuffer> m_serverCertificate;
+    bool m_persistentStateAllowed { false };
+    RetainPtr<NSURL> m_storageDirectory;
+    RetainPtr<AVContentKeySession> m_session;
+    RetainPtr<AVContentKeyRequest> m_request;
+    RetainPtr<WebCoreFPSContentKeySessionDelegate> m_delegate;
+    String m_sessionId;
+
+    LicenseCallback m_requestLicenseCallback;
+    LicenseUpdateCallback m_updateLicenseCallback;
+    CloseSessionCallback m_closeSessionCallback;
+    RemoveSessionDataCallback m_removeSessionDataCallback;
+};
+}
+
+#endif // HAVE(AVCONTENTKEYSESSION)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcCDMInstanceFairPlayStreamingAVFObjCmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm                          (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,326 @@
</span><ins>+/*
+ * Copyright (C) 2017 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.
+ */
+
+#import "config.h"
+#import "CDMInstanceFairPlayStreamingAVFObjC.h"
+
+#if HAVE(AVCONTENTKEYSESSION)
+
+#import "CDMKeySystemConfiguration.h"
+#import "NotImplemented.h"
+#import "SharedBuffer.h"
+#import <AVFoundation/AVContentKeySession.h>
+#import <pal/spi/mac/AVFoundationSPI.h>
+#import <wtf/SoftLinking.h>
+#import <wtf/text/StringHash.h>
+
+SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
+SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVContentKeySession);
+SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVURLAsset);
+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVContentKeySystemFairPlayStreaming, NSString*)
+
+#if PLATFORM(IOS)
+SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVPersistableContentKeyRequest);
+#endif
+
+@interface WebCoreFPSContentKeySessionDelegate : NSObject<AVContentKeySessionDelegate> {
+    WebCore::CDMInstanceFairPlayStreamingAVFObjC* _parent;
+}
+@end
+
+@implementation WebCoreFPSContentKeySessionDelegate
+- (id)initWithParent:(WebCore::CDMInstanceFairPlayStreamingAVFObjC *)parent
+{
+    if (!(self = [super init]))
+        return nil;
+
+    _parent = parent;
+    return self;
+}
+
+- (void)invalidate
+{
+    _parent = nil;
+}
+
+- (void)contentKeySession:(AVContentKeySession *)session didProvideContentKeyRequest:(AVContentKeyRequest *)keyRequest
+{
+    UNUSED_PARAM(session);
+    if (_parent)
+        _parent->didProvideRequest(keyRequest);
+}
+
+- (void)contentKeySession:(AVContentKeySession *)session didProvideRenewingContentKeyRequest:(AVContentKeyRequest *)keyRequest
+{
+    UNUSED_PARAM(session);
+    if (_parent)
+        _parent->didProvideRenewingRequest(keyRequest);
+}
+
+#if PLATFORM(IOS)
+- (void)contentKeySession:(AVContentKeySession *)session didProvidePersistableContentKeyRequest:(AVPersistableContentKeyRequest *)keyRequest
+{
+    UNUSED_PARAM(session);
+    if (_parent)
+        _parent->didProvidePersistableRequest(keyRequest);
+}
+
+- (void)contentKeySession:(AVContentKeySession *)session didUpdatePersistableContentKey:(NSData *)persistableContentKey forContentKeyIdentifier:(id)keyIdentifier
+{
+    UNUSED_PARAM(session);
+    UNUSED_PARAM(persistableContentKey);
+    UNUSED_PARAM(keyIdentifier);
+    notImplemented();
+}
+#endif
+
+- (void)contentKeySession:(AVContentKeySession *)session contentKeyRequest:(AVContentKeyRequest *)keyRequest didFailWithError:(NSError *)err
+{
+    UNUSED_PARAM(session);
+    if (_parent)
+        _parent->didFailToProvideRequest(keyRequest, err);
+}
+
+- (BOOL)contentKeySession:(AVContentKeySession *)session shouldRetryContentKeyRequest:(AVContentKeyRequest *)keyRequest reason:(AVContentKeyRequestRetryReason)retryReason
+{
+    UNUSED_PARAM(session);
+    return _parent ? _parent->shouldRetryRequestForReason(keyRequest, retryReason) : false;
+}
+
+- (void)contentKeySessionContentProtectionSessionIdentifierDidChange:(AVContentKeySession *)session
+{
+    UNUSED_PARAM(session);
+    if (_parent)
+        _parent->sessionIdentifierChanged(session.contentProtectionSessionIdentifier);
+}
+
+@end
+
+namespace WebCore {
+
+CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC()
+    : CDMInstance()
+    , m_delegate([[WebCoreFPSContentKeySessionDelegate alloc] initWithParent:this])
+{
+}
+
+CDMInstanceFairPlayStreamingAVFObjC::~CDMInstanceFairPlayStreamingAVFObjC()
+{
+    [m_delegate invalidate];
+}
+
+bool CDMInstanceFairPlayStreamingAVFObjC::supportsPersistableState()
+{
+    return [getAVContentKeySessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)];
+}
+
+bool CDMInstanceFairPlayStreamingAVFObjC::supportsPersistentKeys()
+{
+#if PLATFORM(IOS)
+    return getAVPersistableContentKeyRequestClass();
+#else
+    return false;
+#endif
+}
+
+bool CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable(const String& contentType)
+{
+    return [getAVURLAssetClass() isPlayableExtendedMIMEType:contentType];
+}
+
+CDMInstance::SuccessValue CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration(const CDMKeySystemConfiguration& configuration)
+{
+    // FIXME: verify that FairPlayStreaming does not (and cannot) expose a distinctive identifier to the client
+    if (configuration.distinctiveIdentifier == CDMRequirement::Required)
+        return Failed;
+
+    if (configuration.persistentState != CDMRequirement::Required && (configuration.sessionTypes.contains(CDMSessionType::PersistentUsageRecord) || configuration.sessionTypes.contains(CDMSessionType::PersistentLicense)))
+        return Failed;
+
+    if (configuration.persistentState == CDMRequirement::Required && !m_storageDirectory)
+        return Failed;
+
+    if (configuration.sessionTypes.contains(CDMSessionType::PersistentLicense) && !supportsPersistentKeys())
+        return Failed;
+
+    if (!canLoadAVContentKeySystemFairPlayStreaming())
+        return Failed;
+
+    if (configuration.persistentState == CDMRequirement::NotAllowed || !m_storageDirectory)
+        m_session = [getAVContentKeySessionClass() contentKeySessionWithKeySystem:getAVContentKeySystemFairPlayStreaming()];
+    else
+        m_session = [getAVContentKeySessionClass() contentKeySessionWithKeySystem:getAVContentKeySystemFairPlayStreaming() storageDirectoryAtURL:m_storageDirectory.get()];
+
+    if (!m_session)
+        return Failed;
+
+    [m_session setDelegate:m_delegate.get() queue:dispatch_get_main_queue()];
+
+    return Succeeded;
+}
+
+CDMInstance::SuccessValue CDMInstanceFairPlayStreamingAVFObjC::setDistinctiveIdentifiersAllowed(bool)
+{
+    // FIXME: verify that FairPlayStreaming does not (and cannot) expose a distinctive identifier to the client
+    return Succeeded;
+}
+
+CDMInstance::SuccessValue CDMInstanceFairPlayStreamingAVFObjC::setPersistentStateAllowed(bool persistentStateAllowed)
+{
+    m_persistentStateAllowed = persistentStateAllowed;
+    return Succeeded;
+}
+
+CDMInstance::SuccessValue CDMInstanceFairPlayStreamingAVFObjC::setServerCertificate(Ref<SharedBuffer>&& serverCertificate)
+{
+    m_serverCertificate = WTFMove(serverCertificate);
+    return Succeeded;
+}
+
+CDMInstance::SuccessValue CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory(const String& storageDirectory)
+{
+    if (storageDirectory.isEmpty())
+        m_storageDirectory = nil;
+    else
+        m_storageDirectory = adoptNS([[NSURL alloc] initFileURLWithPath:storageDirectory isDirectory:YES]);
+    return Succeeded;
+}
+
+bool CDMInstanceFairPlayStreamingAVFObjC::isLicenseTypeSupported(LicenseType licenseType) const
+{
+    switch (licenseType) {
+    case CDMSessionType::PersistentLicense:
+        return m_persistentStateAllowed && supportsPersistentKeys();
+    case CDMSessionType::PersistentUsageRecord:
+        return m_persistentStateAllowed && supportsPersistableState();
+    case CDMSessionType::Temporary:
+        return true;
+    }
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::requestLicense(LicenseType licenseType, const AtomicString&, Ref<SharedBuffer>&& initData, LicenseCallback callback)
+{
+    if (!isLicenseTypeSupported(licenseType)) {
+        callback(SharedBuffer::create(), emptyString(), false, Failed);
+        return;
+    }
+    m_requestLicenseCallback = WTFMove(callback);
+
+    [m_session processContentKeyRequestWithIdentifier:nil initializationData:initData->createNSData().get() options:nil];
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback)
+{
+    notImplemented();
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::loadSession(LicenseType, const String&, const String&, LoadSessionCallback)
+{
+    notImplemented();
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::closeSession(const String&, CloseSessionCallback)
+{
+    notImplemented();
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::removeSessionData(const String&, LicenseType, RemoveSessionDataCallback)
+{
+    notImplemented();
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::storeRecordOfKeyUsage(const String&)
+{
+    notImplemented();
+}
+
+const String& CDMInstanceFairPlayStreamingAVFObjC::keySystem() const
+{
+    static NeverDestroyed<String> s_keySystem { ASCIILiteral("com.apple.fps") };
+    return s_keySystem;
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest(AVContentKeyRequest *request)
+{
+    m_request = request;
+    if (!m_requestLicenseCallback)
+        return;
+
+#pragma clang diagnostic push 
+#pragma clang diagnostic ignored "-Wnonnull"
+    RetainPtr<NSData> appIdentifier = m_serverCertificate ? m_serverCertificate->createNSData() : nullptr;
+    [m_request makeStreamingContentKeyRequestDataForApp:appIdentifier.get() contentIdentifier:nil options:nil completionHandler:[this, weakThis = createWeakPtr()] (NSData *contentKeyRequestData, NSError *error) mutable {
+        callOnMainThread([this, weakThis = WTFMove(weakThis), error = retainPtr(error), contentKeyRequestData = retainPtr(contentKeyRequestData)] {
+            if (!weakThis || !m_requestLicenseCallback)
+                return;
+
+            if (error)
+                m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed);
+            else
+                m_requestLicenseCallback(SharedBuffer::create(contentKeyRequestData.get()), m_sessionId, false, Succeeded);
+        });
+    }];
+#pragma clang diagnostic pop
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::didProvideRenewingRequest(AVContentKeyRequest *request)
+{
+    UNUSED_PARAM(request);
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::didProvidePersistableRequest(AVContentKeyRequest *request)
+{
+    UNUSED_PARAM(request);
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest(AVContentKeyRequest *request, NSError *error)
+{
+    UNUSED_PARAM(request);
+    UNUSED_PARAM(error);
+    m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed);
+}
+
+bool CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason(AVContentKeyRequest *request, NSString *reason)
+{
+    UNUSED_PARAM(request);
+    UNUSED_PARAM(reason);
+    notImplemented();
+    return false;
+}
+
+void CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged(NSData *sessionIdentifier)
+{
+    if (!sessionIdentifier) {
+        m_sessionId = emptyString();
+        return;
+    }
+
+    auto sessionIdentifierString = adoptNS([[NSString alloc] initWithData:sessionIdentifier encoding:NSUTF8StringEncoding]);
+    m_sessionId = sessionIdentifierString.get();
+}   
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOBoxcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp                            (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp       2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOBox.h"
+
+#include <runtime/DataView.h>
+
+using JSC::DataView;
+
+namespace WebCore {
+
+ISOBox::PeekResult ISOBox::peekBox(DataView& view, unsigned offset)
+{
+    uint64_t size = 0;
+    if (!checkedRead<uint32_t>(size, view, offset, BigEndian))
+        return std::nullopt;
+
+    FourCC type = { 0 };
+    if (!checkedRead<uint32_t>(type, view, offset, BigEndian))
+        return std::nullopt;
+
+    if (size == 1 && !checkedRead<uint64_t>(size, view, offset, BigEndian))
+        return std::nullopt;
+
+    return std::make_pair(type, size);
+}
+
+bool ISOBox::read(DataView& view)
+{
+    unsigned localOffset { 0 };
+    return parse(view, localOffset);
+}
+
+bool ISOBox::read(DataView& view, unsigned& offset)
+{
+    unsigned localOffset = offset;
+    if (!parse(view, localOffset))
+        return false;
+
+    offset += m_size;
+    return true;
+}
+
+bool ISOBox::parse(DataView& view, unsigned& offset)
+{
+    if (!checkedRead<uint32_t>(m_size, view, offset, BigEndian))
+        return false;
+
+    if (!checkedRead<uint32_t>(m_boxType, view, offset, BigEndian))
+        return false;
+
+    if (m_size == 1 && !checkedRead<uint64_t>(m_size, view, offset, BigEndian))
+        return false;
+
+    if (m_boxType.value == 'uuid') {
+        struct ExtendedType {
+            uint8_t value[16];
+        } extendedTypeStruct;
+        if (!checkedRead<ExtendedType>(extendedTypeStruct, view, offset, BigEndian))
+            return false;
+
+        Vector<uint8_t> extendedType;
+        extendedType.reserveInitialCapacity(16);
+        for (auto& character : extendedTypeStruct.value)
+            extendedType.uncheckedAppend(character);
+        m_extendedType = WTFMove(extendedType);
+    }
+
+    return true;
+}
+
+bool ISOFullBox::parse(DataView& view, unsigned& offset)
+{
+    if (!ISOBox::parse(view, offset))
+        return false;
+
+    uint32_t versionAndFlags = 0;
+    if (!checkedRead<uint32_t>(versionAndFlags, view, offset, BigEndian))
+        return false;
+
+    m_version = versionAndFlags >> 24;
+    m_flags = versionAndFlags & 0xFFFFFF;
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOBoxh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/iso/ISOBox.h (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOBox.h                              (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOBox.h 2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "FourCC.h"
+#include <wtf/Forward.h>
+#include <wtf/TypeCasts.h>
+
+namespace JSC {
+class DataView;
+}
+
+namespace WebCore {
+
+class ISOBox {
+public:
+    virtual ~ISOBox() = default;
+
+    using PeekResult = std::optional<std::pair<FourCC, uint64_t>>;
+    static PeekResult peekBox(JSC::DataView&, unsigned offset);
+    static size_t minimumBoxSize() { return 2 * sizeof(uint32_t); }
+
+    bool read(JSC::DataView&);
+    bool read(JSC::DataView&, unsigned& offset);
+
+    uint64_t size() const { return m_size; }
+    const FourCC& boxType() const { return m_boxType; }
+    const Vector<uint8_t>& extendedType() const { return m_extendedType; }
+
+protected:
+    virtual bool parse(JSC::DataView&, unsigned& offset);
+
+    enum Endianness {
+        BigEndian,
+        LittleEndian,
+    };
+
+    template <typename T, typename R, typename V>
+    static bool checkedRead(R& returnValue, V& view, unsigned& offset, Endianness endianness)
+    {
+        bool readStatus = false;
+        T value = view.template read<T>(offset, endianness == LittleEndian, &readStatus);
+        if (!readStatus)
+            return false;
+
+        returnValue = value;
+        return true;
+    }
+
+    uint64_t m_size { 0 };
+    FourCC m_boxType { 0 };
+    Vector<uint8_t> m_extendedType;
+};
+
+class ISOFullBox : public ISOBox {
+public:
+    uint8_t version() const { return m_version; }
+    uint32_t flags() const { return m_flags; }
+
+protected:
+    bool parse(JSC::DataView&, unsigned& offset) override;
+
+    uint8_t m_version { 0 };
+    uint32_t m_flags { 0 };
+};
+
+}
+
+#define SPECIALIZE_TYPE_TRAITS_ISOBOX(ISOBoxType) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ISOBoxType) \
+static bool isType(const WebCore::ISOBox& box) { return box.boxType() == WebCore::ISOBoxType::boxTypeName(); } \
+SPECIALIZE_TYPE_TRAITS_END()
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOOriginalFormatBoxcppfromrev224706trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.cpp (from rev 224706, trunk/Source/WebCore/platform/graphics/FourCC.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.cpp                              (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.cpp 2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOOriginalFormatBox.h"
+
+#include <runtime/DataView.h>
+
+using JSC::DataView;
+
+namespace WebCore {
+
+bool ISOOriginalFormatBox::parse(DataView& view, unsigned& offset)
+{
+    if (!ISOBox::parse(view, offset))
+        return false;
+
+    return checkedRead<uint32_t>(m_dataFormat, view, offset, BigEndian);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOOriginalFormatBoxhfromrev224706trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h (from rev 224706, trunk/Source/WebCore/platform/graphics/FourCC.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h   2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOBox.h"
+
+namespace WebCore {
+
+class ISOOriginalFormatBox : public ISOBox {
+public:
+    static FourCC boxTypeName() { return 'frma'; }
+
+    FourCC dataFormat() const { return m_dataFormat; }
+
+protected:
+    bool parse(JSC::DataView&, unsigned& offset) override;
+
+    FourCC m_dataFormat { 0 };
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_ISOBOX(ISOOriginalFormatBox)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOProtectionSchemeInfoBoxcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp   2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOProtectionSchemeInfoBox.h"
+
+#include "ISOSchemeInformationBox.h"
+#include "ISOSchemeTypeBox.h"
+#include <runtime/DataView.h>
+
+using JSC::DataView;
+
+namespace WebCore {
+
+bool ISOProtectionSchemeInfoBox::parse(DataView& view, unsigned& offset)
+{
+    unsigned localOffset = offset;
+    if (!ISOFullBox::parse(view, localOffset))
+        return false;
+
+    if (m_originalFormatBox.read(view, localOffset))
+        return false;
+
+    if (localOffset - offset == m_size) {
+        offset = localOffset;
+        return true;
+    }
+
+    auto optionalBoxType = ISOBox::peekBox(view, localOffset);
+    if (!optionalBoxType)
+        return false;
+
+    if (optionalBoxType.value().first == ISOSchemeTypeBox::boxTypeName()) {
+        m_schemeTypeBox = std::make_unique<ISOSchemeTypeBox>();
+        if (!m_schemeTypeBox->read(view, localOffset))
+            return false;
+
+        if (localOffset - offset == m_size) {
+            offset = localOffset;
+            return true;
+        }
+
+        optionalBoxType = ISOBox::peekBox(view, localOffset);
+        if (!optionalBoxType)
+            return false;
+    }
+
+    if (optionalBoxType.value().first == ISOSchemeInformationBox::boxTypeName()) {
+        m_schemeInformationBox = std::make_unique<ISOSchemeInformationBox>();
+        if (!m_schemeInformationBox->read(view, localOffset))
+            return false;
+
+        if (localOffset - offset != m_size)
+            return false;
+    }
+
+    offset = localOffset;
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOProtectionSchemeInfoBoxhfromrev224706trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.h (from rev 224706, trunk/Source/WebCore/platform/graphics/FourCC.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.h                          (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.h     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOOriginalFormatBox.h"
+
+namespace WebCore {
+
+class ISOSchemeTypeBox;
+class ISOSchemeInformationBox;
+
+class ISOProtectionSchemeInfoBox : public ISOFullBox {
+public:
+    static FourCC boxTypeName() { return 'sinf'; }
+
+    const ISOSchemeTypeBox* schemeTypeBox() const { return m_schemeTypeBox.get(); }
+    const ISOSchemeInformationBox* schemeInformationBox() const { return m_schemeInformationBox.get(); }
+
+protected:
+    bool parse(JSC::DataView&, unsigned& offset) override;
+
+    ISOOriginalFormatBox m_originalFormatBox;
+    std::unique_ptr<ISOSchemeTypeBox> m_schemeTypeBox;
+    std::unique_ptr<ISOSchemeInformationBox> m_schemeInformationBox;
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_ISOBOX(ISOProtectionSchemeInfoBox)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOSchemeInformationBoxcppfromrev224706trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.cpp (from rev 224706, trunk/Source/WebCore/platform/graphics/FourCC.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.cpp                           (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.cpp      2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOSchemeInformationBox.h"
+
+#include "ISOTrackEncryptionBox.h"
+#include <runtime/DataView.h>
+
+using JSC::DataView;
+
+namespace WebCore {
+
+bool ISOSchemeInformationBox::parse(DataView& view, unsigned& offset)
+{
+    unsigned localOffset = offset;
+    if (!ISOBox::parse(view, localOffset))
+        return false;
+
+    auto schemeSpecificBoxType = ISOBox::peekBox(view, localOffset);
+    if (!schemeSpecificBoxType)
+        return false;
+
+    if (schemeSpecificBoxType.value().first == ISOTrackEncryptionBox::boxTypeName()) {
+        if (localOffset + schemeSpecificBoxType.value().second > offset + m_size)
+            return false;
+
+        m_schemeSpecificData = std::make_unique<ISOTrackEncryptionBox>();
+        if (!m_schemeSpecificData->read(view, localOffset))
+            return false;
+    }
+
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOSchemeInformationBoxhfromrev224706trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.h (from rev 224706, trunk/Source/WebCore/platform/graphics/FourCC.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.h                             (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.h        2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOBox.h"
+
+namespace WebCore {
+
+class ISOSchemeInformationBox : public ISOBox {
+public:
+    static FourCC boxTypeName() { return 'schi'; }
+
+    const ISOBox* schemeSpecificData() const { return m_schemeSpecificData.get(); }
+
+protected:
+    bool parse(JSC::DataView&, unsigned& offset) override;
+
+    std::unique_ptr<ISOBox> m_schemeSpecificData;
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_ISOBOX(ISOSchemeInformationBox)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOSchemeTypeBoxcppfromrev224706trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.cpp (from rev 224706, trunk/Source/WebCore/platform/graphics/FourCC.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.cpp                          (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.cpp     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOSchemeTypeBox.h"
+
+#include <runtime/DataView.h>
+
+using JSC::DataView;
+
+namespace WebCore {
+
+bool ISOSchemeTypeBox::parse(DataView& view, unsigned& offset)
+{
+    if (!ISOFullBox::parse(view, offset))
+        return false;
+
+    if (!checkedRead<uint32_t>(m_schemeType, view, offset, BigEndian))
+        return false;
+
+    if (!checkedRead<uint32_t>(m_schemeVersion, view, offset, BigEndian))
+        return false;
+
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOSchemeTypeBoxhfromrev224706trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h (from rev 224706, trunk/Source/WebCore/platform/graphics/FourCC.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h                            (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h       2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOBox.h"
+
+namespace WebCore {
+
+class ISOSchemeTypeBox : public ISOFullBox {
+public:
+    static FourCC boxTypeName() { return 'schm'; }
+
+    FourCC schemeType() const { return m_schemeType; }
+    uint32_t schemeVersion() const { return m_schemeVersion; }
+
+protected:
+    bool parse(JSC::DataView&, unsigned& offset) override;
+
+    FourCC m_schemeType { 0 };
+    uint32_t m_schemeVersion { 0 };
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_ISOBOX(ISOSchemeTypeBox)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOTrackEncryptionBoxcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.cpp (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.cpp                             (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.cpp        2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOTrackEncryptionBox.h"
+
+#include <runtime/DataView.h>
+
+using JSC::DataView;
+
+namespace WebCore {
+
+bool ISOTrackEncryptionBox::parse(DataView& view, unsigned& offset)
+{
+    // ISO/IEC 23001-7-2015 Section 8.2.2
+    if (!ISOFullBox::parse(view, offset))
+        return false;
+
+    // unsigned int(8) reserved = 0;
+    offset += 2;
+
+    if (!m_version) {
+        // unsigned int(8) reserved = 0;
+        offset += 2;
+    } else {
+        int8_t cryptAndSkip = 0;
+        if (!checkedRead<int8_t>(cryptAndSkip, view, offset, BigEndian))
+            return false;
+
+        m_defaultCryptByteBlock = cryptAndSkip >> 4;
+        m_defaultSkipByteBlock = cryptAndSkip & 0xF;
+    }
+
+    if (!checkedRead<int8_t>(m_defaultIsProtected, view, offset, BigEndian))
+        return false;
+
+    if (!checkedRead<int8_t>(m_defaultPerSampleIVSize, view, offset, BigEndian))
+        return false;
+
+    auto buffer = view.possiblySharedBuffer();
+    if (!buffer)
+        return false;
+
+    auto keyIDBuffer = buffer->slice(offset, offset + 16);
+    if (!keyIDBuffer)
+        return false;
+
+    offset += 16;
+
+    m_defaultKID.resize(16);
+    memcpy(m_defaultKID.data(), keyIDBuffer->data(), 16);
+
+    if (m_defaultIsProtected == 1 && !m_defaultPerSampleIVSize) {
+        int8_t defaultConstantIVSize = 0;
+        if (!checkedRead<int8_t>(defaultConstantIVSize, view, offset, BigEndian))
+            return false;
+
+        Vector<uint8_t> defaultConstantIV;
+        defaultConstantIV.reserveInitialCapacity(defaultConstantIVSize);
+        while (defaultConstantIVSize--) {
+            int8_t character = 0;
+            if (!checkedRead<int8_t>(character, view, offset, BigEndian))
+                return false;
+            defaultConstantIV.uncheckedAppend(character);
+        }
+        m_defaultConstantIV = WTFMove(defaultConstantIV);
+    }
+
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOTrackEncryptionBoxhfromrev224706trunkSourceWebCoreplatformgraphicsFourCCh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h (from rev 224706, trunk/Source/WebCore/platform/graphics/FourCC.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h                               (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h  2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "ISOBox.h"
+
+namespace WebCore {
+
+class ISOTrackEncryptionBox : public ISOFullBox {
+public:
+    static FourCC boxTypeName() { return 'tenc'; }
+
+    std::optional<int8_t> defaultCryptByteBlock() const { return m_defaultCryptByteBlock; }
+    std::optional<int8_t> defaultSkipByteBlock() const { return m_defaultSkipByteBlock; }
+    int8_t defaultIsProtected() const { return m_defaultIsProtected; }
+    int8_t defaultPerSampleIVSize() const { return m_defaultPerSampleIVSize; }
+    Vector<uint8_t> defaultKID() const { return m_defaultKID; }
+    Vector<uint8_t> defaultConstantIV() const { return m_defaultConstantIV; }
+
+protected:
+    bool parse(JSC::DataView&, unsigned& offset) override;
+
+    std::optional<int8_t> m_defaultCryptByteBlock;
+    std::optional<int8_t> m_defaultSkipByteBlock;
+    int8_t m_defaultIsProtected { 0 };
+    int8_t m_defaultPerSampleIVSize { 0 };
+    Vector<uint8_t> m_defaultKID;
+    Vector<uint8_t> m_defaultConstantIV;
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_ISOBOX(ISOTrackEncryptionBox)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOVTTCuecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp                         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp    2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. ``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
+ * 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 "ISOVTTCue.h"
+
+#include "Logging.h"
+#include <runtime/ArrayBuffer.h>
+#include <runtime/DataView.h>
+#include <runtime/Int8Array.h>
+#include <runtime/JSCInlines.h>
+#include <runtime/TypedArrayInlines.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
+
+using JSC::DataView;
+
+namespace WebCore {
+
+class ISOStringBox : public ISOBox {
+public:
+    const String& contents() { return m_contents; }
+
+protected:
+    bool parse(JSC::DataView& view, unsigned& offset) override
+    {
+        unsigned localOffset = offset;
+        if (!ISOBox::parse(view, localOffset))
+            return false;
+
+        auto characterCount = m_size - (localOffset - offset);
+        if (!characterCount) {
+            m_contents = emptyString();
+            return true;
+        }
+
+        StringVector<LChar> characters;
+        characters.reserveInitialCapacity((size_t)characterCount);
+        while (characterCount--) {
+            int8_t character = 0;
+            if (!checkedRead<int8_t>(character, view, localOffset, BigEndian))
+                return false;
+            characters.uncheckedAppend(character);
+        }
+
+        m_contents.adopt(WTFMove(characters));
+        offset = localOffset;
+        return true;
+    }
+    String m_contents;
+};
+
+static FourCC vttIdBoxType() { return 'iden'; }
+static FourCC vttSettingsBoxType() { return 'sttg'; }
+static FourCC vttPayloadBoxType() { return 'payl'; }
+static FourCC vttCurrentTimeBoxType() { return 'ctim'; }
+static FourCC vttCueSourceIDBoxType() { return 'vsid'; }
+
+ISOWebVTTCue::ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& duration)
+    : m_presentationTime(presentationTime)
+    , m_duration(duration)
+{
+}
+
+bool ISOWebVTTCue::parse(DataView& view, unsigned& offset)
+{
+    ISOStringBox stringBox;
+
+    while (stringBox.read(view, offset)) {
+        if (stringBox.boxType() == vttCueSourceIDBoxType())
+            m_sourceID = stringBox.contents();
+        else if (stringBox.boxType() == vttIdBoxType())
+            m_identifier = stringBox.contents();
+        else if (stringBox.boxType() == vttCurrentTimeBoxType())
+            m_originalStartTime = stringBox.contents();
+        else if (stringBox.boxType() == vttSettingsBoxType())
+            m_settings = stringBox.contents();
+        else if (stringBox.boxType() == vttPayloadBoxType())
+            m_cueText = stringBox.contents();
+        else
+            LOG(Media, "ISOWebVTTCue::ISOWebVTTCue - skipping box id = \"%s\", size = %zu", stringBox.boxType().toString().utf8().data(), (size_t)stringBox.size());
+    }
+    return true;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsisoISOVTTCuehfromrev224706trunkSourceWebCoreplatformgraphicsISOVTTCueh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h (from rev 224706, trunk/Source/WebCore/platform/graphics/ISOVTTCue.h) (0 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h                           (rev 0)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h      2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. ``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
+ * 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 "ISOBox.h"
+#include <wtf/MediaTime.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+// 4 bytes : 4CC : identifier = 'vttc'
+// 4 bytes : unsigned : length
+// N bytes : CueSourceIDBox : box : optional
+// N bytes : CueIDBox : box : optional
+// N bytes : CueTimeBox : box : optional
+// N bytes : CueSettingsBox : box : optional
+// N bytes : CuePayloadBox : box : required
+class ISOWebVTTCue : public ISOBox {
+public:
+    ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& duration);
+
+    static FourCC boxTypeName() { return 'vtcc'; }
+
+    const MediaTime& presentationTime() const { return m_presentationTime; }
+    const MediaTime& duration() const { return m_duration; }
+
+    const String& sourceID() const { return m_sourceID; }
+    const String& id() const { return m_identifier; }
+    const String& originalStartTime() const { return m_originalStartTime; }
+    const String& settings() const { return m_settings; }
+    const String& cueText() const { return m_cueText; }
+
+protected:
+    bool parse(JSC::DataView&, unsigned& offset) override;
+
+    MediaTime m_presentationTime;
+    MediaTime m_duration;
+
+    String m_sourceID;
+    String m_identifier;
+    String m_originalStartTime;
+    String m_settings;
+    String m_cueText;
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingMockCDMFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockCDMFactory.cpp (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockCDMFactory.cpp  2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/testing/MockCDMFactory.cpp     2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -264,6 +264,12 @@
</span><span class="cx">     return Failed;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+CDMInstance::SuccessValue MockCDMInstance::setStorageDirectory(const String&)
+{
+    // On disk storage is unused; no-op.
+    return Succeeded;
+}
+
</ins><span class="cx"> void MockCDMInstance::requestLicense(LicenseType licenseType, const AtomicString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback callback)
</span><span class="cx"> {
</span><span class="cx">     MockCDMFactory* factory = m_cdm ? m_cdm->factory() : nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockCDMFactoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockCDMFactory.h (224706 => 224707)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockCDMFactory.h    2017-11-10 22:36:13 UTC (rev 224706)
+++ trunk/Source/WebCore/testing/MockCDMFactory.h       2017-11-10 23:02:14 UTC (rev 224707)
</span><span class="lines">@@ -133,6 +133,7 @@
</span><span class="cx">     SuccessValue setDistinctiveIdentifiersAllowed(bool) final;
</span><span class="cx">     SuccessValue setPersistentStateAllowed(bool) final;
</span><span class="cx">     SuccessValue setServerCertificate(Ref<SharedBuffer>&&) final;
</span><ins>+    SuccessValue setStorageDirectory(const String&) final;
</ins><span class="cx">     void requestLicense(LicenseType, const AtomicString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback) final;
</span><span class="cx">     void updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback) final;
</span><span class="cx">     void loadSession(LicenseType, const String&, const String&, LoadSessionCallback) final;
</span></span></pre>
</div>
</div>

</body>
</html>