void WebContents::MessageTo(int32_t web_contents_id,
                            const std::string& channel,
                            blink::CloneableMessage arguments) {
  TRACE_EVENT1("electron", "WebContents::MessageTo", "channel", channel);
  auto* target_web_contents = FromID(web_contents_id);

  if (target_web_contents) {
    content::RenderFrameHost* frame = target_web_contents->MainFrame();
    DCHECK(frame);

    v8::HandleScope handle_scope(JavascriptEnvironment::GetIsolate());
    gin::Handle<WebFrameMain> web_frame_main =
        WebFrameMain::From(JavascriptEnvironment::GetIsolate(), frame);

    if (!web_frame_main->CheckRenderFrame())
      return;

    int32_t sender_id = ID();
    web_frame_main->GetRendererApi()->Message(false /* internal */, channel,
                                              std::move(arguments), sender_id);
  }
}
void WebContents::MessageTo(int32_t web_contents_id,
                            const std::string& channel,
                            blink::CloneableMessage arguments) {
  TRACE_EVENT1("electron", "WebContents::MessageTo", "channel", channel);
  auto* target_web_contents = FromID(web_contents_id);

  if (target_web_contents) {
    content::RenderFrameHost* frame = target_web_contents->MainFrame();
    DCHECK(frame);

    v8::HandleScope handle_scope(JavascriptEnvironment::GetIsolate());
    gin::Handle<WebFrameMain> web_frame_main =
        WebFrameMain::From(JavascriptEnvironment::GetIsolate(), frame);

    if (!web_frame_main->CheckRenderFrame())
      return;

    int32_t sender_id = ID();
    web_frame_main->GetRendererApi()->Message(false  , channel,
                                              std::move(arguments), sender_id);
  }
}