File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
CefSharp.BrowserSubprocess.Core
CefSharp.Core/BrowserSubprocess Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,12 @@ namespace CefSharp
28
28
29
29
}
30
30
31
+ #ifdef NETCOREAPP
31
32
// / <summary>
32
33
// / This function should be called from the application entry point function (typically Program.Main)
33
34
// / to execute a secondary process e.g. gpu, renderer, utility
34
35
// / This overload is specifically used for .Net Core. For hosting your own BrowserSubProcess
35
36
// / it's preferable to use the Main method provided by this class.
36
- // / - Obtains the command line args via a call to Environment::GetCommandLineArgs
37
37
// / </summary>
38
38
// / <returns>
39
39
// / If called for the browser process (identified by no "type" command-line value) it will return immediately
@@ -45,6 +45,7 @@ namespace CefSharp
45
45
auto subProcess = gcnew BrowserSubprocessExecutable ();
46
46
return subProcess->Main (args, nullptr );
47
47
}
48
+ #endif
48
49
49
50
// / <summary>
50
51
// / This function should be called from the application entry point function (typically Program.Main)
Original file line number Diff line number Diff line change @@ -31,6 +31,24 @@ namespace CefSharp
31
31
{
32
32
33
33
}
34
+
35
+ // / <summary>
36
+ // / This function should be called from the application entry point function (typically Program.Main)
37
+ // / to execute a secondary process e.g. gpu, renderer, utility
38
+ // / This overload is specifically used for .Net 4.x. For hosting your own BrowserSubProcess
39
+ // / it's preferable to use the Main method provided by this class.
40
+ // / </summary>
41
+ // / <returns>
42
+ // / If called for the browser process (identified by no "type" command-line value) it will return immediately
43
+ // / with a value of -1. If called for a recognized secondary process it will block until the process should exit
44
+ // / and then return the process exit code.
45
+ // / </returns
46
+ static int MainSelfHost (array<String^>^ args)
47
+ {
48
+ auto subProcess = gcnew WcfBrowserSubprocessExecutable ();
49
+ return subProcess->Main (args, nullptr );
50
+ }
51
+
34
52
protected:
35
53
SubProcess^ GetSubprocess(IEnumerable<String^>^ args, int parentProcessId, IRenderProcessHandler^ handler) override
36
54
{
Original file line number Diff line number Diff line change @@ -77,12 +77,13 @@ public static int Main(string[] args)
77
77
browserSubprocessDllPath = Path . Combine ( Path . GetDirectoryName ( typeof ( CefSharp . Core . BrowserSettings ) . Assembly . Location ) , "CefSharp.BrowserSubprocess.Core.dll" ) ;
78
78
}
79
79
var browserSubprocessDll = System . Runtime . Loader . AssemblyLoadContext . Default . LoadFromAssemblyPath ( browserSubprocessDllPath ) ;
80
+ var browserSubprocessExecutableType = browserSubprocessDll . GetType ( "CefSharp.BrowserSubprocess.BrowserSubprocessExecutable" ) ;
80
81
#else
81
82
var browserSubprocessDllPath = Path . Combine ( Path . GetDirectoryName ( typeof ( CefSharp . Core . BrowserSettings ) . Assembly . Location ) , "CefSharp.BrowserSubprocess.Core.dll" ) ;
82
83
var browserSubprocessDll = System . Reflection . Assembly . LoadFrom ( browserSubprocessDllPath ) ;
83
-
84
+ var browserSubprocessExecutableType = browserSubprocessDll . GetType ( "CefSharp.BrowserSubprocess.WcfBrowserSubprocessExecutable" ) ;
84
85
#endif
85
- var browserSubprocessExecutableType = browserSubprocessDll . GetType ( "CefSharp.BrowserSubprocess.BrowserSubprocessExecutable" ) ;
86
+
86
87
var browserSubprocessExecutable = Activator . CreateInstance ( browserSubprocessExecutableType ) ;
87
88
88
89
var mainMethod = browserSubprocessExecutableType . GetMethod ( "MainSelfHost" , System . Reflection . BindingFlags . Static | System . Reflection . BindingFlags . Public ) ;
You can’t perform that action at this time.
0 commit comments