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

Unified Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 2112923002: Fix crash when destroying a RenderWidgetHost that holds the pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: send privileged request through webcontents Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_widget_host_view_child_frame.cc
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index e3a036176bbdbf690e3546a543b0b2c005d3fd63..a461feb1980872eb4d81b74a179d9b82d4c1deb4 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -77,6 +77,12 @@ void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector(
id_allocator_->id_namespace());
parent_surface_id_namespace_ = 0;
+
+ // After the RenderWidgetHostViewChildFrame loses the frame_connector, it
+ // won't be able to walk up the frame tree anymore. Cleanup anything that
+ // needs to be done through the CrossProcessFrameConnector.
Charlie Reis 2016/07/07 21:47:13 nit: s/Cleanup/Clean up/ nit: Add "before it's gon
lfg 2016/07/11 19:11:29 Done.
+ // Unlocks the mouse if this RenderWidgetHostView holds the lock.
+ UnlockMouse();
}
frame_connector_ = frame_connector;
if (frame_connector_) {
@@ -469,19 +475,16 @@ bool RenderWidgetHostViewChildFrame::LockMouse() {
}
void RenderWidgetHostViewChildFrame::UnlockMouse() {
+ if (host_->delegate() && host_->delegate()->HasMouseLock(host_) &&
+ frame_connector_)
+ frame_connector_->UnlockMouse();
}
bool RenderWidgetHostViewChildFrame::IsMouseLocked() {
- if (!frame_connector_)
+ if (!host_->delegate())
return false;
- RenderWidgetHostViewBase* root_view =
- frame_connector_->GetRootRenderWidgetHostView();
-
- if (root_view)
- return root_view->IsMouseLocked();
-
- return false;
+ return host_->delegate()->HasMouseLock(host_);
}
uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() {

Powered by Google App Engine
This is Rietveld 408576698