| 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 29517e02b3c4f00d3d6e0371e8441f5dd647dd54..59ee3ca584bd5c270b35f2fb03b86cbdaf9089fe 100644
|
| --- a/content/browser/frame_host/render_frame_host_impl.cc
|
| +++ b/content/browser/frame_host/render_frame_host_impl.cc
|
| @@ -251,6 +251,50 @@ void IgnoreInterfaceRequest(mojo::InterfaceRequest<Interface> request) {
|
| // Intentionally ignore the interface request.
|
| }
|
|
|
| +// The following functions simplify code paths where the UI thread notifies the
|
| +// ResourceDispatcherHostImpl of information pertaining to loading behavior of
|
| +// frame hosts.
|
| +void NotifyRouteChangesOnIO(
|
| + base::Callback<void(ResourceDispatcherHostImpl*,
|
| + const GlobalFrameRoutingId&)> frame_callback,
|
| + std::unique_ptr<std::set<GlobalFrameRoutingId>> routing_ids) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
|
| + if (!rdh)
|
| + return;
|
| + for (const auto& routing_id : *routing_ids)
|
| + frame_callback.Run(rdh, routing_id);
|
| +}
|
| +
|
| +void NotifyForEachFrameFromUI(
|
| + RenderFrameHost* root_frame_host,
|
| + base::Callback<void(ResourceDispatcherHostImpl*,
|
| + const GlobalFrameRoutingId&)> frame_callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| +
|
| + FrameTree* frame_tree = static_cast<RenderFrameHostImpl*>(root_frame_host)
|
| + ->frame_tree_node()
|
| + ->frame_tree();
|
| + DCHECK_EQ(root_frame_host, frame_tree->GetMainFrame());
|
| +
|
| + std::unique_ptr<std::set<GlobalFrameRoutingId>> routing_ids(
|
| + new std::set<GlobalFrameRoutingId>());
|
| + for (FrameTreeNode* node : frame_tree->Nodes()) {
|
| + RenderFrameHostImpl* frame_host = node->current_frame_host();
|
| + RenderFrameHostImpl* pending_frame_host =
|
| + IsBrowserSideNavigationEnabled()
|
| + ? node->render_manager()->speculative_frame_host()
|
| + : node->render_manager()->pending_frame_host();
|
| + if (frame_host)
|
| + routing_ids->insert(frame_host->GetGlobalFrameRoutingId());
|
| + if (pending_frame_host)
|
| + routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId());
|
| + }
|
| + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
|
| + base::Bind(&NotifyRouteChangesOnIO, frame_callback,
|
| + base::Passed(std::move(routing_ids))));
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -310,6 +354,31 @@ RenderFrameHostImpl* RenderFrameHostImpl::FromAXTreeID(
|
| return RenderFrameHostImpl::FromID(frame_id.first, frame_id.second);
|
| }
|
|
|
| +// static
|
| +void RenderFrameHost::BlockRequestsForFrame(RenderFrameHost* root_frame_host) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| + NotifyForEachFrameFromUI(
|
| + root_frame_host,
|
| + base::Bind(&ResourceDispatcherHostImpl::BlockRequestsForRoute));
|
| +}
|
| +
|
| +// static
|
| +void RenderFrameHost::ResumeBlockedRequestsForFrame(
|
| + RenderFrameHost* root_frame_host) {
|
| + NotifyForEachFrameFromUI(
|
| + root_frame_host,
|
| + base::Bind(&ResourceDispatcherHostImpl::ResumeBlockedRequestsForRoute));
|
| +}
|
| +
|
| +// static
|
| +void RenderFrameHost::CancelBlockedRequestsForFrame(
|
| + RenderFrameHost* root_frame_host) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| + NotifyForEachFrameFromUI(
|
| + root_frame_host,
|
| + base::Bind(&ResourceDispatcherHostImpl::CancelBlockedRequestsForRoute));
|
| +}
|
| +
|
| RenderFrameHostImpl::RenderFrameHostImpl(SiteInstance* site_instance,
|
| RenderViewHostImpl* render_view_host,
|
| RenderFrameHostDelegate* delegate,
|
| @@ -967,7 +1036,7 @@ void RenderFrameHostImpl::SetRenderFrameCreated(bool created) {
|
| }
|
|
|
| void RenderFrameHostImpl::Init() {
|
| - ResourceDispatcherHost::ResumeBlockedRequestsForFrameFromUI(this);
|
| + ResumeBlockedRequestsForFrame(this);
|
| if (!waiting_for_init_)
|
| return;
|
|
|
|
|