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

Unified Diff: content/browser/frame_host/interstitial_page_impl.cc

Issue 1542743002: [RDHI] Refactored blocked_loaders_map_ to key by render frame route id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix lambda return value Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/interstitial_page_impl.cc
diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc
index 9e63d829f1ae2fa5b32dbb9a8aeae248441e0e42..5aef7e185165a95d392c2618d3010cb11aeedd86 100644
--- a/content/browser/frame_host/interstitial_page_impl.cc
+++ b/content/browser/frame_host/interstitial_page_impl.cc
@@ -53,28 +53,6 @@ using blink::WebDragOperation;
using blink::WebDragOperationsMask;
namespace content {
-namespace {
-
-void ResourceRequestHelper(ResourceDispatcherHostImpl* rdh,
- int process_id,
- int render_view_host_id,
- ResourceRequestAction action) {
- switch (action) {
- case BLOCK:
- rdh->BlockRequestsForRoute(process_id, render_view_host_id);
- break;
- case RESUME:
- rdh->ResumeBlockedRequestsForRoute(process_id, render_view_host_id);
- break;
- case CANCEL:
- rdh->CancelBlockedRequestsForRoute(process_id, render_view_host_id);
- break;
- default:
- NOTREACHED();
- }
-}
-
-} // namespace
class InterstitialPageImpl::InterstitialPageRVHDelegateView
: public RenderViewHostDelegateView {
@@ -839,22 +817,27 @@ void InterstitialPageImpl::TakeActionOnResourceDispatcher(
// The tab might not have a render_view_host if it was closed (in which case,
// we have taken care of the blocked requests when processing
// NOTIFY_RENDER_WIDGET_HOST_DESTROYED.
- // Also we need to test there is a ResourceDispatcherHostImpl, as when unit-
- // tests we don't have one.
+ // ResourceDispatcherHostImpl tests its own existence, as unit-tests don't
+ // have one.
Randy Smith (Not in Mondays) 2016/01/20 23:23:19 I think this comment isn't needed anymore.
Charlie Harrison 2016/01/21 18:52:55 Done.
RenderViewHostImpl* rvh = RenderViewHostImpl::FromID(original_child_id_,
original_rvh_id_);
- if (!rvh || !ResourceDispatcherHostImpl::Get())
+ if (!rvh)
return;
- BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
- base::Bind(
- &ResourceRequestHelper,
- ResourceDispatcherHostImpl::Get(),
- original_child_id_,
- original_rvh_id_,
- action));
+ base::Callback<void(ResourceDispatcherHostImpl*, const GlobalFrameRoutingId&)>
+ frame_callback = base::Bind([](ResourceRequestAction action) {
+ switch (action) {
+ case BLOCK:
+ return &ResourceDispatcherHostImpl::BlockRequestsForRoute;
+ case RESUME:
+ return &ResourceDispatcherHostImpl::ResumeBlockedRequestsForRoute;
+ default:
+ DCHECK_EQ(action, CANCEL);
+ return &ResourceDispatcherHostImpl::CancelBlockedRequestsForRoute;
+ }
+ }(action));
+ ResourceDispatcherHostImpl::NotifyForEachFrame(
+ rvh->GetDelegate()->GetFrameTree(), frame_callback);
Randy Smith (Not in Mondays) 2016/01/20 23:23:19 Suggestion: IMO, this code would be simpler and mo
Charlie Harrison 2016/01/21 18:52:55 Done.
}
void InterstitialPageImpl::OnDomOperationResponse(

Powered by Google App Engine
This is Rietveld 408576698