зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1516133 - Avoid extra main-thread jumps during the URL-classification, r=dimi
This commit is contained in:
Родитель
bf48e8ad9d
Коммит
b944a79f8a
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -51,7 +51,6 @@
|
|||
#include "mozilla/net/UrlClassifierFeatureResult.h"
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "UrlClassifierTelemetryUtils.h"
|
||||
#include "nsIURLFormatter.h"
|
||||
#include "nsIUploadChannel.h"
|
||||
|
@ -170,7 +169,7 @@ class FeatureHolder final {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (TableData* tableData : mTableData) {
|
||||
nsresult rv = aWorker->DoSingleLocalLookupWithURIFragments(
|
||||
rv = aWorker->DoSingleLocalLookupWithURIFragments(
|
||||
fragments, tableData->mTable, tableData->mResults);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -2512,6 +2511,15 @@ bool nsUrlClassifierDBService::ShutdownHasStarted() {
|
|||
return gShuttingDownThread;
|
||||
}
|
||||
|
||||
// static
|
||||
nsUrlClassifierDBServiceWorker* nsUrlClassifierDBService::GetWorker() {
|
||||
if (!sUrlClassifierDBService) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return sUrlClassifierDBService->mWorker;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsUrlClassifierDBService::AsyncClassifyLocalWithFeatures(
|
||||
nsIURI* aURI, const nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures,
|
||||
|
|
|
@ -74,7 +74,9 @@ class nsUrlClassifierDBServiceWorker;
|
|||
class nsIThread;
|
||||
class nsIURI;
|
||||
class UrlClassifierDBServiceWorkerProxy;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace safebrowsing {
|
||||
class Classifier;
|
||||
class ProtocolParser;
|
||||
|
@ -82,6 +84,11 @@ class ProtocolParser;
|
|||
nsresult TablesToResponse(const nsACString& tables);
|
||||
|
||||
} // namespace safebrowsing
|
||||
|
||||
namespace net {
|
||||
class AsyncUrlChannelClassifier;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
// This is a proxy class that just creates a background thread and delegates
|
||||
|
@ -90,6 +97,8 @@ class nsUrlClassifierDBService final : public nsIUrlClassifierDBService,
|
|||
public nsIURIClassifier,
|
||||
public nsIUrlClassifierInfo,
|
||||
public nsIObserver {
|
||||
friend class mozilla::net::AsyncUrlChannelClassifier;
|
||||
|
||||
public:
|
||||
// This is thread safe. It throws an exception if the thread is busy.
|
||||
nsUrlClassifierDBService();
|
||||
|
@ -117,6 +126,10 @@ class nsUrlClassifierDBService final : public nsIUrlClassifierDBService,
|
|||
static bool ShutdownHasStarted();
|
||||
|
||||
private:
|
||||
// This method is used only by AsyncUrlChannelClassifier. If you want to use
|
||||
// it, please contact a safebrowsing/URL-Classifier peer.
|
||||
static nsUrlClassifierDBServiceWorker* GetWorker();
|
||||
|
||||
const nsTArray<nsCString> kObservedPrefs = {
|
||||
NS_LITERAL_CSTRING(CHECK_MALWARE_PREF),
|
||||
NS_LITERAL_CSTRING(CHECK_PHISHING_PREF),
|
||||
|
|
Загрузка…
Ссылка в новой задаче