Hi, I've been running into some limitations with keeping persistent state in a browser's render process.
My goal is to maintain a list of JavaScript methods to be registered either on-demand (MyApp::AddMethod) or on page-load in CefApp::OnContextCreated.
At the moment (pre-site-isolation), I store a list of these methods in my renderer process so that each call to CefApp::OnContextCreated after the original MyApp::AddMethod will immediately re-add all of the methods to the newly created context. This means the functions are always available to JavaScript when loading a new page.
Now, site-isolation messes with this setup because the browser can end up with a new render-process. This render-process will contain an empty list instead of the list of methods that have been created.
I'm happy to co-operate with the site-isolation model, but I'm struggling to find a way to pass this state into the newly created processes in a synchronous manner. I'm not really interested in an asynchronous solution where the render process will send an IPC message to the browser requesting the list.
CefRenderProcessHandler::OnRenderThreadCreated looks like a perfect solution for this as I could pass my list into extra_info and maintain it in the browser process instead of the render process. Sadly, CefBrowserProcessHandler::OnRenderProcessThreadCreated has no information on which browser the render-process is being created for.
My questions:
Is there some part of the API I have completely overlooked that can solve this?
Can CefBrowserProcessHandler::OnRenderProcessThreadCreated be modified to know which browser the render-process is for?