Passing command line arguments to the rendering process

1,035 views
Skip to first unread message

Thomas Maierhofer

unread,
Apr 10, 2015, 6:30:41 AM4/10/15
to cef...@googlegroups.com
How can I pass parameters to the rendering process?

I tried to pass it as arguments:

var cefArgs = new CefMainArgs(new []{"/MyParam=XXXX"});
CefRuntime.Initialize(cefArgs, cefSettings, app, IntPtr.Zero);

but in the rendering process I get only:

START NOW: 16
--type=gpu-process
--channel=10824.0.1849746523\129369305
--no-sandbox
--lang=en-US
--log-file=CefGlue.log
--log-severity=info
--supports-dual-gpus=false
--gpu-driver-bug-workarounds=1,17,38,46
--gpu-vendor-id=0x10de
--gpu-device-id=0x0615
--gpu-driver-vendor=NVIDIA
--gpu-driver-version=9.18.13.4144
--lang=en-US
--log-file=CefGlue.log
--log-severity=info
/prefetch:822062411





Alex Maitland

unread,
Apr 10, 2015, 7:06:00 AM4/10/15
to cef...@googlegroups.com
Search for `OnBeforeCommandLineProcessing`, it should be part of `CefApp`, you can append command line args there.

Thomas Maierhofer

unread,
Apr 10, 2015, 7:22:28 AM4/10/15
to cef...@googlegroups.com
I tried            
commandLine.AppendSwitch("TEST","TestValue");
commandLine.AppendArgument("asdfasdf");

in OnBeforeCommandLineProcessing.
No passing of the arguments to the render process.


Alex Maitland

unread,
Apr 10, 2015, 7:50:01 AM4/10/15
to cef...@googlegroups.com
Try passing in a valid command line option like `renderer-process-limit`

Example from the demo
https://bitbucket.org/xilium/xilium.cefglue/src/4929a2c3d1a561f66fafcc758b45ff4cc0b7e9db/CefGlue.Demo/Common/DemoCefApp.cs?at=default#cl-27

Thomas Maierhofer

unread,
Apr 10, 2015, 9:12:58 AM4/10/15
to cef...@googlegroups.com

I need to pass my own arguments to the rendering process. Seems this is not possible.

Alex Maitland

unread,
Apr 11, 2015, 8:59:52 PM4/11/15
to cef...@googlegroups.com
You can use `CEF`'s IPC mechanism to communicate directly with the render process.

Thomas Maierhofer

unread,
Apr 13, 2015, 2:49:36 AM4/13/15
to cef...@googlegroups.com
I need to perform some settings before the CEF runtime is even loaded. So IPC is not available at this point.
E.G. If you have to pass a path to the CEF rendering process.

Alex Maitland

unread,
Apr 13, 2015, 5:06:27 AM4/13/15
to cef...@googlegroups.com
You'll have to get creative then.

Alex Maitland

unread,
Apr 13, 2015, 6:37:35 AM4/13/15
to cef...@googlegroups.com
I remembered there's another command line entry point, turns out it will let you append your own params. Test on the `2171` branch. No idea how the function maps in `CefGlue`.

http://magpcss.org/ceforum/apidocs3/projects/%28default%29/CefBrowserProcessHandler.html#OnBeforeChildProcessLaunch%28CefRefPtr%3CCefCommandLine%3E%29
Reply all
Reply to author
Forward
0 new messages