Subprocess won't Process Request

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

Subprocess won't Process Request

Postby bigN » Mon Dec 19, 2016 7:31 pm

I am building an word add in with Custom taspkane where CEF Is loaded via subprocess. For testing purposes I have local html page with few buttous. When button is clicked an XHTML request is sent to custom domain, expecting the result.
I am loading that page in Winform sample project, and when the button is clicked, it successfuly receives the Request in the DumpRequestResourceHandler, ProcessRequest method and send response back, .
When the sample winform project is loaded as subprocess in word customtaskpane It is rendering properly however the request is not processed.
Any idea how or where to register the DumpRequestResourceHandler? Is there another way to handle the above problem efficiently?
bigN
Techie
 
Posts: 10
Joined: Fri Dec 16, 2016 2:58 am

Re: Subprocess won't Process Request

Postby fddima » Tue Dec 20, 2016 7:52 am

Hello.

1. About dump request handler - you should register it with CefRuntime.RegisterSchemeHandlerFactory. If you register it like in demo project (i.e. on standard scheme (http or https)) - then this is enough. If you register it on custom scheme (own name) - then you also need register it in renderer processes too by using CefApp.OnRegisterCustomSchemes callback (read doc for more info).

2. Avoid inject CEF in foreign processes, like office. This can cause stability issues or you block loading another CEF-based plugin. The solution is made a out-of-process browser and interact with it via IPC (of course visually it is absolutely same). I'm had experience and prototype for this, but this never has been published (and will not be published as open source in nearest time, but this is code absolutely mine). I'm already discuss about twice or triple times on this forum about. The problem with injecting with office (one of problem) is that you eventually must hook main window which is really hard for outlook (it is possible to have multiple "main" windows, handling loading/unloading), and even without hooks - we hit in issue that main outlook's title on some machines changed to "china" or "japan" glyphs, - i'm never reproduced this itself but had this kind feedback. This is why i'm so did not recommend load CEF library in foreign uncontrolled processes (like word, outlook, visual studio).
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Subprocess won't Process Request

Postby bigN » Wed Dec 21, 2016 4:41 am

Hello fddima,
I really appreciate your prompt reply. I have read all of your posts regarding how to use cef with plugin architecture, but it still not clear how to establish IPC between office and out-of-process loaded browser. As per your suggestion, i am loading the cef browser exe in the taskpane without CefRuntime and reparent it to the taskpane control. This part works fine, however the main question remains, even with this arrangment, how to establish IPC between two process.
bigN
Techie
 
Posts: 10
Joined: Fri Dec 16, 2016 2:58 am

Re: Subprocess won't Process Request

Postby fddima » Wed Dec 21, 2016 5:20 am

You are kidding me? For IPC use named pipes, use any library, use wcf or web api or something else. This question is clearly out of scope here.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Subprocess won't Process Request

Postby bigN » Wed Dec 21, 2016 5:55 am

Somehow your reply made things much clearer. Thank you for pointing to right directon.
bigN
Techie
 
Posts: 10
Joined: Fri Dec 16, 2016 2:58 am

Re: Subprocess won't Process Request

Postby fddima » Wed Dec 21, 2016 6:06 am

bigN wrote:Somehow your reply made things much clearer. Thank you for pointing to right directon.

Our dialogue makes me laugh. :)

Feel free to ask questions.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Subprocess won't Process Request

Postby bigN » Wed Dec 21, 2016 6:28 am

The only excuse for my stupid question is that I misunderstood that two seperate IPC must happen, one for CEF itself and another between two independent processes.
bigN
Techie
 
Posts: 10
Joined: Fri Dec 16, 2016 2:58 am

Re: Subprocess won't Process Request

Postby fddima » Wed Dec 21, 2016 9:15 am

bigN wrote:The only excuse for my stupid question is that I misunderstood that two seperate IPC must happen, one for CEF itself and another between two independent processes.

I'm never count CEF's multi-process architecture and their IPC if it is not needed: additionally CEF's API is easiest and safer way to interact between browser process and child (renderer) process when it needed. At higher level all of this is "browser". Sorry for misunderstanding.

So, just for clarify for followers, in this kind topics i'm say about next process model:
Code: Select all
   +-----------------+          +-------------+          +--------------+
   | (1) OFFICE/WORD |  <---->  | (2) BROWSER |  <-----> | (3) RENDERER |
   +-----------------+          +-------------+          +--------------+


(1) - addin host process (i.e. word, outlook, visual studio, etc)
(2) - "out-of-process" browser, which is driven by addin (i.e. normally started by addin when browser shown first time)
(3) - usual renderer, shown here just for clarify.

So, yes, between (1) and (2) some kind of custom IPC needed. Again, just for clarify: addin (1) never loads CEF or CefGlue (not needed).

Again, i'm repeat that there is have sense only when you doesn't control host process, and it can potentially load multiple addins and each addin can be used with own CEF version.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Subprocess won't Process Request

Postby bigN » Wed Dec 21, 2016 12:07 pm

I think your last reply should be part of cefglue wiki, or any .net cef wrapper. thank you for clarification.
bigN
Techie
 
Posts: 10
Joined: Fri Dec 16, 2016 2:58 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 18 guests