Because some media engines download files for <audio> and <video> directly, we need API so a browser can: 1. Get a list of the origins of all files in the media cache. 2. Delete all files in the media cache. 3. Delete all files in the media cache for a given origin.
<rdar://problem/9049280>
Created attachment 83892 [details] Proposed patch
Comment on attachment 83892 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=83892&action=review > Source/WebCore/html/HTMLMediaElement.cpp:2549 > +void HTMLMediaElement::clearMediaCacheForSite(const String site) Should be const String& rather than just const String. > Source/WebCore/html/HTMLMediaElement.h:182 > + void clearMediaCacheForSite(const String); Here too. > Source/WebCore/platform/graphics/MediaPlayer.cpp:731 > +void MediaPlayer::clearMediaCacheForSite(const String site) Here too. > Source/WebCore/platform/graphics/MediaPlayer.h:293 > + void clearMediaCacheForSite(const String); Should be const String& rather than just const String. > Source/WebCore/platform/graphics/MediaPlayerPrivate.h:146 > + void clearMediaCacheForSite(const String) { } Should be const String& rather than just const String.
Oops, landed this when saw the r+ email - which arrived before the one suggesting changes. Will follow up with another check in shortly.
http://trac.webkit.org/changeset/79737 and http://trac.webkit.org/changeset/79744
This patch wasn't quite right as it requires an instance of HTMLMediaElement and only works with one media engine. Instead, the methods on HTMLMediaElement should be static, and it should work with all installed media engines.
Created attachment 84916 [details] Updated patch
Attachment 84916 [details] did not build on chromium: Build output: http://queues.webkit.org/results/8101418
(In reply to comment #8) > Attachment 84916 [details] did not build on chromium: > Build output: http://queues.webkit.org/results/8101418 Oops, forgot a comma :-(
Created attachment 84918 [details] Updated patch, with missing comma.
Comment on attachment 84918 [details] Updated patch, with missing comma. View in context: https://bugs.webkit.org/attachment.cgi?id=84918&action=review > Source/WebCore/platform/graphics/MediaPlayer.cpp:743 > + if (engines.isEmpty()) > + return; > + > + unsigned count = engines.size(); > + for (unsigned ndx = 0; ndx < count; ndx++) { > + if (engines[ndx]->getSitesInMediaCache) > + engines[ndx]->getSitesInMediaCache(sites); > + } No need for a special case for an empty vector. Should use size_t instead of unsigned. I would name the local variable “size” to echo the name of the function. We normally use “i” rather than “ndx” for this sort of thing. Same comments for the other two functions below.
http://trac.webkit.org/changeset/80473