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

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

Issue 2498433002: Revert of Expose GlobalRequestID in NavigationHandle and ResourceRequestInfo. (Closed)
Patch Set: Created 4 years, 1 month 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_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string>
11 #include <utility> 10 #include <utility>
12 #include <vector>
13 11
14 #include "base/command_line.h" 12 #include "base/command_line.h"
15 #include "base/debug/crash_logging.h" 13 #include "base/debug/crash_logging.h"
16 #include "base/debug/dump_without_crashing.h" 14 #include "base/debug/dump_without_crashing.h"
17 #include "base/logging.h" 15 #include "base/logging.h"
18 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
19 #include "base/stl_util.h" 17 #include "base/stl_util.h"
20 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
21 #include "content/browser/child_process_security_policy_impl.h" 19 #include "content/browser/child_process_security_policy_impl.h"
22 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 20 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // See https://crbug.com/462682. 275 // See https://crbug.com/462682.
278 delegate_->NotifyMainFrameSwappedFromRenderManager( 276 delegate_->NotifyMainFrameSwappedFromRenderManager(
279 nullptr, render_frame_host_->render_view_host()); 277 nullptr, render_frame_host_->render_view_host());
280 } 278 }
281 } 279 }
282 280
283 // If entry includes the request ID of a request that is being transferred, 281 // If entry includes the request ID of a request that is being transferred,
284 // the destination render frame will take ownership, so release ownership of 282 // the destination render frame will take ownership, so release ownership of
285 // the transferring NavigationHandle. 283 // the transferring NavigationHandle.
286 if (transfer_navigation_handle_.get() && 284 if (transfer_navigation_handle_.get() &&
287 transfer_navigation_handle_->GetGlobalRequestID() == 285 transfer_navigation_handle_->request_id() ==
288 entry.transferred_global_request_id()) { 286 entry.transferred_global_request_id()) {
289 // The navigating RenderFrameHost should take ownership of the 287 // The navigating RenderFrameHost should take ownership of the
290 // NavigationHandle that came from the transferring RenderFrameHost. 288 // NavigationHandle that came from the transferring RenderFrameHost.
291 dest_render_frame_host->SetNavigationHandle( 289 dest_render_frame_host->SetNavigationHandle(
292 std::move(transfer_navigation_handle_)); 290 std::move(transfer_navigation_handle_));
293 291
294 dest_render_frame_host->navigation_handle()->set_render_frame_host( 292 dest_render_frame_host->navigation_handle()->set_render_frame_host(
295 dest_render_frame_host); 293 dest_render_frame_host);
296 } 294 }
297 295
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( 2264 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation(
2267 dest_url, source_instance, dest_instance, nullptr, transition, 2265 dest_url, source_instance, dest_instance, nullptr, transition,
2268 dest_is_restore, dest_is_view_source_mode); 2266 dest_is_restore, dest_is_view_source_mode);
2269 2267
2270 // Inform the transferring NavigationHandle of a transfer to a different 2268 // Inform the transferring NavigationHandle of a transfer to a different
2271 // SiteInstance. It is important do so now, in order to mark the request as 2269 // SiteInstance. It is important do so now, in order to mark the request as
2272 // transferring on the IO thread before attempting to destroy the pending RFH. 2270 // transferring on the IO thread before attempting to destroy the pending RFH.
2273 // This ensures the network request will not be destroyed along the pending 2271 // This ensures the network request will not be destroyed along the pending
2274 // RFH but will persist until it is picked up by the new RFH. 2272 // RFH but will persist until it is picked up by the new RFH.
2275 if (transfer_navigation_handle_.get() && 2273 if (transfer_navigation_handle_.get() &&
2276 transfer_navigation_handle_->GetGlobalRequestID() == 2274 transfer_navigation_handle_->request_id() == transferred_request_id &&
2277 transferred_request_id &&
2278 new_instance.get() != 2275 new_instance.get() !=
2279 transfer_navigation_handle_->GetRenderFrameHost() 2276 transfer_navigation_handle_->GetRenderFrameHost()
2280 ->GetSiteInstance()) { 2277 ->GetSiteInstance()) {
2281 transfer_navigation_handle_->Transfer(); 2278 transfer_navigation_handle_->Transfer();
2282 } 2279 }
2283 2280
2284 // If we are currently navigating cross-process to a pending RFH for a 2281 // If we are currently navigating cross-process to a pending RFH for a
2285 // different SiteInstance, we want to get back to normal and then navigate as 2282 // different SiteInstance, we want to get back to normal and then navigate as
2286 // usual. We will reuse the pending RFH below if it matches the destination 2283 // usual. We will reuse the pending RFH below if it matches the destination
2287 // SiteInstance. 2284 // SiteInstance.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 CommitPending(); 2331 CommitPending();
2335 return render_frame_host_.get(); 2332 return render_frame_host_.get();
2336 } 2333 }
2337 // Otherwise, it's safe to treat this as a pending cross-process transition. 2334 // Otherwise, it's safe to treat this as a pending cross-process transition.
2338 2335
2339 bool is_transfer = transferred_request_id != GlobalRequestID(); 2336 bool is_transfer = transferred_request_id != GlobalRequestID();
2340 if (is_transfer) { 2337 if (is_transfer) {
2341 // We don't need to stop the old renderer or run beforeunload/unload 2338 // We don't need to stop the old renderer or run beforeunload/unload
2342 // handlers, because those have already been done. 2339 // handlers, because those have already been done.
2343 DCHECK(transfer_navigation_handle_ && 2340 DCHECK(transfer_navigation_handle_ &&
2344 transfer_navigation_handle_->GetGlobalRequestID() == 2341 transfer_navigation_handle_->request_id() ==
2345 transferred_request_id); 2342 transferred_request_id);
2346 } else if (!pending_render_frame_host_->are_navigations_suspended()) { 2343 } else if (!pending_render_frame_host_->are_navigations_suspended()) {
2347 // If the pending RFH hasn't already been suspended from a previous 2344 // If the pending RFH hasn't already been suspended from a previous
2348 // attempt to navigate it, then we need to wait for the beforeunload 2345 // attempt to navigate it, then we need to wait for the beforeunload
2349 // handler to run. Suspend navigations in the pending RFH until we hear 2346 // handler to run. Suspend navigations in the pending RFH until we hear
2350 // back from the old RFH's beforeunload handler (via OnBeforeUnloadACK or 2347 // back from the old RFH's beforeunload handler (via OnBeforeUnloadACK or
2351 // a timeout). If the handler returns false, we'll have to cancel the 2348 // a timeout). If the handler returns false, we'll have to cancel the
2352 // request. 2349 // request.
2353 // 2350 //
2354 // Also make sure the old RenderFrame stops, in case a load is in 2351 // Also make sure the old RenderFrame stops, in case a load is in
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 if (old_render_frame_host) { 2458 if (old_render_frame_host) {
2462 old_render_frame_host->GetSiteInstance()-> 2459 old_render_frame_host->GetSiteInstance()->
2463 DecrementRelatedActiveContentsCount(); 2460 DecrementRelatedActiveContentsCount();
2464 } 2461 }
2465 } 2462 }
2466 2463
2467 return old_render_frame_host; 2464 return old_render_frame_host;
2468 } 2465 }
2469 2466
2470 RenderViewHostImpl* RenderFrameHostManager::GetSwappedOutRenderViewHost( 2467 RenderViewHostImpl* RenderFrameHostManager::GetSwappedOutRenderViewHost(
2471 SiteInstance* instance) const { 2468 SiteInstance* instance) const {
2472 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); 2469 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance);
2473 if (proxy) 2470 if (proxy)
2474 return proxy->GetRenderViewHost(); 2471 return proxy->GetRenderViewHost();
2475 return nullptr; 2472 return nullptr;
2476 } 2473 }
2477 2474
2478 RenderFrameProxyHost* RenderFrameHostManager::GetRenderFrameProxyHost( 2475 RenderFrameProxyHost* RenderFrameHostManager::GetRenderFrameProxyHost(
2479 SiteInstance* instance) const { 2476 SiteInstance* instance) const {
2480 auto it = proxy_hosts_.find(instance->GetId()); 2477 auto it = proxy_hosts_.find(instance->GetId());
2481 if (it != proxy_hosts_.end()) 2478 if (it != proxy_hosts_.end())
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 resolved_url)) { 2717 resolved_url)) {
2721 DCHECK(!dest_instance || 2718 DCHECK(!dest_instance ||
2722 dest_instance == render_frame_host_->GetSiteInstance()); 2719 dest_instance == render_frame_host_->GetSiteInstance());
2723 return false; 2720 return false;
2724 } 2721 }
2725 2722
2726 return true; 2723 return true;
2727 } 2724 }
2728 2725
2729 } // namespace content 2726 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.cc ('k') | content/browser/loader/resource_request_info_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698