refactor: be more precise when creating api::WebContents (#23128)

This commit is contained in:
Jeremy Rose 2021-04-23 13:51:37 -07:00 committed by GitHub
parent 1c57e078aa
commit dc7fa1d9f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 15 deletions

View file

@ -877,17 +877,6 @@ void App::BrowserChildProcessCrashedOrKilled(
void App::RenderProcessReady(content::RenderProcessHost* host) {
ChildProcessLaunched(content::PROCESS_TYPE_RENDERER, host->GetID(),
host->GetProcess().Handle());
// TODO(jeremy): this isn't really the right place to be creating
// `WebContents` instances, but this was implicitly happening before in
// `RenderProcessPreferences`, so this is at least more explicit...
content::WebContents* web_contents =
ElectronBrowserClient::Get()->GetWebContentsFromProcessID(host->GetID());
if (web_contents) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::HandleScope scope(isolate);
WebContents::FromOrCreate(isolate, web_contents);
}
}
void App::RenderProcessExited(content::RenderProcessHost* host) {