Index: content/browser/frame_host/render_frame_host_impl.cc |
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc |
index 96fb5e17297cdd7154e8250f3581aa6e00c03acc..3754bebcc1199260ee1c9cc6f5b904c7936652a3 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.cc |
+++ b/content/browser/frame_host/render_frame_host_impl.cc |
@@ -882,6 +882,8 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { |
IPC_MESSAGE_HANDLER(FrameHostMsg_RequestOverlayRoutingToken, |
OnRequestOverlayRoutingToken) |
IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow) |
+ IPC_MESSAGE_HANDLER(FrameHostMsg_StreamHandleConsumed, |
+ OnStreamHandleConsumed) |
IPC_END_MESSAGE_MAP() |
// No further actions here, since we may have been deleted. |
@@ -985,6 +987,11 @@ void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) { |
navigation_handle_->set_net_error_code(net::ERR_ABORTED); |
ResetLoadingState(); |
+ // The renderer process is gone, so the |stream_handle_| will no longer be |
+ // used. It can be released. |
+ // TODO(clamy): Remove this when we switch to Mojo streams. |
+ stream_handle_.reset(); |
+ |
// Any future UpdateState or UpdateTitle messages from this or a recreated |
// process should be ignored until the next commit. |
set_nav_entry_id(0); |
@@ -3182,8 +3189,7 @@ void RenderFrameHostImpl::CommitNavigation( |
last_navigation_previews_state_ = common_params.previews_state; |
} |
- // TODO(clamy): Release the stream handle once the renderer has finished |
- // reading it. |
+ // Released in OnStreamHandleConsumed(). |
stream_handle_ = std::move(body); |
// When navigating to a debug url, no commit is expected from the |
@@ -4051,6 +4057,11 @@ void RenderFrameHostImpl::SetLastCommittedSiteUrl(const GURL& url) { |
} |
} |
+void RenderFrameHostImpl::OnStreamHandleConsumed(const GURL& stream_url) { |
+ if (stream_handle_ && stream_handle_->GetURL() == stream_url) |
+ stream_handle_.reset(); |
+} |
+ |
#if defined(OS_ANDROID) |
class RenderFrameHostImpl::JavaInterfaceProvider |