forked from cefsharp/CefSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCefSubProcess.cs
More file actions
48 lines (39 loc) · 1.41 KB
/
Copy pathCefSubProcess.cs
File metadata and controls
48 lines (39 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.Collections.Generic;
using System.Linq;
namespace CefSharp.BrowserSubprocess
{
public class CefSubProcess : CefAppWrapper
{
public int? ParentProcessId { get; private set; }
internal CefSubProcess(IEnumerable<string> args)
{
LocateParentProcessId(args);
}
private void LocateParentProcessId(IEnumerable<string> args)
{
// Format being parsed:
// --channel=3828.2.1260352072\1102986608
// We only really care about the PID (3828) part.
const string channelPrefix = "--channel=";
var channelArgument = args.SingleOrDefault(arg => arg.StartsWith(channelPrefix));
if (channelArgument == null)
{
return;
}
var parentProcessId = channelArgument
.Substring(channelPrefix.Length)
.Split('.')
.First();
ParentProcessId = int.Parse(parentProcessId);
}
public override void OnBrowserCreated(CefBrowserWrapper cefBrowserWrapper)
{
}
public override void OnBrowserDestroyed(CefBrowserWrapper cefBrowserWrapper)
{
}
}
}