Bug 1962280 - osclientcerts: avoid unnecessary background thread dispatches r=jschanck

On macOS and Windows, the underlying implementations of the OS APIs that
provide access to keys and certificates are not necessarily thread-safe. Before
this patch, essentially all calls into osclientcerts would be synchronously
forwarded to a single background thread. Unfortunately, the cost of dispatching
and waiting for all of these events was non-trivial, particularly when the vast
majority of them should essentially be no-ops (e.g. when NSS is looking for CA
certificates or trust information, etc.). This patch reworks the implementation
to only dispatch operations involving OS APIs to the background thread.

Differential Revision: https://phabricator.services.mozilla.com/D246520
This commit is contained in:
Dana Keeler
2025-04-29 22:14:22 +00:00
parent 94a0e8698f
commit ef21ac41d5
9 changed files with 533 additions and 592 deletions

4
Cargo.lock generated
View File

@@ -4972,14 +4972,16 @@ dependencies = [
"byteorder",
"core-foundation 0.9.999",
"env_logger",
"futures-executor",
"lazy_static",
"libloading",
"log",
"moz_task",
"pkcs11-bindings",
"rsclientcerts",
"sha2",
"static_prefs",
"winapi",
"xpcom",
]
[[package]]