blob: c2a85c7e0b2f8971052e969dc00d38c92e59f2c6 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "ipc/ipc_listener.h"
#include "url/gurl.h"
namespace content {
class BrowserContext;
class RenderProcessHost;
class SiteInstance;
namespace chromecast {
// This class pre-launches a renderer process for the SiteInstance of a URL,
// and retains a handle on its RenderProcessHost to keep it alive even when
// there is no WebContents using the renderer process. To release the
// RenderProcessHost, this class must be deleted.
class RendererPrelauncher : private IPC::Listener {
RendererPrelauncher(content::BrowserContext* browser_context,
const GURL& gurl);
~RendererPrelauncher() override;
void Prelaunch();
scoped_refptr<content::SiteInstance> site_instance() {
return site_instance_;
// IPC::Listener implementation:
bool OnMessageReceived(const IPC::Message& message) override;
content::BrowserContext* const browser_context_;
scoped_refptr<content::SiteInstance> site_instance_;
GURL gurl_;
int32_t rph_routing_id_;
} // namespace chromecast