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

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

Issue 2932453002: PlzNavigate: Release StreamHandle. (Closed)
Patch Set: Add test. Created 3 years, 6 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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) 876 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
877 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) 877 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
878 #endif 878 #endif
879 #if defined(OS_ANDROID) 879 #if defined(OS_ANDROID)
880 IPC_MESSAGE_HANDLER(FrameHostMsg_NavigationHandledByEmbedder, 880 IPC_MESSAGE_HANDLER(FrameHostMsg_NavigationHandledByEmbedder,
881 OnNavigationHandledByEmbedder) 881 OnNavigationHandledByEmbedder)
882 #endif 882 #endif
883 IPC_MESSAGE_HANDLER(FrameHostMsg_RequestOverlayRoutingToken, 883 IPC_MESSAGE_HANDLER(FrameHostMsg_RequestOverlayRoutingToken,
884 OnRequestOverlayRoutingToken) 884 OnRequestOverlayRoutingToken)
885 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow) 885 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow)
886 IPC_MESSAGE_HANDLER(FrameHostMsg_StreamHandleConsumed,
887 OnStreamHandleConsumed)
886 IPC_END_MESSAGE_MAP() 888 IPC_END_MESSAGE_MAP()
887 889
888 // No further actions here, since we may have been deleted. 890 // No further actions here, since we may have been deleted.
889 return handled; 891 return handled;
890 } 892 }
891 893
892 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( 894 void RenderFrameHostImpl::OnAssociatedInterfaceRequest(
893 const std::string& interface_name, 895 const std::string& interface_name,
894 mojo::ScopedInterfaceEndpointHandle handle) { 896 mojo::ScopedInterfaceEndpointHandle handle) {
895 if (associated_registry_->CanBindRequest(interface_name)) { 897 if (associated_registry_->CanBindRequest(interface_name)) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } 981 }
980 982
981 void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) { 983 void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) {
982 DCHECK_EQ(site_instance_.get(), site_instance); 984 DCHECK_EQ(site_instance_.get(), site_instance);
983 985
984 // The renderer process is gone, so this frame can no longer be loading. 986 // The renderer process is gone, so this frame can no longer be loading.
985 if (navigation_handle_) 987 if (navigation_handle_)
986 navigation_handle_->set_net_error_code(net::ERR_ABORTED); 988 navigation_handle_->set_net_error_code(net::ERR_ABORTED);
987 ResetLoadingState(); 989 ResetLoadingState();
988 990
991 // The renderer process is gone, so the |stream_handle_| will no longer be
992 // used. It can be released.
993 // TODO(clamy): Remove this when we switch to Mojo streams.
994 stream_handle_.reset();
995
989 // Any future UpdateState or UpdateTitle messages from this or a recreated 996 // Any future UpdateState or UpdateTitle messages from this or a recreated
990 // process should be ignored until the next commit. 997 // process should be ignored until the next commit.
991 set_nav_entry_id(0); 998 set_nav_entry_id(0);
992 } 999 }
993 1000
994 void RenderFrameHostImpl::ReportContentSecurityPolicyViolation( 1001 void RenderFrameHostImpl::ReportContentSecurityPolicyViolation(
995 const CSPViolationParams& violation_params) { 1002 const CSPViolationParams& violation_params) {
996 Send(new FrameMsg_ReportContentSecurityPolicyViolation(routing_id_, 1003 Send(new FrameMsg_ReportContentSecurityPolicyViolation(routing_id_,
997 violation_params)); 1004 violation_params));
998 } 1005 }
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
3176 } 3183 }
3177 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, commit_data, 3184 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, commit_data,
3178 common_params, request_params)); 3185 common_params, request_params));
3179 3186
3180 // If a network request was made, update the Previews state. 3187 // If a network request was made, update the Previews state.
3181 if (ShouldMakeNetworkRequestForURL(common_params.url) && 3188 if (ShouldMakeNetworkRequestForURL(common_params.url) &&
3182 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { 3189 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) {
3183 last_navigation_previews_state_ = common_params.previews_state; 3190 last_navigation_previews_state_ = common_params.previews_state;
3184 } 3191 }
3185 3192
3186 // TODO(clamy): Release the stream handle once the renderer has finished 3193 // Released in OnStreamHandleConsumed().
3187 // reading it.
3188 stream_handle_ = std::move(body); 3194 stream_handle_ = std::move(body);
3189 3195
3190 // When navigating to a debug url, no commit is expected from the 3196 // When navigating to a debug url, no commit is expected from the
3191 // RenderFrameHost, nor should the throbber start. The NavigationRequest is 3197 // RenderFrameHost, nor should the throbber start. The NavigationRequest is
3192 // also not stored in the FrameTreeNode. Therefore do not reset it, as this 3198 // also not stored in the FrameTreeNode. Therefore do not reset it, as this
3193 // could cancel an existing pending navigation. 3199 // could cancel an existing pending navigation.
3194 if (!IsRendererDebugURL(common_params.url)) { 3200 if (!IsRendererDebugURL(common_params.url)) {
3195 pending_commit_ = true; 3201 pending_commit_ = true;
3196 is_loading_ = true; 3202 is_loading_ = true;
3197 } 3203 }
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
4045 4051
4046 last_committed_site_url_ = site_url; 4052 last_committed_site_url_ = site_url;
4047 4053
4048 if (!last_committed_site_url_.is_empty()) { 4054 if (!last_committed_site_url_.is_empty()) {
4049 RenderProcessHostImpl::AddFrameWithSite( 4055 RenderProcessHostImpl::AddFrameWithSite(
4050 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), 4056 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
4051 GetProcess(), last_committed_site_url_); 4057 GetProcess(), last_committed_site_url_);
4052 } 4058 }
4053 } 4059 }
4054 4060
4061 void RenderFrameHostImpl::OnStreamHandleConsumed(const GURL& stream_url) {
4062 if (stream_handle_ && stream_handle_->GetURL() == stream_url)
4063 stream_handle_.reset();
4064 }
4065
4055 #if defined(OS_ANDROID) 4066 #if defined(OS_ANDROID)
4056 4067
4057 class RenderFrameHostImpl::JavaInterfaceProvider 4068 class RenderFrameHostImpl::JavaInterfaceProvider
4058 : public service_manager::mojom::InterfaceProvider { 4069 : public service_manager::mojom::InterfaceProvider {
4059 public: 4070 public:
4060 using BindCallback = 4071 using BindCallback =
4061 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; 4072 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>;
4062 4073
4063 JavaInterfaceProvider( 4074 JavaInterfaceProvider(
4064 const BindCallback& bind_callback, 4075 const BindCallback& bind_callback,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 } 4120 }
4110 4121
4111 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 4122 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
4112 const std::string& interface_name, 4123 const std::string& interface_name,
4113 mojo::ScopedMessagePipeHandle pipe) { 4124 mojo::ScopedMessagePipeHandle pipe) {
4114 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 4125 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
4115 } 4126 }
4116 #endif 4127 #endif
4117 4128
4118 } // namespace content 4129 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698