зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1194891. P4 - close all streams associated with private browsing windows when PB is done. r=cpearce
MozReview-Commit-ID: MmvMuzuFX3 --HG-- extra : rebase_source : d5f98bd815323e9a79959af49a9585d8f6108d28 extra : source : 7a82be361a50b950b579a5f6b1872d10de80d76f
This commit is contained in:
Родитель
1964dd6b54
Коммит
d64d62164c
|
@ -140,6 +140,11 @@ public:
|
|||
static void Flush();
|
||||
void FlushInternal();
|
||||
|
||||
// Close all streams associated with private browsing windows. This will
|
||||
// also remove the blocks from the cache since we don't want to leave any
|
||||
// traces when PB is done.
|
||||
static void CloseStreamsForPrivateBrowsing();
|
||||
|
||||
// Cache-file access methods. These are the lowest-level cache methods.
|
||||
// mReentrantMonitor must be held; these can be called on any thread.
|
||||
// This can return partial reads.
|
||||
|
@ -355,10 +360,12 @@ NS_IMETHODIMP
|
|||
MediaCacheFlusher::Observe(nsISupports *aSubject, char const *aTopic, char16_t const *aData)
|
||||
{
|
||||
if (strcmp(aTopic, "last-pb-context-exited") == 0) {
|
||||
MediaCache::Flush();
|
||||
MediaCache::CloseStreamsForPrivateBrowsing();
|
||||
return NS_OK;
|
||||
}
|
||||
if (strcmp(aTopic, "cacheservice:empty-cache") == 0) {
|
||||
MediaCache::Flush();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -614,6 +621,20 @@ MediaCache::FlushInternal()
|
|||
Init();
|
||||
}
|
||||
|
||||
void
|
||||
MediaCache::CloseStreamsForPrivateBrowsing()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!gMediaCache) {
|
||||
return;
|
||||
}
|
||||
for (auto& s : gMediaCache->mStreams) {
|
||||
if (s->mIsPrivateBrowsing) {
|
||||
s->Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaCache::MaybeShutdown()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче