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 6da622cc019fdbca2625291b78116c0a985ada03..1e7ffe25b775e891e278b57fd8b64f5f79bd3fff 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.cc |
+++ b/content/browser/frame_host/render_frame_host_impl.cc |
@@ -883,6 +883,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. |
@@ -986,6 +988,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); |
@@ -3183,8 +3190,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 |
@@ -4052,6 +4058,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 |