CEF CefRenderProcessHandler::OnContextCreated not called

匿名 (未验证) 提交于 2019-12-03 01:45:01

问题:

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?

回答1:

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.



回答2:

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.



回答3:

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 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!