void RenderFrameParent::BuildViewMap() { ViewMap newContentViews; // BuildViewMap assumes we have a primary frame, which may not be the case. if (GetRootLayer() && mFrameLoader->GetPrimaryFrameOfOwningContent()) { // Some of the content views in our hash map may no longer be active. To // tag them as inactive and to remove any chance of them using a dangling // pointer, we set mContentView to NULL. // // BuildViewMap will restore mFrameLoader if the content view is still // in our hash table. for (ViewMap::const_iterator iter = mContentViews.begin(); iter != mContentViews.end(); ++iter) { iter->second->mFrameLoader = NULL; } mozilla::layout::BuildViewMap(mContentViews, newContentViews, mFrameLoader, GetRootLayer()); } // Here, we guarantee that *only* the root view is preserved in // case we couldn't build a new view map above. This is important because // the content view map should only contain the root view and content // views that are present in the layer tree. if (newContentViews.empty()) { newContentViews[FrameMetrics::ROOT_SCROLL_ID] = FindViewForId(mContentViews, FrameMetrics::ROOT_SCROLL_ID); } mContentViews = newContentViews; }