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

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

Issue 2932453002: PlzNavigate: Release StreamHandle. (Closed)
Patch Set: Experiment: Use a RenderFrameObserver. 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().
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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
4046 4047
4047 last_committed_site_url_ = site_url; 4048 last_committed_site_url_ = site_url;
4048 4049
4049 if (!last_committed_site_url_.is_empty()) { 4050 if (!last_committed_site_url_.is_empty()) {
4050 RenderProcessHostImpl::AddFrameWithSite( 4051 RenderProcessHostImpl::AddFrameWithSite(
4051 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), 4052 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
4052 GetProcess(), last_committed_site_url_); 4053 GetProcess(), last_committed_site_url_);
4053 } 4054 }
4054 } 4055 }
4055 4056
4057 void RenderFrameHostImpl::OnStreamHandleConsumed(const GURL& stream_url) {
4058 if (stream_handle_ && stream_handle_->GetURL() == stream_url) {
4059 stream_handle_.reset();
4060 }
4061 }
4062
4056 #if defined(OS_ANDROID) 4063 #if defined(OS_ANDROID)
4057 4064
4058 class RenderFrameHostImpl::JavaInterfaceProvider 4065 class RenderFrameHostImpl::JavaInterfaceProvider
4059 : public service_manager::mojom::InterfaceProvider { 4066 : public service_manager::mojom::InterfaceProvider {
4060 public: 4067 public:
4061 using BindCallback = 4068 using BindCallback =
4062 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; 4069 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>;
4063 4070
4064 JavaInterfaceProvider( 4071 JavaInterfaceProvider(
4065 const BindCallback& bind_callback, 4072 const BindCallback& bind_callback,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4110 } 4117 }
4111 4118
4112 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 4119 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
4113 const std::string& interface_name, 4120 const std::string& interface_name,
4114 mojo::ScopedMessagePipeHandle pipe) { 4121 mojo::ScopedMessagePipeHandle pipe) {
4115 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 4122 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
4116 } 4123 }
4117 #endif 4124 #endif
4118 4125
4119 } // namespace content 4126 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698