void WebContents::PrimaryMainFrameRenderProcessGone(
    base::TerminationStatus status) {
  auto weak_this = GetWeakPtr();
  Emit("crashed", status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);

  // User might destroy WebContents in the crashed event.
  if (!weak_this || !web_contents())
    return;

  v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
  v8::HandleScope handle_scope(isolate);
  gin_helper::Dictionary details = gin_helper::Dictionary::CreateEmpty(isolate);
  details.Set("reason", status);
  details.Set("exitCode", web_contents()->GetCrashedErrorCode());
  Emit("render-process-gone", details);
}
void WebContents::PrimaryMainFrameRenderProcessGone(
    base::TerminationStatus status) {
  auto weak_this = GetWeakPtr();
  Emit("crashed", status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);

   
  if (!weak_this || !web_contents())
    return;

  v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
  v8::HandleScope handle_scope(isolate);
  gin_helper::Dictionary details = gin_helper::Dictionary::CreateEmpty(isolate);
  details.Set("reason", status);
  details.Set("exitCode", web_contents()->GetCrashedErrorCode());
  Emit("render-process-gone", details);
}