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

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

Issue 2768813002: PlzNavigate: don't stop all loaders when renderer-initiated nav fails
Patch Set: Removed id Created 3 years, 9 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/frame_tree_node.h" 5 #include "content/browser/frame_host/frame_tree_node.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 navigation_request_->common_params().navigation_type); 393 navigation_request_->common_params().navigation_type);
394 394
395 DidStartLoading(to_different_document, was_previously_loading); 395 DidStartLoading(to_different_document, was_previously_loading);
396 } 396 }
397 397
398 void FrameTreeNode::ResetNavigationRequest(bool keep_state, 398 void FrameTreeNode::ResetNavigationRequest(bool keep_state,
399 bool inform_renderer) { 399 bool inform_renderer) {
400 CHECK(IsBrowserSideNavigationEnabled()); 400 CHECK(IsBrowserSideNavigationEnabled());
401 if (!navigation_request_) 401 if (!navigation_request_)
402 return; 402 return;
403 bool was_renderer_initiated = !navigation_request_->browser_initiated(); 403
404 // The renderer should be informed if the caller allows to do so and the
405 // navigation came from a BeginNavigation IPC. This corresponds to
406 // may_transfer being set to false on the NavigationRequest.
407 int need_to_inform_renderer =
408 inform_renderer && !navigation_request_->may_transfer();
Charlie Reis 2017/03/23 16:52:53 Hmm, I'm not sure I understand this change. Why w
clamy 2017/04/24 13:53:44 We should only inform the renderer if the navigati
Charlie Reis 2017/04/24 20:13:38 Ok, so the OpenURL case means the renderer doesn't
clamy 2017/04/25 12:24:08 I agree that the naming is confusing. I think we n
409
404 NavigationRequest::AssociatedSiteInstanceType site_instance_type = 410 NavigationRequest::AssociatedSiteInstanceType site_instance_type =
405 navigation_request_->associated_site_instance_type(); 411 navigation_request_->associated_site_instance_type();
406 navigation_request_.reset(); 412 navigation_request_.reset();
407 413
408 if (keep_state) 414 if (keep_state)
409 return; 415 return;
410 416
411 // The RenderFrameHostManager should clean up any speculative RenderFrameHost 417 // The RenderFrameHostManager should clean up any speculative RenderFrameHost
412 // it created for the navigation. Also register that the load stopped. 418 // it created for the navigation. Also register that the load stopped.
413 DidStopLoading(); 419 DidStopLoading();
414 render_manager_.CleanUpNavigation(); 420 render_manager_.CleanUpNavigation();
415 421
416 // When reusing the same SiteInstance, a pending WebUI may have been created 422 // When reusing the same SiteInstance, a pending WebUI may have been created
417 // on behalf of the navigation in the current RenderFrameHost. Clear it. 423 // on behalf of the navigation in the current RenderFrameHost. Clear it.
418 if (site_instance_type == 424 if (site_instance_type ==
419 NavigationRequest::AssociatedSiteInstanceType::CURRENT) { 425 NavigationRequest::AssociatedSiteInstanceType::CURRENT) {
420 current_frame_host()->ClearPendingWebUI(); 426 current_frame_host()->ClearPendingWebUI();
421 } 427 }
422 428
423 // If the navigation is renderer-initiated, the renderer should also be 429 // If the navigation is renderer-initiated, the renderer should also be
424 // informed that the navigation stopped if needed. In the case the renderer 430 // informed that the navigation stopped if needed. In the case the renderer
425 // process asked for the navigation to be aborted, e.g. following a 431 // process asked for the navigation to be aborted, e.g. following a
426 // document.open, do not send an IPC to the renderer process as it already 432 // document.open, do not send an IPC to the renderer process as it already
427 // expects the navigation to stop. 433 // expects the navigation to stop.
428 if (was_renderer_initiated && inform_renderer) { 434 if (need_to_inform_renderer) {
429 current_frame_host()->Send( 435 current_frame_host()->Send(
430 new FrameMsg_Stop(current_frame_host()->GetRoutingID())); 436 new FrameMsg_DroppedNavigation(current_frame_host()->GetRoutingID()));
431 } 437 }
432 438
433 } 439 }
434 440
435 bool FrameTreeNode::has_started_loading() const { 441 bool FrameTreeNode::has_started_loading() const {
436 return loading_progress_ != kLoadingProgressNotStarted; 442 return loading_progress_ != kLoadingProgressNotStarted;
437 } 443 }
438 444
439 void FrameTreeNode::reset_loading_progress() { 445 void FrameTreeNode::reset_loading_progress() {
440 loading_progress_ = kLoadingProgressNotStarted; 446 loading_progress_ = kLoadingProgressNotStarted;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 } 568 }
563 return parent_->child_at(i + relative_offset); 569 return parent_->child_at(i + relative_offset);
564 } 570 }
565 } 571 }
566 572
567 NOTREACHED() << "FrameTreeNode not found in its parent's children."; 573 NOTREACHED() << "FrameTreeNode not found in its parent's children.";
568 return nullptr; 574 return nullptr;
569 } 575 }
570 576
571 } // namespace content 577 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigator_impl.cc » ('j') | content/common/frame_messages.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698