Skip to content

Commit a6315ad

Browse files
committed
Add check, comment for get_BrowserProcessId
1 parent 3382224 commit a6315ad

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

specs/BrowserProcessExited.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,19 @@ class AppWindow {
6161

6262
HRESULT AppWindow::OnCreateCoreWebView2ControllerCompleted(HRESULT result, ICoreWebView2Controller* controller)
6363
{
64-
// ...
64+
if (result == S_OK)
65+
{
66+
// ...
6567

66-
// Save PID of the browser process serving last WebView created from our
67-
// CoreWebView2Environment.
68-
CHECK_FAILURE(m_webView->get_BrowserProcessId(&m_newestBrowserPid));
68+
// Save PID of the browser process serving last WebView created from our
69+
// CoreWebView2Environment. We know the controller was created with
70+
// S_OK, and it hasn't been closed (we haven't called Close and no
71+
// ProcessFailed event could have been raised yet) so the PID is
72+
// available.
73+
CHECK_FAILURE(m_webView->get_BrowserProcessId(&m_newestBrowserPid));
6974

70-
// ...
75+
// ...
76+
}
7177
}
7278

7379
void AppWindow::CloseWebView(/* ... */) {

0 commit comments

Comments
 (0)