зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1546158: Add option to mscom::EnsureMTA to forcibly dispatch events to its thread; r=Jamie
In sandboxed processes with Win32k lockdown, when we initialize COM using an MTA on a background thread, the main thread is automatically initialized by the COM runtime as having an implicit MTA. This is fine, except for the fact that if we want to enqueue any work that needs to operate specifically on the EnsureMTA thread, it won't happen. This patch adds a flag to EnsureMTA's constructor that ensures that, even if the current thread is in an MTA (implicit or otherwise), we still forcibly enqueue the closure specifically to the EnsureMTA thread. Differential Revision: https://phabricator.services.mozilla.com/D28391 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ec489aa170
Коммит
557ff156f6
|
@ -50,9 +50,16 @@ class MOZ_STACK_CLASS EnsureMTA final {
|
|||
Unused << thread;
|
||||
}
|
||||
|
||||
enum class Option {
|
||||
Default,
|
||||
// Forcibly dispatch to the thread returned by GetMTAThread(), even if the
|
||||
// current thread is already inside a MTA.
|
||||
ForceDispatch,
|
||||
};
|
||||
|
||||
template <typename FuncT>
|
||||
explicit EnsureMTA(const FuncT& aClosure) {
|
||||
if (IsCurrentThreadMTA()) {
|
||||
explicit EnsureMTA(const FuncT& aClosure, Option aOpt = Option::Default) {
|
||||
if (aOpt != Option::ForceDispatch && IsCurrentThreadMTA()) {
|
||||
// We're already on the MTA, we can run aClosure directly
|
||||
aClosure();
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче