mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1910452: Part 5 - Release content analysis cache request on main thread r=dlp-reviewers,gstoll
Without this, we assert when releasing the request on the background thread when we hit an error, such as the DLP agent not running. Differential Revision: https://phabricator.services.mozilla.com/D220617
This commit is contained in:
parent
22d811e7da
commit
098eeb9430
@ -1315,6 +1315,11 @@ void ContentAnalysis::DoAnalyzeRequest(
|
||||
nsCOMPtr<nsIContentAnalysisRequest> aRequestToCache,
|
||||
const std::shared_ptr<content_analysis::sdk::Client>& aClient) {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
auto threadsafeErrorHandler = MakeScopeExit([&]() {
|
||||
// Make sure the cache request is destroyed on the main thread.
|
||||
NS_DispatchToMainThread(NS_NewCancelableRunnableFunction(
|
||||
"CARequestErrorCleanup", [aRTC = std::move(aRequestToCache)]() {}));
|
||||
});
|
||||
RefPtr<ContentAnalysis> owner =
|
||||
ContentAnalysis::GetContentAnalysisFromService();
|
||||
if (!owner) {
|
||||
@ -1391,6 +1396,7 @@ void ContentAnalysis::DoAnalyzeRequest(
|
||||
}
|
||||
owner->IssueResponse(response);
|
||||
}));
|
||||
threadsafeErrorHandler.release();
|
||||
}
|
||||
|
||||
void ContentAnalysis::SendWarnResponse(
|
||||
|
Loading…
Reference in New Issue
Block a user