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

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

Issue 2877203002: Don't allow RenderFrames to be created during WebContents destruction. (Closed)
Patch Set: Initial patch Created 3 years, 7 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
« no previous file with comments | « content/browser/frame_host/render_frame_host_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 // The renderer now has a RenderFrame for this RenderFrameHost. Note that 1060 // The renderer now has a RenderFrame for this RenderFrameHost. Note that
1061 // this path is only used for out-of-process iframes. Main frame RenderFrames 1061 // this path is only used for out-of-process iframes. Main frame RenderFrames
1062 // are created with their RenderView, and same-site iframes are created at the 1062 // are created with their RenderView, and same-site iframes are created at the
1063 // time of OnCreateChildFrame. 1063 // time of OnCreateChildFrame.
1064 SetRenderFrameCreated(true); 1064 SetRenderFrameCreated(true);
1065 1065
1066 return true; 1066 return true;
1067 } 1067 }
1068 1068
1069 void RenderFrameHostImpl::SetRenderFrameCreated(bool created) { 1069 void RenderFrameHostImpl::SetRenderFrameCreated(bool created) {
1070 // We should not create new RenderFrames while our delegate is being destroyed
1071 // (e.g., via a WebContentsObserver during WebContents shutdown). This seems
1072 // to have caused crashes in https://crbug.com/717650.
1073 if (created && delegate_)
1074 CHECK(!delegate_->IsBeingDestroyed());
1075
1070 bool was_created = render_frame_created_; 1076 bool was_created = render_frame_created_;
1071 render_frame_created_ = created; 1077 render_frame_created_ = created;
1072 1078
1073 // If the current status is different than the new status, the delegate 1079 // If the current status is different than the new status, the delegate
1074 // needs to be notified. 1080 // needs to be notified.
1075 if (delegate_ && (created != was_created)) { 1081 if (delegate_ && (created != was_created)) {
1076 if (created) { 1082 if (created) {
1077 SetUpMojoIfNeeded(); 1083 SetUpMojoIfNeeded();
1078 delegate_->RenderFrameCreated(this); 1084 delegate_->RenderFrameCreated(this);
1079 } else { 1085 } else {
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after
3913 } 3919 }
3914 3920
3915 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 3921 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3916 const std::string& interface_name, 3922 const std::string& interface_name,
3917 mojo::ScopedMessagePipeHandle pipe) { 3923 mojo::ScopedMessagePipeHandle pipe) {
3918 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 3924 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3919 } 3925 }
3920 #endif 3926 #endif
3921 3927
3922 } // namespace content 3928 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698