Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1457203002: Make WebContentsImpl aware of all of its RWHs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 273f864216521154bca581126385875967bd4a02..f7680208b9515085ffdd18026a232a2d8b6d26e2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1497,17 +1497,20 @@ void WebContentsImpl::LostCapture(RenderWidgetHostImpl* render_widget_host) {
delegate_->LostCapture();
}
+void WebContentsImpl::RenderWidgetCreated(
+ RenderWidgetHostImpl* render_widget_host) {
+ created_widgets_.insert(render_widget_host);
+}
+
void WebContentsImpl::RenderWidgetDeleted(
RenderWidgetHostImpl* render_widget_host) {
- if (is_being_destroyed_) {
- // |created_widgets_| might have been destroyed.
- return;
- }
+ // Note that |is_being_destroyed_| can be true at this point as
+ // ~WebContentsImpl() calls RFHM::ClearRFHsPendingShutdown(), which might lead
+ // us here.
+ created_widgets_.erase(render_widget_host);
- std::set<RenderWidgetHostImpl*>::iterator iter =
- created_widgets_.find(render_widget_host);
- if (iter != created_widgets_.end())
- created_widgets_.erase(iter);
+ if (is_being_destroyed_)
+ return;
if (render_widget_host &&
render_widget_host->GetRoutingID() == fullscreen_widget_routing_id_) {
@@ -1923,7 +1926,6 @@ void WebContentsImpl::CreateNewWidget(int32 render_process_id,
RenderWidgetHostImpl* widget_host =
new RenderWidgetHostImpl(this, process, route_id, IsHidden());
- created_widgets_.insert(widget_host);
RenderWidgetHostViewBase* widget_view =
static_cast<RenderWidgetHostViewBase*>(
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698