Injecting Commandline Parameters for Offscreen Browser
Posted: Wed Jun 16, 2021 12:22 pm
Our app uses a windowed browser and in certain cases will create offscreen browsers to render some content. We would like the renderer process for the offscreen browsers to have different options than the main renderer for the windowed browser and I'm having trouble figuring out how to do this. Mainly we want to pass --disable-accelerated-video-decode to the offscreen render processes as they perform better in our use case with that flag. That flag causes a performance hit in our windowed browser which is why we don't want to set it generally.
My CefApp subclasses OnBeforeCommandlineProcessing can do this but the only info I have to go on there is the process type and I cannot differentiate between the main renderer and offscreen renderers.
I can pass some extra info into my CreateBrowser call which could be detected in cef app subclasses OnBrowserCreated (if I implement the CefRenderProcessHandler there) but I think that would come in after the renderer process for that browser had already been created. If OnBrowserCreated is called before OnBeforeCommandlineProcessing that would work but I'm not sure that is is the case.
Any ideas on the best way to do this?
My CefApp subclasses OnBeforeCommandlineProcessing can do this but the only info I have to go on there is the process type and I cannot differentiate between the main renderer and offscreen renderers.
I can pass some extra info into my CreateBrowser call which could be detected in cef app subclasses OnBrowserCreated (if I implement the CefRenderProcessHandler there) but I think that would come in after the renderer process for that browser had already been created. If OnBrowserCreated is called before OnBeforeCommandlineProcessing that would work but I'm not sure that is is the case.
Any ideas on the best way to do this?