다음을 통해 공유


CoreWebView2Environment.GetProcessInfos Method

Definition

Returns the list of all CoreWebView2ProcessInfo using same user data folder except for crashpad process.

public System.Collections.Generic.IReadOnlyList<Microsoft.Web.WebView2.Core.CoreWebView2ProcessInfo> GetProcessInfos ();
member this.GetProcessInfos : unit -> System.Collections.Generic.IReadOnlyList<Microsoft.Web.WebView2.Core.CoreWebView2ProcessInfo>
Public Function GetProcessInfos () As IReadOnlyList(Of CoreWebView2ProcessInfo)

Returns

Examples

void WebView_ProcessInfosChanged(object sender, object e)
{
    _processList = WebViewEnvironment.GetProcessInfos();
}

void PerfInfoCmdExecuted(object target, ExecutedRoutedEventArgs e)
{
    string result;
    int processListCount = _processList.Count;
    if (processListCount == 0)
    {
        result = "No process found.";
    }
    else
    {
        result = $"{processListCount} child process(s) found\n\n";
        for (int i = 0; i < processListCount; ++i)
        {
            int processId = _processList[i].ProcessId;
            CoreWebView2ProcessKind kind = _processList[i].Kind;

            var proc = Process.GetProcessById(processId);
            var memoryInBytes = proc.PrivateMemorySize64;
            var b2kb = memoryInBytes / 1024;
            result = result + $"Process ID: {processId} | Process Kind: {kind} | Memory: {b2kb} KB\n";
        }
    }

    MessageBox.Show(this, result, "Process List");
}

Applies to