pacificIT / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

CEF3: introduce custom construction of command line of child processes #628

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Mono and Java - it is executables, with own arguments, which incompatible with 
chrome's arguments.
So instead of just using browser_subprocess_path + chrome's arguments, we 
needed allow create custom command line for child processes.

Discussion: http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=844&p=3409#p3416

Original issue reported on code.google.com by fdd...@gmail.com on 5 Jun 2012 at 5:54

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 11 Jun 2012 at 8:05

GoogleCodeExporter commented 9 years ago
I'm add preview patch here. Sorry, can't upload on forum.

Added:
CefApp.UnwrapCommandLine
CefApp.WrapCommandLine
CefCommandLine.PrependWrapper

You can check how it can be used with mono at 
https://bitbucket.org/xilium/xilium.cefglue (look at xicg#1 branch). Just run 
application with:
"C:\Program Files\Mono-2.10.8\bin\monow.exe" Xilium.CefGlue.Client.exe
To concrete CefApp handler implementation see 
https://bitbucket.org/xilium/xilium.cefglue/changeset/e6b9dd5e4a90#chg-CefGlue.C
lient/DemoApp.cs

Continuing discussing here: 
http://www.magpcss.org/ceforum/viewtopic.php?f=10&t=885

PS: Sorry, patch little unclean, 'cause UnwrapCommandLine method now looks as 
not very usable, but i'm not sure just now.

Original comment by fdd...@gmail.com on 25 Jun 2012 at 6:33

Attachments:

GoogleCodeExporter commented 9 years ago
Patch updated. It is very simple.
After patch applied - tools/translator must be applied.

Patch adds:
CefApp.AppendExtraCommandLineSwitches
CommandLine.PrependWrapper

It is looks like enough to run childs correctly via mono.

Original comment by fdd...@gmail.com on 20 Sep 2012 at 12:20

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by fdd...@gmail.com on 20 Sep 2012 at 12:25

Attachments:

GoogleCodeExporter commented 9 years ago
For Xilium.CefGlue project now landed new CefGlue.Demo application which 
demonstrates using of this technique. It now works for GtkSharp using Mono on 
Windows and Linux.
More details here
https://bitbucket.org/xilium/xilium.cefglue/src/8e656226d755/CefGlue.Demo/Common
/DemoCefApp.cs .

Note, CefCommandLine.PrependWrapper method breaks argument by spaces, and can 
prepend many arguments. If you need prepend argument with spaces, then it is 
can be easily work around:

commandLine.PrependWrapper("-"); // must not be a empty line, and must not have 
spaces
commandLine.SetProgram(@"c:\Program Files\..."); // it can contain spaces 
inside.

This works fine with both (windows and posix) platforms.

PS: I think, that it can be useful to pass CefBrowser (if it possible) in 
AppendExtraCommandLineSwitches. Or may be have some way to identity newly 
creating browser with creation process. It can be used to spawn different 
renderer's processes based for example on start url.
Also, now is possible spawn different child processes, for different process 
types. For example for gpu-process or util processes have no sense spawn 
managed renderer, and native child process more desirable.

Original comment by fdd...@gmail.com on 24 Sep 2012 at 8:19

GoogleCodeExporter commented 9 years ago
Oh, also note, that AppendExtraCommandLineSwitches can be called many times.
For example for gpu-process it called twice.

Original comment by fdd...@gmail.com on 24 Sep 2012 at 8:21

GoogleCodeExporter commented 9 years ago
@comment#5: It's not possible to associate all sub-process launches with a 
particular CefBrowser. For example, a single GPU process will be shared by 
multiple browsers. Instead of adding a CefApp::AppendExtraCommandLineSwitches 
callback I think we should add 
CefBrowserProcessHandler::OnBeforeSubProcessLaunch (works the same way, but 
different name and location). We could potentially add a CefBrowser argument 
that would be null for all sub-processes except render processes, but I'm not 
sure how useful that would be in practice.

Original comment by magreenb...@gmail.com on 26 Sep 2012 at 10:38

GoogleCodeExporter commented 9 years ago
@comment#7: About locating CefApp::AppendExtraCommandLineSwitches - i'm add it 
on CefApp 'cause CefApp already have command line processing function.
But CefBrowserProcessHandler::OnBeforeSubProcessLaunch looks good to me.

About optional CefBrowser argument - forget about this, it is useless and it is 
my mistake. When renderer's limit reached - they will be reused and potentially 
in inconsistent way. Choosing subprocesses by subprocess type is enough and all 
information that we have in command line also enough.

Thanks! :)

Original comment by fdd...@gmail.com on 26 Sep 2012 at 11:05

GoogleCodeExporter commented 9 years ago
Added in CEF3 trunk revision 810 and CEF3 1180 branch revision 811.

Original comment by magreenb...@gmail.com on 27 Sep 2012 at 5:09