-
Lukasz Anforowicz authored
This CL is desirable today, to avoid the memory leaks associated with queueing of IPCs that are sent to RenderProcessHosts that are constructed, but not yet initialized - such RenderProcessHosts accumulate IPC messages and flush them only after renderer process is actually launched at a later point / after a call to RPH::Init. This aspect of the CL is very similar to r562797 which landed earlier. This CL is desirable for the future - a tentative long-term plan for https://crbug.com/813045 is to avoid creating an IPC channel before RPH::Init is called. This means that in the long-term RPH::GetChildIdentity will crash (dereferencing a nullptr |RenderProcessHostImpl::child_connection_|) if called on an uninitialized RPH. This CL ensures that this crash won't happen in ClientSideDetectionService::SendModelToProcess and SpellcheckService::OnCustomDictionaryChanged by ensuring that these methods only work with already initialized RPHs. The changes under //chrome/browser/spellchecker and //chrome/browser/safe_browsing skip uninitialized RPHs for 2 specific IPCs/subsystems. The changes under //content/browser/renderer_host prevent future IPCs/subsystems from using uninitialized RPHs, by adding a DCHECK to RenderProcessHostImpl::GetChildIdentity. The new DCHECK necessitates setting |is_initialized_ = true| much earlier in RenderProcessHostImpl::Init (because ChromeContentBrowserClient::RenderProcessWillLaunch needs to call RPH::GetChildIdentity). Bug: 813045 Change-Id: I4783de85cb7c199ab360f8361acd54c63287e1df Reviewed-on: https://chromium-review.googlesource.com/1095433Reviewed-by:
Alex Moshchuk <alexmos@chromium.org> Reviewed-by:
Jialiu Lin <jialiul@chromium.org> Reviewed-by:
Rachel Blum <groby@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/master@{#567099}
a5e57e71