[SOLVED] OSX OnWebKitInitialized without single_process

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

[SOLVED] OSX OnWebKitInitialized without single_process

Postby CraigZ » Wed Mar 08, 2017 5:20 am

Hi there,

I am modifying the cefsimple application on OSX and adding callback to c++ from javascript. I am having trouble getting OnWebKitInitialized called without setting CefSettings single_process to true. I am using CEF 3.2924.1570. Has anyone else come across this problem? I can get the application to work as expected (I have the same code working on windows) but single_process doesn't appear to be recomended. I get an error message [0308/100732.335291:ERROR:proxy_service_factory.cc(130)] Cannot use V8 Proxy resolver in single process mode.

Any information about this is gratefully received
CraigZ


I am implementing the GetRenderProcesshandler in SimpleApp and overrriding the

Code: Select all
class SimpleApp : public CefApp,
                  public CefRenderProcessHandler,
                  public CefBrowserProcessHandler {
 public:
  SimpleApp();

  // CefApp methods:
  virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() OVERRIDE
  {
     return this;
  }

  virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE
  {
    return this;
  }
 // CefBrowserProcessHandler methods:
  virtual void OnContextInitialized() OVERRIDE;
  //CefRenderProcessHandler methods
  virtual void OnWebKitInitialized() OVERRIDE;




and implementing OnWebKitInitialized in the App

Code: Select all
void SimpleApp::OnWebKitInitialized()
{
   
    std::string app_code = R"(
    var mycode;
    if (!mycode)
    {
        mycode = {};
    }
    (function()
     {
         mycode.myfunc = function(action, callBack, parameters)
         {
             native function myfunc();
             return myfunc(action, callBack, parameters);
         };
     })();;
    )";
   
   
   
    CefRegisterExtension("v8/mycode", app_code.c_str(), new ClientV8ExtensionHandler(this));
}
Last edited by CraigZ on Mon Mar 20, 2017 5:07 am, edited 1 time in total.
CraigZ
Newbie
 
Posts: 5
Joined: Fri Dec 23, 2016 4:44 am

Re: OSX OnWebKitInitialized not called without single_proces

Postby magreenblatt » Wed Mar 08, 2017 12:08 pm

Are you passing a SimpleApp instance to CefExecuteProcess?
magreenblatt
Site Admin
 
Posts: 12402
Joined: Fri May 29, 2009 6:57 pm

Re: OSX OnWebKitInitialized not called without single_proces

Postby CraigZ » Mon Mar 13, 2017 10:59 am

Hi Matt,

I have added an CefExecuteProcess call and pass the simpleApp.get() into it, but only get called back on the ClientApp::GetRenderProcessHandler if I set the CefSettings::single_process flag to true;

I will upgrade the application to use the latest version of cef and test again.

Many thanks for your help
CraigZ
CraigZ
Newbie
 
Posts: 5
Joined: Fri Dec 23, 2016 4:44 am

Re: OSX OnWebKitInitialized not called without single_proces

Postby magreenblatt » Mon Mar 13, 2017 11:54 am

The OnWebKitInitialized method is called in a separate process, so if you're expecting to hit a breakpoint make sure you're actually attached to the renderer process first.
magreenblatt
Site Admin
 
Posts: 12402
Joined: Fri May 29, 2009 6:57 pm

Re: OSX OnWebKitInitialized not called without single_proces

Postby CraigZ » Fri Mar 17, 2017 4:01 am

Sorted - Many thanks for your help. It was that Null was being passed to the ExecuteProcess in my Helper app - Dooh Simple mistake = lots of head scratching :oops:

Ta
CraigZ
CraigZ
Newbie
 
Posts: 5
Joined: Fri Dec 23, 2016 4:44 am


Return to Support Forum

Who is online

Users browsing this forum: clown and 39 guests