
Previously, COM was initialized in the scope of methods running in the UtilWin process. This is believed to be incorrect (go/chrome-util-win-com-init-chat). COM should be initialized "before you call any of the library functions [...]" [1] and uninitialized "on application shutdown" [2] . Also, a COM STA thread should "have a message loop" [3]. This CL introduces 2 features which: - Request a UI pump for the UtilWin process, instead of a default pump. - Initialize COM for the full lifetime of utility processes that use a UI pump. It also introduces a UMA histogram to see if that reduces hangs in the file select dialog. [1] https://learn.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-coinitialize [2] https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-couninitialize [3]. Bug: 348014083 Change-Id: Id78568c1aace1834b057f5d21e9642ece6a36986 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5599006 Reviewed-by: Patrick Monette <pmonette@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: Robert Kaplow <rkaplow@chromium.org> Commit-Queue: Francois Pierre Doray <fdoray@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Auto-Submit: Francois Pierre Doray <fdoray@chromium.org> Cr-Commit-Position: refs/heads/main@{#1330478}