| Index: content/browser/renderer_host/browser_render_process_host.cc
|
| diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc
|
| index d422775d001d16a8c16ebd85926d622598de230d..bce63a8d787a2a839f018e9bbcb4f5cdf0b7054e 100644
|
| --- a/content/browser/renderer_host/browser_render_process_host.cc
|
| +++ b/content/browser/renderer_host/browser_render_process_host.cc
|
| @@ -187,6 +187,7 @@ class RendererURLRequestContextSelector
|
| BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile)
|
| : RenderProcessHost(profile),
|
| visible_widgets_(0),
|
| + pending_views_(0),
|
| backgrounded_(true),
|
| ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_(
|
| base::TimeDelta::FromSeconds(5),
|
| @@ -411,9 +412,9 @@ void BrowserRenderProcessHost::CancelResourceRequests(int render_widget_id) {
|
| widget_helper_->CancelResourceRequests(render_widget_id);
|
| }
|
|
|
| -void BrowserRenderProcessHost::CrossSiteClosePageACK(
|
| - const ViewMsg_ClosePage_Params& params) {
|
| - widget_helper_->CrossSiteClosePageACK(params);
|
| +void BrowserRenderProcessHost::CrossSiteSwapOutACK(
|
| + const ViewMsg_SwapOut_Params& params) {
|
| + widget_helper_->CrossSiteSwapOutACK(params);
|
| }
|
|
|
| bool BrowserRenderProcessHost::WaitForUpdateMsg(
|
| @@ -463,6 +464,19 @@ int BrowserRenderProcessHost::VisibleWidgetCount() const {
|
| return visible_widgets_;
|
| }
|
|
|
| +void BrowserRenderProcessHost::AddPendingView() {
|
| + pending_views_++;
|
| +}
|
| +
|
| +void BrowserRenderProcessHost::RemovePendingView() {
|
| + DCHECK(pending_views_);
|
| + pending_views_--;
|
| +}
|
| +
|
| +int BrowserRenderProcessHost::PendingViewCount() const {
|
| + return pending_views_;
|
| +}
|
| +
|
| void BrowserRenderProcessHost::AppendRendererCommandLine(
|
| CommandLine* command_line) const {
|
| // Pass the process type first, so it shows first in process listings.
|
| @@ -777,6 +791,8 @@ bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) {
|
| // Dispatch control messages.
|
| bool msg_is_ok = true;
|
| IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok)
|
| + IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
|
| + OnShutdownRequest)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_UpdatedCacheStats,
|
| OnUpdatedCacheStats)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
|
| @@ -816,6 +832,10 @@ void BrowserRenderProcessHost::OnChannelConnected(int32 peer_pid) {
|
| Send(new ChildProcessMsg_SetIPCLoggingEnabled(
|
| IPC::Logging::GetInstance()->Enabled()));
|
| #endif
|
| +
|
| + // Make sure the child checks with us before exiting, so that we do not try
|
| + // to schedule a new navigation in a swapped out and exiting renderer.
|
| + Send(new ChildProcessMsg_AskBeforeShutdown());
|
| }
|
|
|
| void BrowserRenderProcessHost::OnChannelError() {
|
| @@ -871,6 +891,20 @@ void BrowserRenderProcessHost::OnChannelError() {
|
| // TODO(darin): clean this up
|
| }
|
|
|
| +void BrowserRenderProcessHost::OnShutdownRequest() {
|
| + // Don't shutdown if there are pending RenderViews being swapped back in.
|
| + if (pending_views_)
|
| + return;
|
| +
|
| + // Notify any tabs that might have swapped out renderers from this process
|
| + // on the swapped out list. They should not attempt to swap them back in.
|
| + NotificationService::current()->Notify(
|
| + NotificationType::RENDERER_PROCESS_CLOSING,
|
| + Source<RenderProcessHost>(this), NotificationService::NoDetails());
|
| +
|
| + Send(new ChildProcessMsg_Shutdown());
|
| +}
|
| +
|
| void BrowserRenderProcessHost::OnUpdatedCacheStats(
|
| const WebCache::UsageStats& stats) {
|
| WebCacheManager::GetInstance()->ObserveStats(id(), stats);
|
|
|