I've created a class based on cefapp and cefrenderprocesshandler
SimpleRenderer header file
- Code: Select all
class SimpleRenderer : public CefApp, public CefRenderProcessHandler
{
public:
SimpleRenderer();
// CefApp methods:
CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE
{
return this;
}
// CefRenderProcessHandler methods:
void OnWebKitInitialized() OVERRIDE;
void OnContextCreated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context) OVERRIDE;
void OnContextReleased(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context) OVERRIDE;
bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE;
private:
// Handles the renderer side of query routing.
CefRefPtr<CefMessageRouterRendererSide> message_router_;
// Frame and context
CefRefPtr<CefV8Context> _context;
CefRefPtr<CefFrame> _frame;
IMPLEMENT_REFCOUNTING(SimpleRenderer);
DISALLOW_COPY_AND_ASSIGN(SimpleRenderer);
};
and in the entry point function when the process_type is "renderer" i'm assigning my renderer to the app object, and it does not work.
- Code: Select all
const std::string& process_type = command_line->GetSwitchValue("type");
if (process_type == "renderer")
app = new SimpleRenderer;
else
app = new SimpleApp;