You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’d like to run WebView2 on a thread that is not the UI thread, but I am implementing a dedicated message pump for processing WebView2 messages. Are there any downsides to this approach? I chose this method to ensure that WebView2 messages are processed promptly, as they can cause delays when handled on the UI thread.
Please note that the HWND being passed to CreateController is created in the UI thread.
I’ve tested this setup and haven’t encountered any issues so far, but I want to confirm if it’s a safe and reliable approach moving forward.
Reason for asking this is because in the "Threading model for WebView2 apps" webview2 article it is mentioned that it must be run in UI thread.
" The WebView2 must be created on a UI thread that uses a message pump. All callbacks occur on that thread, and requests into the WebView2 must be done on that thread. It isn't safe to use the WebView2 from another thread.
"
Link to article https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/threading-model
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I’d like to run WebView2 on a thread that is not the UI thread, but I am implementing a dedicated message pump for processing WebView2 messages. Are there any downsides to this approach? I chose this method to ensure that WebView2 messages are processed promptly, as they can cause delays when handled on the UI thread.
Please note that the HWND being passed to CreateController is created in the UI thread.
I’ve tested this setup and haven’t encountered any issues so far, but I want to confirm if it’s a safe and reliable approach moving forward.
Reason for asking this is because in the "Threading model for WebView2 apps" webview2 article it is mentioned that it must be run in UI thread.
"
The WebView2 must be created on a UI thread that uses a message pump. All callbacks occur on that thread, and requests into the WebView2 must be done on that thread. It isn't safe to use the WebView2 from another thread.
"
Link to article https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/threading-model
Thanks in advance for your insights!
Beta Was this translation helpful? Give feedback.
All reactions