Closed Bug 1620396 Opened 5 years ago Closed 4 years ago

Convert the thread 'URL Classifier' to use the background thread pool

Categories

(Toolkit :: Safe Browsing, task, P2)

task

Tracking

()

RESOLVED INVALID

People

(Reporter: KrisWright, Unassigned)

References

(Blocks 1 open bug)

Details

The thread URL Classifier [1] uses the NS_NewNamedThread method, so it might be possible to move it to the background thread pool.

In an effort to reduce the number of ad-hoc threads in the browser, we want to convert instances of NS_NewNamedThread to use the background thread pool [2] wherever possible. If your thread may block, you can also include the NS_DISPATCH_EVENT_MAY_BLOCK flag.

[1] https://searchfox.org/mozilla-central/rev/c79c0d65a183d9d38676855f455a5c6a7f7dadd3/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp#1661
[2] https://searchfox.org/mozilla-central/rev/91f6c02fcf4c16f78fdc4417f61f192688294066/xpcom/threads/nsThreadUtils.h#1730-1757

Priority: -- → P2

I think URL classifier may not be a best candidate to use background thread. There are two reasons:
1.
SafeBrowsing is now using two threads, URL Classifier[1] and Classifier Update[2], to support lookup and update at the same time.
We have done a lot to sync the data between these two threads during an update[3]. It won't be trivial task to just throw the task to background thread pool.
2.
Classify is a high priority task because that affects channel loads. Changing it to use background thread may impact the performance.

[1] https://searchfox.org/mozilla-central/rev/cfaa250d14e344834932de4c2eed0061701654da/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp#1660
[2] https://searchfox.org/mozilla-central/rev/cfaa250d14e344834932de4c2eed0061701654da/toolkit/components/url-classifier/Classifier.cpp#140
[3] https://searchfox.org/mozilla-central/rev/cfaa250d14e344834932de4c2eed0061701654da/toolkit/components/url-classifier/Classifier.cpp#717-797

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.