Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
When clearing cache, also clear AVFoundation cache.
https://bugs.webkit.org/show_bug.cgi?id=155783 rdar://problem/25252541 Patch by Jeremy Jones <jeremyj@apple.com> on 2016-04-11 Reviewed by Darin Adler. Source/WebCore: Use AVAssetCache at a specified location on disk for all AVURLAssets. This AVAssetCache can then be used to manage the cache storage used by AVFoundation. It is used to query the contents of the cache in originsInMediaCache() and to clear the cache completely or partially in clearMediaCache() and clearMediaCacheForOrigins(). Use SecurityOrigin instead of the less formal site String to represent origins in the cache. * html/HTMLMediaElement.cpp: (WebCore::sharedMediaCacheDirectory): Added. (WebCore::HTMLMediaElement::setMediaCacheDirectory): Added. (WebCore::HTMLMediaElement::mediaCacheDirectory): Added. (WebCore::HTMLMediaElement::originsInMediaCache): Added. (WebCore::HTMLMediaElement::clearMediaCache): Added parameter. (WebCore::HTMLMediaElement::clearMediaCacheForOrigins): Added. (WebCore::HTMLMediaElement::mediaPlayerMediaCacheDirectory): Added. (WebCore::HTMLMediaElement::getSitesInMediaCache): Deleted. (WebCore::HTMLMediaElement::clearMediaCacheForSite): Deleted. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::clearMediaCache): Added parameter. * platform/graphics/MediaPlayer.cpp: (WebCore::addMediaEngine): Add new cache methods. (WebCore::addToHash): Added. (WebCore::MediaPlayer::originsInMediaCache): Added. (WebCore::MediaPlayer::clearMediaCache): Added parameter. (WebCore::MediaPlayer::clearMediaCacheForOrigins): Added. (WebCore::MediaPlayer::getSitesInMediaCache): Deleted. (WebCore::MediaPlayer::clearMediaCacheForSite): Deleted. * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::mediaPlayerMediaCacheDirectory): Added. * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::originsInMediaCache): Added. (WebCore::MediaPlayerPrivateInterface::clearMediaCache): Added parameter. (WebCore::MediaPlayerPrivateInterface::clearMediaCacheForOrigins): Added. (WebCore::MediaPlayerPrivateInterface::getSitesInMediaCache): Deleted. (WebCore::MediaPlayerPrivateInterface::clearMediaCacheForSite): Deleted. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine): Added cache methods. (WebCore::assetCacheForPath): Added. (WebCore::MediaPlayerPrivateAVFoundationObjC::originsInMediaCache): Added. (WebCore::toSystemClockTime): Added. (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache): Added parameter. (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins): Added. (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Added. * platform/graphics/mac/MediaPlayerPrivateQTKit.h: * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivateQTKit::registerMediaEngine): Added cache methods. (WebCore::MediaPlayerPrivateQTKit::originsInMediaCache): Added. (WebCore::MediaPlayerPrivateQTKit::clearMediaCache): Added parameter. (WebCore::MediaPlayerPrivateQTKit::clearMediaCacheForOrigins): Added. (WebCore::MediaPlayerPrivateQTKit::getSitesInMediaCache): Deleted. (WebCore::MediaPlayerPrivateQTKit::clearMediaCacheForSite): Deleted. * platform/spi/mac/AVFoundationSPI.h: Source/WebKit2: Include the HTMLMediaElement media cache when doing disk cache operations. Add a sandbox extension for media cache directory. This allows the UI process and the web process to access the same cache. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode): Add media cache directory. (WebKit::WebProcessCreationParameters::decode): Add media cache directory. * Shared/WebProcessCreationParameters.h: * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::createWithLegacyOptions): (API::ProcessPoolConfiguration::ProcessPoolConfiguration): Add media cache directory. (API::ProcessPoolConfiguration::copy): Add media cache directory. * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/APIWebsiteDataStore.cpp: (API::WebsiteDataStore::defaultMediaCacheDirectory): Default implementation. * UIProcess/API/APIWebsiteDataStore.h: * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: (API::WebsiteDataStore::defaultMediaCacheDirectory): Media cache is in temporary directory. (API::WebsiteDataStore::tempDirectoryFileSystemRepresentation): For resources in temporary directory. (API::WebsiteDataStore::defaultDataStoreConfiguration): Init media cache directory. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): * UIProcess/WebProcessPool.cpp: (WebKit::legacyWebsiteDataStoreConfiguration): Add mediaCacheDirectory. (WebKit::WebProcessPool::createNewWebProcess): Add mediaCacheDirectory. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::WebsiteDataStore): (WebKit::WebsiteDataStore::fetchData): Implement for mediaCacheDirectory. (WebKit::WebsiteDataStore::removeData): Implement for mediaCacheDirectory. * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/efl/WebProcessPoolEfl.cpp: (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Added. * UIProcess/gtk/WebProcessPoolGtk.cpp: (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Added. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): Initialize media cache directory. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Consume sandbox extension. Canonical link: https://commits.webkit.org/174572@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information