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

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

Issue 2932453002: PlzNavigate: Release StreamHandle. (Closed)
Patch Set: Addressed comments (+Rebase) 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 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
3176 } 3178 }
3177 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, commit_data, 3179 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, commit_data,
3178 common_params, request_params)); 3180 common_params, request_params));
3179 3181
3180 // If a network request was made, update the Previews state. 3182 // If a network request was made, update the Previews state.
3181 if (ShouldMakeNetworkRequestForURL(common_params.url) && 3183 if (ShouldMakeNetworkRequestForURL(common_params.url) &&
3182 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { 3184 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) {
3183 last_navigation_previews_state_ = common_params.previews_state; 3185 last_navigation_previews_state_ = common_params.previews_state;
3184 } 3186 }
3185 3187
3186 // TODO(clamy): Release the stream handle once the renderer has finished 3188 // Released in OnStreamHandleConsumed().
nasko 2017/06/12 23:05:04 Shouldn't we also release the stream handle if the
arthursonzogni 2017/06/13 09:21:48 Yes, but I do not know if it's worth knowing that
nasko 2017/06/13 13:51:09 It is just clean code to release the stream handle
3187 // reading it.
3188 stream_handle_ = std::move(body); 3189 stream_handle_ = std::move(body);
3189 3190
3190 // When navigating to a debug url, no commit is expected from the 3191 // When navigating to a debug url, no commit is expected from the
3191 // RenderFrameHost, nor should the throbber start. The NavigationRequest is 3192 // RenderFrameHost, nor should the throbber start. The NavigationRequest is
3192 // also not stored in the FrameTreeNode. Therefore do not reset it, as this 3193 // also not stored in the FrameTreeNode. Therefore do not reset it, as this
3193 // could cancel an existing pending navigation. 3194 // could cancel an existing pending navigation.
3194 if (!IsRendererDebugURL(common_params.url)) { 3195 if (!IsRendererDebugURL(common_params.url)) {
3195 pending_commit_ = true; 3196 pending_commit_ = true;
3196 is_loading_ = true; 3197 is_loading_ = true;
3197 } 3198 }
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
4045 4046
4046 last_committed_site_url_ = site_url; 4047 last_committed_site_url_ = site_url;
4047 4048
4048 if (!last_committed_site_url_.is_empty()) { 4049 if (!last_committed_site_url_.is_empty()) {
4049 RenderProcessHostImpl::AddFrameWithSite( 4050 RenderProcessHostImpl::AddFrameWithSite(
4050 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), 4051 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
4051 GetProcess(), last_committed_site_url_); 4052 GetProcess(), last_committed_site_url_);
4052 } 4053 }
4053 } 4054 }
4054 4055
4056 void RenderFrameHostImpl::OnStreamHandleConsumed(const GURL& stream_url) {
4057 if (stream_handle_ && stream_handle_->GetURL() == stream_url) {
nasko 2017/06/12 23:05:04 nit: No need for {}
arthursonzogni 2017/06/13 09:21:48 Done.
4058 stream_handle_.reset();
4059 }
4060 }
4061
4055 #if defined(OS_ANDROID) 4062 #if defined(OS_ANDROID)
4056 4063
4057 class RenderFrameHostImpl::JavaInterfaceProvider 4064 class RenderFrameHostImpl::JavaInterfaceProvider
4058 : public service_manager::mojom::InterfaceProvider { 4065 : public service_manager::mojom::InterfaceProvider {
4059 public: 4066 public:
4060 using BindCallback = 4067 using BindCallback =
4061 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; 4068 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>;
4062 4069
4063 JavaInterfaceProvider( 4070 JavaInterfaceProvider(
4064 const BindCallback& bind_callback, 4071 const BindCallback& bind_callback,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 } 4116 }
4110 4117
4111 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 4118 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
4112 const std::string& interface_name, 4119 const std::string& interface_name,
4113 mojo::ScopedMessagePipeHandle pipe) { 4120 mojo::ScopedMessagePipeHandle pipe) {
4114 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 4121 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
4115 } 4122 }
4116 #endif 4123 #endif
4117 4124
4118 } // namespace content 4125 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698