| Index: content/browser/tab_contents/render_view_host_manager.cc
|
| diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc
|
| index 62399d3d9b399d4d9f7e0a9d993421c152180b9e..29faba0a420c534f0b9f9f486b39f8b36f878987 100644
|
| --- a/content/browser/tab_contents/render_view_host_manager.cc
|
| +++ b/content/browser/tab_contents/render_view_host_manager.cc
|
| @@ -51,7 +51,7 @@ RenderViewHostManager::~RenderViewHostManager() {
|
| CancelPending();
|
|
|
| // We should always have a main RenderViewHost.
|
| - RenderViewHost* render_view_host = render_view_host_;
|
| + RenderViewHostImpl* render_view_host = render_view_host_;
|
| render_view_host_ = NULL;
|
| render_view_host->Shutdown();
|
|
|
| @@ -71,25 +71,35 @@ void RenderViewHostManager::Init(content::BrowserContext* browser_context,
|
| // ref counted.
|
| if (!site_instance)
|
| site_instance = SiteInstance::Create(browser_context);
|
| - render_view_host_ = RenderViewHostFactory::Create(
|
| - site_instance, render_view_delegate_, routing_id, delegate_->
|
| - GetControllerForRenderManager().GetSessionStorageNamespace());
|
| + render_view_host_ = static_cast<RenderViewHostImpl*>(
|
| + RenderViewHostFactory::Create(
|
| + site_instance, render_view_delegate_, routing_id, delegate_->
|
| + GetControllerForRenderManager().GetSessionStorageNamespace()));
|
|
|
| // Keep track of renderer processes as they start to shut down.
|
| registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSING,
|
| content::NotificationService::AllSources());
|
| }
|
|
|
| +RenderViewHostImpl* RenderViewHostManager::current_host() const {
|
| + return render_view_host_;
|
| +}
|
| +
|
| +RenderViewHostImpl* RenderViewHostManager::pending_render_view_host() const {
|
| + return pending_render_view_host_;
|
| +}
|
| +
|
| RenderWidgetHostView* RenderViewHostManager::GetRenderWidgetHostView() const {
|
| if (!render_view_host_)
|
| return NULL;
|
| - return render_view_host_->view();
|
| + return render_view_host_->GetView();
|
| }
|
|
|
| -RenderViewHost* RenderViewHostManager::Navigate(
|
| +RenderViewHostImpl* RenderViewHostManager::Navigate(
|
| const NavigationEntryImpl& entry) {
|
| // Create a pending RenderViewHost. It will give us the one we should use
|
| - RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry);
|
| + RenderViewHostImpl* dest_render_view_host =
|
| + static_cast<RenderViewHostImpl*>(UpdateRendererStateForNavigate(entry));
|
| if (!dest_render_view_host)
|
| return NULL; // We weren't able to create a pending render view host.
|
|
|
| @@ -113,8 +123,8 @@ RenderViewHost* RenderViewHostManager::Navigate(
|
| // our primary one. Otherwise, we might crash if we try to call Show()
|
| // on it later.
|
| if (dest_render_view_host != render_view_host_ &&
|
| - dest_render_view_host->view()) {
|
| - dest_render_view_host->view()->Hide();
|
| + dest_render_view_host->GetView()) {
|
| + dest_render_view_host->GetView()->Hide();
|
| } else {
|
| // This is our primary renderer, notify here as we won't be calling
|
| // CommitPending (which does the notify).
|
| @@ -140,7 +150,7 @@ void RenderViewHostManager::Stop() {
|
| // will lead to a DidFailProvisionalLoad, which will properly destroy them.
|
| if (cross_navigation_pending_) {
|
| pending_render_view_host_->Send(
|
| - new ViewMsg_Stop(pending_render_view_host_->routing_id()));
|
| + new ViewMsg_Stop(pending_render_view_host_->GetRoutingID()));
|
| }
|
| }
|
|
|
| @@ -176,9 +186,9 @@ bool RenderViewHostManager::ShouldCloseTabOnUnresponsiveRenderer() {
|
| // CrossSiteResourceHandler will already be cleaned up.)
|
| ViewMsg_SwapOut_Params params;
|
| params.new_render_process_host_id =
|
| - pending_render_view_host_->process()->GetID();
|
| + pending_render_view_host_->GetProcess()->GetID();
|
| params.new_request_id = pending_request_id;
|
| - current_host()->process()->CrossSiteSwapOutACK(params);
|
| + current_host()->GetProcess()->CrossSiteSwapOutACK(params);
|
| }
|
| return false;
|
| }
|
| @@ -203,8 +213,8 @@ void RenderViewHostManager::DidNavigateMainFrame(
|
| // then we still need to swap out the old RVH first and run its unload
|
| // handler. OK for that to happen in the background.
|
| if (pending_render_view_host_->GetPendingRequestId() == -1) {
|
| - OnCrossSiteResponse(pending_render_view_host_->process()->GetID(),
|
| - pending_render_view_host_->routing_id());
|
| + OnCrossSiteResponse(pending_render_view_host_->GetProcess()->GetID(),
|
| + pending_render_view_host_->GetRoutingID());
|
| }
|
|
|
| CommitPending();
|
| @@ -248,7 +258,7 @@ void RenderViewHostManager::RendererProcessClosing(
|
| for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin();
|
| iter != swapped_out_hosts_.end();
|
| ++iter) {
|
| - if (iter->second->process() == render_process_host)
|
| + if (iter->second->GetProcess() == render_process_host)
|
| ids_to_remove.push_back(iter->first);
|
| }
|
|
|
| @@ -349,7 +359,7 @@ bool RenderViewHostManager::ShouldSwapProcessesForNavigation(
|
| // page and one isn't. If there's no cur_entry, check the current RVH's
|
| // site, which might already be committed to a Web UI URL (such as the NTP).
|
| const GURL& current_url = (cur_entry) ? cur_entry->GetURL() :
|
| - render_view_host_->site_instance()->GetSite();
|
| + render_view_host_->GetSiteInstance()->GetSite();
|
| content::BrowserContext* browser_context =
|
| delegate_->GetControllerForRenderManager().GetBrowserContext();
|
| const WebUIControllerFactory* web_ui_factory =
|
| @@ -525,22 +535,23 @@ bool RenderViewHostManager::CreatePendingRenderView(
|
| pending_render_view_host_ = iter->second;
|
|
|
| // Prevent the process from exiting while we're trying to use it.
|
| - pending_render_view_host_->process()->AddPendingView();
|
| + pending_render_view_host_->GetProcess()->AddPendingView();
|
|
|
| return true;
|
| }
|
|
|
| - pending_render_view_host_ = RenderViewHostFactory::Create(
|
| - instance, render_view_delegate_, MSG_ROUTING_NONE, delegate_->
|
| - GetControllerForRenderManager().GetSessionStorageNamespace());
|
| + pending_render_view_host_ = static_cast<RenderViewHostImpl*>(
|
| + RenderViewHostFactory::Create(
|
| + instance, render_view_delegate_, MSG_ROUTING_NONE, delegate_->
|
| + GetControllerForRenderManager().GetSessionStorageNamespace()));
|
|
|
| // Prevent the process from exiting while we're trying to use it.
|
| - pending_render_view_host_->process()->AddPendingView();
|
| + pending_render_view_host_->GetProcess()->AddPendingView();
|
|
|
| bool success = InitRenderView(pending_render_view_host_, entry);
|
| if (success) {
|
| // Don't show the view until we get a DidNavigate from it.
|
| - pending_render_view_host_->view()->Hide();
|
| + pending_render_view_host_->GetView()->Hide();
|
| } else {
|
| CancelPending();
|
| }
|
| @@ -582,27 +593,27 @@ void RenderViewHostManager::CommitPending() {
|
| // Remember if the page was focused so we can focus the new renderer in
|
| // that case.
|
| bool focus_render_view = !will_focus_location_bar &&
|
| - render_view_host_->view() && render_view_host_->view()->HasFocus();
|
| + render_view_host_->GetView() && render_view_host_->GetView()->HasFocus();
|
|
|
| // Swap in the pending view and make it active.
|
| - RenderViewHost* old_render_view_host = render_view_host_;
|
| + RenderViewHostImpl* old_render_view_host = render_view_host_;
|
| render_view_host_ = pending_render_view_host_;
|
| pending_render_view_host_ = NULL;
|
|
|
| // The process will no longer try to exit, so we can decrement the count.
|
| - render_view_host_->process()->RemovePendingView();
|
| + render_view_host_->GetProcess()->RemovePendingView();
|
|
|
| // If the view is gone, then this RenderViewHost died while it was hidden.
|
| // We ignored the RenderViewGone call at the time, so we should send it now
|
| // to make sure the sad tab shows up, etc.
|
| - if (render_view_host_->view())
|
| - render_view_host_->view()->Show();
|
| + if (render_view_host_->GetView())
|
| + render_view_host_->GetView()->Show();
|
| else
|
| delegate_->RenderViewGoneFromRenderManager(render_view_host_);
|
|
|
| // Hide the old view now that the new one is visible.
|
| - if (old_render_view_host->view()) {
|
| - old_render_view_host->view()->Hide();
|
| + if (old_render_view_host->GetView()) {
|
| + old_render_view_host->GetView()->Hide();
|
| old_render_view_host->WasSwappedOut();
|
| }
|
|
|
| @@ -611,8 +622,8 @@ void RenderViewHostManager::CommitPending() {
|
|
|
| if (will_focus_location_bar)
|
| delegate_->SetFocusToLocationBar(false);
|
| - else if (focus_render_view && render_view_host_->view())
|
| - RenderWidgetHostViewPort::FromRWHV(render_view_host_->view())->Focus();
|
| + else if (focus_render_view && render_view_host_->GetView())
|
| + RenderWidgetHostViewPort::FromRWHV(render_view_host_->GetView())->Focus();
|
|
|
| std::pair<RenderViewHost*, RenderViewHost*> details =
|
| std::make_pair(old_render_view_host, render_view_host_);
|
| @@ -623,7 +634,7 @@ void RenderViewHostManager::CommitPending() {
|
| content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(&details));
|
|
|
| // If the pending view was on the swapped out list, we can remove it.
|
| - swapped_out_hosts_.erase(render_view_host_->site_instance()->GetId());
|
| + swapped_out_hosts_.erase(render_view_host_->GetSiteInstance()->GetId());
|
|
|
| // If the old RVH is live, we are swapping it out and should keep track of it
|
| // in case we navigate back to it.
|
| @@ -633,7 +644,8 @@ void RenderViewHostManager::CommitPending() {
|
| // sure we don't get different rvh instances for the same site instance
|
| // in the same rvhmgr.
|
| // TODO(creis): Clean this up.
|
| - int32 old_site_instance_id = old_render_view_host->site_instance()->GetId();
|
| + int32 old_site_instance_id =
|
| + old_render_view_host->GetSiteInstance()->GetId();
|
| RenderViewHostMap::iterator iter =
|
| swapped_out_hosts_.find(old_site_instance_id);
|
| if (iter != swapped_out_hosts_.end() &&
|
| @@ -651,7 +663,7 @@ void RenderViewHostManager::CommitPending() {
|
| delegate_->NotifySwappedFromRenderManager();
|
| }
|
|
|
| -RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate(
|
| +RenderViewHostImpl* RenderViewHostManager::UpdateRendererStateForNavigate(
|
| const NavigationEntryImpl& entry) {
|
| // If we are cross-navigating, then we want to get back to normal and navigate
|
| // as usual.
|
| @@ -671,7 +683,7 @@ RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate(
|
|
|
| // render_view_host_ will not be deleted before the end of this method, so we
|
| // don't have to worry about this SiteInstance's ref count dropping to zero.
|
| - SiteInstance* curr_instance = render_view_host_->site_instance();
|
| + SiteInstance* curr_instance = render_view_host_->GetSiteInstance();
|
|
|
| // Determine if we need a new SiteInstance for this entry.
|
| // Again, new_instance won't be deleted before the end of this method, so it
|
| @@ -709,7 +721,8 @@ RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate(
|
| // Otherwise, it's safe to treat this as a pending cross-site transition.
|
|
|
| // Make sure the old render view stops, in case a load is in progress.
|
| - render_view_host_->Send(new ViewMsg_Stop(render_view_host_->routing_id()));
|
| + render_view_host_->Send(
|
| + new ViewMsg_Stop(render_view_host_->GetRoutingID()));
|
|
|
| // Suspend the new render view (i.e., don't let it send the cross-site
|
| // Navigate message) until we hear back from the old renderer's
|
| @@ -741,7 +754,7 @@ RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate(
|
| // happen. We must overwrite to recover the mode.
|
| if (entry.IsViewSourceMode()) {
|
| render_view_host_->Send(
|
| - new ViewMsg_EnableViewSourceMode(render_view_host_->routing_id()));
|
| + new ViewMsg_EnableViewSourceMode(render_view_host_->GetRoutingID()));
|
| }
|
| }
|
|
|
| @@ -752,7 +765,7 @@ RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate(
|
| }
|
|
|
| void RenderViewHostManager::CancelPending() {
|
| - RenderViewHost* pending_render_view_host = pending_render_view_host_;
|
| + RenderViewHostImpl* pending_render_view_host = pending_render_view_host_;
|
| pending_render_view_host_ = NULL;
|
|
|
| content::DevToolsManagerImpl::GetInstance()->OnCancelPendingNavigation(
|
| @@ -760,7 +773,7 @@ void RenderViewHostManager::CancelPending() {
|
| render_view_host_);
|
|
|
| // We no longer need to prevent the process from exiting.
|
| - pending_render_view_host->process()->RemovePendingView();
|
| + pending_render_view_host->GetProcess()->RemovePendingView();
|
|
|
| // The pending RVH may already be on the swapped out list if we started to
|
| // swap it back in and then canceled. If so, make sure it gets swapped out
|
| @@ -810,9 +823,9 @@ void RenderViewHostManager::RenderViewDeleted(RenderViewHost* rvh) {
|
| }
|
|
|
| bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) {
|
| - if (!rvh->site_instance())
|
| + if (!rvh->GetSiteInstance())
|
| return false;
|
|
|
| - return swapped_out_hosts_.find(rvh->site_instance()->GetId()) !=
|
| + return swapped_out_hosts_.find(rvh->GetSiteInstance()->GetId()) !=
|
| swapped_out_hosts_.end();
|
| }
|
|
|