66using System . Collections . Concurrent ;
77using System . Diagnostics ;
88using System . IO ;
9+ using System . Linq ;
910using System . Threading . Tasks ;
1011
1112namespace CefSharp . OutOfProcess
@@ -27,14 +28,14 @@ public class OutOfProcessHost : IOutOfProcessHostRpc, IDisposable
2728 private int _remoteuiThreadId ;
2829 private int _browserIdentifier = 1 ;
2930 private string _outofProcessHostExePath ;
30- private string _cachePath ;
31+ private Settings _settings ;
3132 private ConcurrentDictionary < int , IChromiumWebBrowserInternal > _browsers = new ConcurrentDictionary < int , IChromiumWebBrowserInternal > ( ) ;
3233 private TaskCompletionSource < OutOfProcessHost > _processInitialized = new TaskCompletionSource < OutOfProcessHost > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
3334
34- private OutOfProcessHost ( string outOfProcessHostExePath , string cachePath = null )
35+ private OutOfProcessHost ( string outOfProcessHostExePath , Settings settings = null )
3536 {
3637 _outofProcessHostExePath = outOfProcessHostExePath ;
37- _cachePath = cachePath ;
38+ _settings = settings ;
3839 }
3940
4041 /// <summary>
@@ -108,7 +109,22 @@ private void Init()
108109 {
109110 var currentProcess = Process . GetCurrentProcess ( ) ;
110111
111- var args = $ "--parentProcessId={ currentProcess . Id } --cachePath={ _cachePath } ";
112+ var args = $ "--parentProcessId={ currentProcess . Id } ";
113+
114+ if ( _settings != null )
115+ {
116+ if ( ! string . IsNullOrEmpty ( _settings . CachePath ) )
117+ {
118+ args += $ " --cachePath={ _settings . CachePath } ";
119+ }
120+
121+ if ( ! string . IsNullOrEmpty ( _settings . RootCachePath ) )
122+ {
123+ args += $ " --rootCachePath={ _settings . RootCachePath } ";
124+ }
125+
126+ args = _settings . AdditionalCommandLineArgs . Aggregate ( args , ( current , next ) => $ "{ current } { next } ") ;
127+ }
112128
113129 _browserProcess = Process . Start ( new ProcessStartInfo ( _outofProcessHostExePath , args )
114130 {
@@ -234,7 +250,7 @@ public void Dispose()
234250 _jsonRpc = null ;
235251 }
236252
237- public static Task < OutOfProcessHost > CreateAsync ( string path = HostExeName , string cachePath = null )
253+ public static Task < OutOfProcessHost > CreateAsync ( string path = HostExeName , Settings settings = null )
238254 {
239255 if ( string . IsNullOrEmpty ( path ) )
240256 {
@@ -248,7 +264,7 @@ public static Task<OutOfProcessHost> CreateAsync(string path = HostExeName, stri
248264 throw new FileNotFoundException ( "Unable to find Host executable." , path ) ;
249265 }
250266
251- var host = new OutOfProcessHost ( fullPath , cachePath ) ;
267+ var host = new OutOfProcessHost ( fullPath , settings ) ;
252268
253269 host . Init ( ) ;
254270
0 commit comments