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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 950223006: Fix RenderFrameHostChanged WebContentsObserver methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove leftover log and empty lines Created 5 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 rwh_delegate, GetProcess(), MSG_ROUTING_NONE, hidden)); 177 rwh_delegate, GetProcess(), MSG_ROUTING_NONE, hidden));
178 render_widget_host_->set_owned_by_render_frame_host(true); 178 render_widget_host_->set_owned_by_render_frame_host(true);
179 } 179 }
180 } 180 }
181 181
182 RenderFrameHostImpl::~RenderFrameHostImpl() { 182 RenderFrameHostImpl::~RenderFrameHostImpl() {
183 GetProcess()->RemoveRoute(routing_id_); 183 GetProcess()->RemoveRoute(routing_id_);
184 g_routing_id_frame_map.Get().erase( 184 g_routing_id_frame_map.Get().erase(
185 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); 185 RenderFrameHostID(GetProcess()->GetID(), routing_id_));
186 186
187 // Notify the FrameTree that this RFH is going away, allowing it to shut down
188 // the corresponding RenderViewHost if it is no longer needed.
189 frame_tree_->UnregisterRenderFrameHost(this);
Charlie Reis 2015/03/02 18:38:25 Moving this makes me nervous about UaFs. Are we s
nasko 2015/03/02 19:30:53 I don't know if observers will need to access Rend
Charlie Reis 2015/03/02 22:44:30 Yes, that's my concern, though. I just looked mor
Charlie Reis 2015/03/02 22:58:49 Oops, this didn't come up in the patch diffs, so I
190
187 if (delegate_ && render_frame_created_) 191 if (delegate_ && render_frame_created_)
188 delegate_->RenderFrameDeleted(this); 192 delegate_->RenderFrameDeleted(this);
189 193
190 FrameAccessibility::GetInstance()->OnRenderFrameHostDestroyed(this); 194 FrameAccessibility::GetInstance()->OnRenderFrameHostDestroyed(this);
191 195
192 // If this was swapped out, it already decremented the active frame count of 196 // If this was swapped out, it already decremented the active frame count of
193 // the SiteInstance it belongs to. 197 // the SiteInstance it belongs to.
194 if (IsRFHStateActive(rfh_state_)) 198 if (IsRFHStateActive(rfh_state_))
195 GetSiteInstance()->decrement_active_frame_count(); 199 GetSiteInstance()->decrement_active_frame_count();
196 200
197 // Notify the FrameTree that this RFH is going away, allowing it to shut down
198 // the corresponding RenderViewHost if it is no longer needed.
199 frame_tree_->UnregisterRenderFrameHost(this);
200
201 // NULL out the swapout timer; in crash dumps this member will be null only if 201 // NULL out the swapout timer; in crash dumps this member will be null only if
202 // the dtor has run. 202 // the dtor has run.
203 swapout_event_monitor_timeout_.reset(); 203 swapout_event_monitor_timeout_.reset();
204 204
205 for (const auto& iter: visual_state_callbacks_) { 205 for (const auto& iter: visual_state_callbacks_) {
206 iter.second.Run(false); 206 iter.second.Run(false);
207 } 207 }
208 208
209 if (render_widget_host_) 209 if (render_widget_host_)
210 render_widget_host_->Cleanup(); 210 render_widget_host_->Cleanup();
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1910 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1911 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1911 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1912 GetContentClient()->browser()->RegisterPermissionUsage( 1912 GetContentClient()->browser()->RegisterPermissionUsage(
1913 PERMISSION_GEOLOCATION, 1913 PERMISSION_GEOLOCATION,
1914 delegate_->GetAsWebContents(), 1914 delegate_->GetAsWebContents(),
1915 GetLastCommittedURL().GetOrigin(), 1915 GetLastCommittedURL().GetOrigin(),
1916 top_frame->GetLastCommittedURL().GetOrigin()); 1916 top_frame->GetLastCommittedURL().GetOrigin());
1917 } 1917 }
1918 1918
1919 } // namespace content 1919 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698