Bug 1553855: Make the Classifier Update thread a LazyIdle thread r=dimi

Differential Revision: https://phabricator.services.mozilla.com/D32529
This commit is contained in:
Randell Jesup
2019-05-27 12:33:40 +00:00
parent 1bd364b509
commit 18a763c705

View File

@@ -19,6 +19,7 @@
#include "mozilla/EndianUtils.h"
#include "mozilla/Telemetry.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/LazyIdleThread.h"
#include "mozilla/Logging.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/Base64.h"
@@ -41,6 +42,8 @@ extern mozilla::LazyLogModule gUrlClassifierDbServiceLog;
#define METADATA_SUFFIX NS_LITERAL_CSTRING(".metadata")
#define DEFAULT_THREAD_TIMEOUT_MS 5000
namespace mozilla {
namespace safebrowsing {
@@ -128,8 +131,9 @@ Classifier::Classifier()
: mIsTableRequestResultOutdated(true),
mUpdateInterrupted(true),
mIsClosed(false) {
NS_NewNamedThread(NS_LITERAL_CSTRING("Classifier Update"),
getter_AddRefs(mUpdateThread));
// Make a lazy thread for any IO
mUpdateThread = new LazyIdleThread(DEFAULT_THREAD_TIMEOUT_MS,
NS_LITERAL_CSTRING("Classifier Update"));
}
Classifier::~Classifier() { Close(); }