user3117740
user3117740

Reputation: 65

CEF CefRenderProcessHandler::OnContextCreated not called

Who tried add native function to javascript in CEF? It was not work, simple to reappear:

  1. download the CEF3 binary package (1750)
  2. open cefclient2010.sln
  3. open client_app.cpp which in cefclient project
  4. goto line 110, set a breakpoint
  5. F5
  6. input any url, any try, the breakpoint never breaked

Am I missed some steps? or some settings?

Upvotes: 1

Views: 5430

Answers (3)

Johnnie.W
Johnnie.W

Reputation: 51

i had the same problem you must add CefRenderProcessHandler interface in SimpleApp ,then the most important is you must implement CefApp::GetRenderProcessHandler() method. just like this:

virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() {
      return this;
  }

by default, the base class return NULL,so OnContextCreated() will not call.

Upvotes: 5

Anil8753
Anil8753

Reputation: 2735

By default sample CEF application is multi-process. Either attach CEF render process to the debugger or simply do following (force the CEF app run into single process mode):

  CefSettings settings;

#ifdef _DEBUG
  settings.single_process = true;
#endif

Upvotes: 1

Itai Bar-Haim
Itai Bar-Haim

Reputation: 1674

Perhaps it has something to do with the process model? How can you tell if the function is getting called? If by using a debugger, make sure you attached all child-processes too.

Upvotes: 2

Related Questions