Bug 1338446 Part 1 - Label dispatching ShortTermURISpecCache by using SystemGroup.
In ErrorReporter::~ErrorReporter(), we dispatch sSpecCache to clear itself.
It's not related to content, so label it by using SystemGroup.
Use another runnable pointer to keep sSpecCache alive.
MozReview-Commit-ID: JN1qrS2jxFs
--- a/layout/style/ErrorReporter.cpp
+++ b/layout/style/ErrorReporter.cpp
@@ -6,16 +6,17 @@
/* diagnostic reporting for CSS style sheet parser */
#include "mozilla/css/ErrorReporter.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
+#include "mozilla/SystemGroup.h"
#include "nsCSSScanner.h"
#include "nsIConsoleService.h"
#include "nsIDocument.h"
#include "nsIFactory.h"
#include "nsIScriptError.h"
#include "nsIStringBundle.h"
#include "nsServiceManagerUtils.h"
#include "nsStyleUtil.h"
@@ -148,17 +149,21 @@ ErrorReporter::ErrorReporter(const nsCSS
}
ErrorReporter::~ErrorReporter()
{
// Schedule deferred cleanup for cached data. We want to strike a
// balance between performance and memory usage, so we only allow
// short-term caching.
if (sSpecCache && sSpecCache->IsInUse() && !sSpecCache->IsPending()) {
- if (NS_FAILED(NS_DispatchToCurrentThread(sSpecCache))) {
+ nsCOMPtr<nsIRunnable> runnable(sSpecCache);
+ nsresult rv =
+ SystemGroup::Dispatch("ShortTermURISpecCache", TaskCategory::Other,
+ runnable.forget());
+ if (NS_FAILED(rv)) {
// Peform the "deferred" cleanup immediately if the dispatch fails.
sSpecCache->Run();
} else {
sSpecCache->SetPending();
}
}
}