The global PB service is going away. We'll probably need to have two separate media caches, since there could be a PB window watching a video and a regular window watching another concurrently.
We can at least clear out the private media cache based on the last-pb-context-destroyed notification in bug 725210.
Robert, what work will be required to allow multiple media caches? I scanned through nsMediaCache for places that use gMediaCache, and it didn't look like a completely straightforward process for someone brand new to the media code.
It's not trivial, but I think it's not hard. -- Give each nsMediaCacheStream a reference to its nsMediaCache. Make nsMediaCacheStream::Init indicate which cache to use (could just be an enum). Then InitMediaCache would take that enum as a parameter and index into a global array. Or some value of the enum could create a new unique nsMediaCache and add it to the array. -- Make MaybeShutdown nonstatic. -- Make nsMediaCacheFlusher iterate through the global array. (Would it still be needed though?) -- Give each ResourceStreamIterator a reference to its nsMediaCache. -- Give each UpdateEvent a reference to its nsMediaCache.
OK, so we had talked about this over in bug 572243. To summarize, the media cache does not include the URL to the media resource. The data itself might potentially be used to trace the media item back to its source, but the current approach of clearing the cache when the PB mode is over seems to be sufficient in order to defend against that. The advantage of separating the media cache into two caches is that when leaving the PB mode, the media cache for non-PB media will not get evicted. I think that's definitely something to strive to do, but it's out of scope for this bug. As far as this bug is concerned, we should just preserve the existing functionality.
Created attachment 615606 [details] [diff] [review] Patch (v1)